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

  /// Service for the `regionZones` resource.
  ///
  /// @Snippet(path: "regionZonesQuickstart")
  public class RegionZonesClient: Clients.RegionZonesProtocol {
    let inner: any Clients.RegionZonesStub

    /// Creates a new `RegionZonesClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.RegionZonesStub = try Clients.RegionZonesTransport(options)
      inner = Clients.RegionZonesRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.RegionZonesLogging(inner, logger: logger)
      }
      self.inner = inner
    }

    /// Retrieves the list of Zone resources under the specific region available to
    /// the specified project.
    ///
    /// @Snippet(path: "regionZones_list")
    public func list(
      request: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudComputeV1.ZoneList {
      try await self.inner.list(request: request, options: options)
    }

    /// Retrieves the list of Zone resources under the specific region available to
    /// the specified project.
    ///
    /// @Snippet(path: "regionZones_list")
    public func list(
      byItem: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Zone, Swift.Error> {
      let listRpc = { (token: Swift.String) async throws -> GoogleCloudComputeV1.ZoneList in
        var request = byItem
        request.pageToken = token
        return try await self.list(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }
  }

  extension Clients {
    /// A Swift protocol to mock `RegionZonesClient`.
    ///
    /// To mock `RegionZonesClient` change your functions to receive
    /// `some RegionZonesProtocol` or `any RegionZonesProtocol`
    /// and pass a mock implementation in your tests.
    public protocol RegionZonesProtocol {
      /// See `RegionZonesClient.list`.
      func list(request: RegionZonesClient.ListRequest) async throws
        -> GoogleCloudComputeV1.ZoneList

      /// See `RegionZonesClient.list`.
      func list(
        byItem: RegionZonesClient.ListRequest
      ) throws -> any AsyncSequence<Zone, Swift.Error>

      /// See `RegionZonesClient.list`.
      func list(
        project: Swift.String,
        region: Swift.String,
      ) throws -> any AsyncSequence<Zone, Swift.Error>

      /// See `RegionZonesClient.list`.
      func list(
        request: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudComputeV1.ZoneList

      /// See `RegionZonesClient.list`.
      func list(
        byItem: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<Zone, Swift.Error>
    }
  }

  // Default implementations
  extension Clients.RegionZonesProtocol {
    public func list(request: RegionZonesClient.ListRequest) async throws
      -> GoogleCloudComputeV1.ZoneList
    {
      try await self.list(request: request, options: .init())
    }

    public func list(
      request: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudComputeV1.ZoneList {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func list(
      byItem: RegionZonesClient.ListRequest
    ) throws -> any AsyncSequence<Zone, Swift.Error> {
      try self.list(byItem: byItem, options: .init())
    }

    public func list(
      byItem: RegionZonesClient.ListRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Zone, Swift.Error> {
      let listRpc = { (token: Swift.String) async throws -> GoogleCloudComputeV1.ZoneList in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    public func list(
      project: Swift.String,
      region: Swift.String,
    ) throws -> any AsyncSequence<Zone, Swift.Error> {
      let request = RegionZonesClient.ListRequest().with {
        $0.project = project
        $0.region = region
      }
      return try self.list(byItem: request)
    }
  }
#endif
