// 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.

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

/// A service providing functionality for managing dashboards' charts.
///
/// @Snippet(path: "DashboardChartServiceQuickstart")
public class DashboardChartServiceClient: Clients.DashboardChartServiceProtocol {
  let inner: any Clients.DashboardChartServiceStub

  /// Creates a new `DashboardChartServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.DashboardChartServiceStub = try Clients.DashboardChartServiceTransport(
      options)
    inner = Clients.DashboardChartServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.DashboardChartServiceLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Get a dashboard chart.
  ///
  /// @Snippet(path: "DashboardChartService_GetDashboardChart")
  public func getDashboardChart(
    request: GetDashboardChartRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.DashboardChart {
    try await self.inner.getDashboardChart(request: request, options: options)
  }

  /// Get dashboard charts in batches.
  ///
  /// @Snippet(path: "DashboardChartService_BatchGetDashboardCharts")
  public func batchGetDashboardCharts(
    request: BatchGetDashboardChartsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse {
    try await self.inner.batchGetDashboardCharts(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "DashboardChartService_ListOperations")
  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    try await self.inner.listOperations(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "DashboardChartService_ListOperations")
  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listOperations(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "DashboardChartService_GetOperation")
  func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    try await self.inner.getOperation(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "DashboardChartService_DeleteOperation")
  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.deleteOperation(request: request, options: options)
  }

  /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
  ///
  /// [google.longrunning.Operations]: https://www.google.com/search?q=Swift+google.longrunning+Operations
  ///
  /// @Snippet(path: "DashboardChartService_CancelOperation")
  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    try await self.inner.cancelOperation(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `DashboardChartServiceClient`.
  ///
  /// To mock `DashboardChartServiceClient` change your functions to receive
  /// `some DashboardChartServiceProtocol` or `any DashboardChartServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol DashboardChartServiceProtocol {
    /// See `DashboardChartServiceClient.getDashboardChart`.
    func getDashboardChart(request: GetDashboardChartRequest) async throws
      -> GoogleCloudChronicleV1.DashboardChart

    /// See `DashboardChartServiceClient.getDashboardChart`.
    func getDashboardChart(
      name: Swift.String,
    ) async throws -> GoogleCloudChronicleV1.DashboardChart

    /// See `DashboardChartServiceClient.batchGetDashboardCharts`.
    func batchGetDashboardCharts(request: BatchGetDashboardChartsRequest) async throws
      -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse

    /// See `DashboardChartServiceClient.batchGetDashboardCharts`.
    func batchGetDashboardCharts(
      parent: Swift.String,
      names: [Swift.String],
    ) async throws -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse

    /// See `DashboardChartServiceClient.listOperations`.
    func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
      -> GoogleLongRunning.ListOperationsResponse

    /// See `DashboardChartServiceClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `DashboardChartServiceClient.listOperations`.
    func listOperations(
      name: Swift.String,
      filter: Swift.String,
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `DashboardChartServiceClient.deleteOperation`.
    func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws

    /// See `DashboardChartServiceClient.deleteOperation`.
    func deleteOperation(
      name: Swift.String,
    ) async throws

    /// See `DashboardChartServiceClient.cancelOperation`.
    func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws

    /// See `DashboardChartServiceClient.cancelOperation`.
    func cancelOperation(
      name: Swift.String,
    ) async throws

    /// See `DashboardChartServiceClient.getDashboardChart`.
    func getDashboardChart(
      request: GetDashboardChartRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.DashboardChart

    /// See `DashboardChartServiceClient.batchGetDashboardCharts`.
    func batchGetDashboardCharts(
      request: BatchGetDashboardChartsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse

    /// See `DashboardChartServiceClient.listOperations`.
    func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse

    /// See `DashboardChartServiceClient.listOperations`.
    func listOperations(
      byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error>

    /// See `DashboardChartServiceClient.deleteOperation`.
    func deleteOperation(
      request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    /// See `DashboardChartServiceClient.cancelOperation`.
    func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws
  }
}

// Default implementations
extension Clients.DashboardChartServiceProtocol {
  public func getDashboardChart(request: GetDashboardChartRequest) async throws
    -> GoogleCloudChronicleV1.DashboardChart
  {
    try await self.getDashboardChart(request: request, options: .init())
  }

  public func getDashboardChart(
    request: GetDashboardChartRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.DashboardChart {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getDashboardChart(
    name: Swift.String,
  ) async throws -> GoogleCloudChronicleV1.DashboardChart {
    let request = GetDashboardChartRequest().with {
      $0.name = name
    }
    return try await self.getDashboardChart(request: request)
  }

  public func batchGetDashboardCharts(request: BatchGetDashboardChartsRequest) async throws
    -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse
  {
    try await self.batchGetDashboardCharts(request: request, options: .init())
  }

  public func batchGetDashboardCharts(
    request: BatchGetDashboardChartsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func batchGetDashboardCharts(
    parent: Swift.String,
    names: [Swift.String],
  ) async throws -> GoogleCloudChronicleV1.BatchGetDashboardChartsResponse {
    let request = BatchGetDashboardChartsRequest().with {
      $0.parent = parent
      $0.names = names
    }
    return try await self.batchGetDashboardCharts(request: request)
  }

  public func listOperations(request: GoogleLongRunning.ListOperationsRequest) async throws
    -> GoogleLongRunning.ListOperationsResponse
  {
    try await self.listOperations(request: request, options: .init())
  }

  public func listOperations(
    request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.ListOperationsResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    try self.listOperations(byItem: byItem, options: .init())
  }

  public func listOperations(
    byItem: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleLongRunning.ListOperationsResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listOperations(
    name: Swift.String,
    filter: Swift.String,
  ) throws -> any AsyncSequence<GoogleLongRunning.Operation, Swift.Error> {
    let request = GoogleLongRunning.ListOperationsRequest().with {
      $0.name = name
      $0.filter = filter
    }
    return try self.listOperations(byItem: request)
  }

  public func getOperation(request: GoogleLongRunning.GetOperationRequest) async throws
    -> GoogleLongRunning.Operation
  {
    try await self.getOperation(request: request, options: .init())
  }

  public func getOperation(
    request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleLongRunning.Operation {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getOperation(
    name: Swift.String,
  ) async throws -> GoogleLongRunning.Operation {
    let request = GoogleLongRunning.GetOperationRequest().with {
      $0.name = name
    }
    return try await self.getOperation(request: request)
  }

  public func deleteOperation(request: GoogleLongRunning.DeleteOperationRequest) async throws {
    try await self.deleteOperation(request: request, options: .init())
  }

  public func deleteOperation(
    request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func deleteOperation(
    name: Swift.String,
  ) async throws {
    let request = GoogleLongRunning.DeleteOperationRequest().with {
      $0.name = name
    }
    try await self.deleteOperation(request: request)
  }

  public func cancelOperation(request: GoogleLongRunning.CancelOperationRequest) async throws {
    try await self.cancelOperation(request: request, options: .init())
  }

  public func cancelOperation(
    request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
  ) async throws {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func cancelOperation(
    name: Swift.String,
  ) async throws {
    let request = GoogleLongRunning.CancelOperationRequest().with {
      $0.name = name
    }
    try await self.cancelOperation(request: request)
  }
}
