// Code generated by sidekick. DO NOT EDIT.
//
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#if SqlDatabasesService
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudWkt
  import GoogleCloudGax

  /// Service to manage databases.
  ///
  /// @Snippet(path: "SqlDatabasesServiceQuickstart")
  public class SqlDatabasesServiceClient: Clients.SqlDatabasesServiceProtocol {
    let inner: any Clients.SqlDatabasesServiceStub

    /// Creates a new `SqlDatabasesServiceClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.SqlDatabasesServiceStub = try Clients.SqlDatabasesServiceTransport(
        options)
      inner = Clients.SqlDatabasesServiceRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.SqlDatabasesServiceLogging(inner, logger: logger)
      }
      self.inner = inner
    }

    /// Deletes a database from a Cloud SQL instance.
    ///
    /// @Snippet(path: "SqlDatabasesService_Delete")
    public func delete(
      request: SqlDatabasesDeleteRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.delete(request: request, options: options)
    }

    /// Retrieves a resource containing information about a database inside a Cloud
    /// SQL instance.
    ///
    /// @Snippet(path: "SqlDatabasesService_Get")
    public func `get`(
      request: SqlDatabasesGetRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Database {
      try await self.inner.`get`(request: request, options: options)
    }

    /// Inserts a resource containing information about a database inside a Cloud
    /// SQL instance.
    ///
    /// **Note:** You can't modify the default character set and collation.
    ///
    /// @Snippet(path: "SqlDatabasesService_Insert")
    public func insert(
      request: SqlDatabasesInsertRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.insert(request: request, options: options)
    }

    /// Lists databases in the specified Cloud SQL instance.
    ///
    /// @Snippet(path: "SqlDatabasesService_List")
    public func list(
      request: SqlDatabasesListRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.DatabasesListResponse {
      try await self.inner.list(request: request, options: options)
    }

    /// Partially updates a resource containing information about a database inside
    /// a Cloud SQL instance. This method supports patch semantics.
    ///
    /// @Snippet(path: "SqlDatabasesService_Patch")
    public func patch(
      request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.patch(request: request, options: options)
    }

    /// Updates a resource containing information about a database inside a Cloud
    /// SQL instance.
    ///
    /// @Snippet(path: "SqlDatabasesService_Update")
    public func update(
      request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.update(request: request, options: options)
    }
  }

  extension Clients {
    /// A Swift protocol to mock `SqlDatabasesServiceClient`.
    ///
    /// To mock `SqlDatabasesServiceClient` change your functions to receive
    /// `some SqlDatabasesServiceProtocol` or `any SqlDatabasesServiceProtocol`
    /// and pass a mock implementation in your tests.
    public protocol SqlDatabasesServiceProtocol {
      /// See `SqlDatabasesServiceClient.delete`.
      func delete(request: SqlDatabasesDeleteRequest) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.`get``.
      func `get`(request: SqlDatabasesGetRequest) async throws -> GoogleCloudSqlV1.Database

      /// See `SqlDatabasesServiceClient.insert`.
      func insert(request: SqlDatabasesInsertRequest) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.list`.
      func list(request: SqlDatabasesListRequest) async throws
        -> GoogleCloudSqlV1.DatabasesListResponse

      /// See `SqlDatabasesServiceClient.patch`.
      func patch(request: SqlDatabasesUpdateRequest) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.update`.
      func update(request: SqlDatabasesUpdateRequest) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.delete`.
      func delete(
        request: SqlDatabasesDeleteRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.`get``.
      func `get`(
        request: SqlDatabasesGetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.Database

      /// See `SqlDatabasesServiceClient.insert`.
      func insert(
        request: SqlDatabasesInsertRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.list`.
      func list(
        request: SqlDatabasesListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.DatabasesListResponse

      /// See `SqlDatabasesServiceClient.patch`.
      func patch(
        request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.Operation

      /// See `SqlDatabasesServiceClient.update`.
      func update(
        request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.Operation
    }
  }

  // Default implementations
  extension Clients.SqlDatabasesServiceProtocol {
    public func delete(request: SqlDatabasesDeleteRequest) async throws
      -> GoogleCloudSqlV1.Operation
    {
      try await self.delete(request: request, options: .init())
    }

    public func delete(
      request: SqlDatabasesDeleteRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func `get`(request: SqlDatabasesGetRequest) async throws -> GoogleCloudSqlV1.Database {
      try await self.`get`(request: request, options: .init())
    }

    public func `get`(
      request: SqlDatabasesGetRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Database {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func insert(request: SqlDatabasesInsertRequest) async throws
      -> GoogleCloudSqlV1.Operation
    {
      try await self.insert(request: request, options: .init())
    }

    public func insert(
      request: SqlDatabasesInsertRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func list(request: SqlDatabasesListRequest) async throws
      -> GoogleCloudSqlV1.DatabasesListResponse
    {
      try await self.list(request: request, options: .init())
    }

    public func list(
      request: SqlDatabasesListRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.DatabasesListResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func patch(request: SqlDatabasesUpdateRequest) async throws -> GoogleCloudSqlV1.Operation
    {
      try await self.patch(request: request, options: .init())
    }

    public func patch(
      request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func update(request: SqlDatabasesUpdateRequest) async throws
      -> GoogleCloudSqlV1.Operation
    {
      try await self.update(request: request, options: .init())
    }

    public func update(
      request: SqlDatabasesUpdateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      throw GoogleCloudGax.RequestError.unimplemented
    }
  }
#endif
