// 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 SqlUsersService
  import Foundation
  #if canImport(FoundationNetworking)
    import FoundationNetworking
  #endif
  import GoogleCloudWkt
  import GoogleCloudGax

  /// Cloud SQL users service.
  ///
  /// @Snippet(path: "SqlUsersServiceQuickstart")
  public class SqlUsersServiceClient: Clients.SqlUsersServiceProtocol {
    let inner: any Clients.SqlUsersServiceStub

    /// Creates a new `SqlUsersServiceClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.SqlUsersServiceStub = try Clients.SqlUsersServiceTransport(options)
      inner = Clients.SqlUsersServiceRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.SqlUsersServiceLogging(inner, logger: logger)
      }
      self.inner = inner
    }

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

    /// Retrieves a resource containing information about a user.
    ///
    /// @Snippet(path: "SqlUsersService_Get")
    public func `get`(
      request: SqlUsersGetRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.User {
      try await self.inner.`get`(request: request, options: options)
    }

    /// Creates a new user in a Cloud SQL instance.
    ///
    /// @Snippet(path: "SqlUsersService_Insert")
    public func insert(
      request: SqlUsersInsertRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.insert(request: request, options: options)
    }

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

    /// Updates an existing user in a Cloud SQL instance.
    ///
    /// @Snippet(path: "SqlUsersService_Update")
    public func update(
      request: SqlUsersUpdateRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudSqlV1.Operation {
      try await self.inner.update(request: request, options: options)
    }
  }

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

      /// See `SqlUsersServiceClient.`get``.
      func `get`(request: SqlUsersGetRequest) async throws -> GoogleCloudSqlV1.User

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

      /// See `SqlUsersServiceClient.list`.
      func list(request: SqlUsersListRequest) async throws -> GoogleCloudSqlV1.UsersListResponse

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

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

      /// See `SqlUsersServiceClient.`get``.
      func `get`(
        request: SqlUsersGetRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.User

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

      /// See `SqlUsersServiceClient.list`.
      func list(
        request: SqlUsersListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudSqlV1.UsersListResponse

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

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

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

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

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

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

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

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

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

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

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