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

/// Service for managing BigQuery export configurations for Chronicle instances.
///
/// @Snippet(path: "BigQueryExportServiceQuickstart")
public class BigQueryExportServiceClient: Clients.BigQueryExportServiceProtocol {
  let inner: any Clients.BigQueryExportServiceStub

  /// Creates a new `BigQueryExportServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.BigQueryExportServiceStub = try Clients.BigQueryExportServiceTransport(
      options)
    inner = Clients.BigQueryExportServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.BigQueryExportServiceLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Get the BigQuery export configuration for a Chronicle instance.
  ///
  /// @Snippet(path: "BigQueryExportService_GetBigQueryExport")
  public func getBigQueryExport(
    request: GetBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    try await self.inner.getBigQueryExport(request: request, options: options)
  }

  /// Update the BigQuery export configuration for a Chronicle instance.
  ///
  /// @Snippet(path: "BigQueryExportService_UpdateBigQueryExport")
  public func updateBigQueryExport(
    request: UpdateBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    try await self.inner.updateBigQueryExport(request: request, options: options)
  }

  /// Provision the BigQuery export for a Chronicle instance. This will create
  /// {{gcp_name}} resources like {{storage_name}} buckets, BigQuery datasets
  /// and set default export settings for each data source.
  ///
  /// @Snippet(path: "BigQueryExportService_ProvisionBigQueryExport")
  public func provisionBigQueryExport(
    request: ProvisionBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    try await self.inner.provisionBigQueryExport(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: "BigQueryExportService_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: "BigQueryExportService_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: "BigQueryExportService_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: "BigQueryExportService_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: "BigQueryExportService_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 `BigQueryExportServiceClient`.
  ///
  /// To mock `BigQueryExportServiceClient` change your functions to receive
  /// `some BigQueryExportServiceProtocol` or `any BigQueryExportServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol BigQueryExportServiceProtocol {
    /// See `BigQueryExportServiceClient.getBigQueryExport`.
    func getBigQueryExport(request: GetBigQueryExportRequest) async throws
      -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.getBigQueryExport`.
    func getBigQueryExport(
      name: Swift.String,
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.updateBigQueryExport`.
    func updateBigQueryExport(request: UpdateBigQueryExportRequest) async throws
      -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.updateBigQueryExport`.
    func updateBigQueryExport(
      bigQueryExport: BigQueryExport?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.provisionBigQueryExport`.
    func provisionBigQueryExport(request: ProvisionBigQueryExportRequest) async throws
      -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.provisionBigQueryExport`.
    func provisionBigQueryExport(
      parent: Swift.String,
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

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

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

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

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

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

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

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

    /// See `BigQueryExportServiceClient.getBigQueryExport`.
    func getBigQueryExport(
      request: GetBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.updateBigQueryExport`.
    func updateBigQueryExport(
      request: UpdateBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

    /// See `BigQueryExportServiceClient.provisionBigQueryExport`.
    func provisionBigQueryExport(
      request: ProvisionBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.BigQueryExport

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

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

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

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

// Default implementations
extension Clients.BigQueryExportServiceProtocol {
  public func getBigQueryExport(request: GetBigQueryExportRequest) async throws
    -> GoogleCloudChronicleV1.BigQueryExport
  {
    try await self.getBigQueryExport(request: request, options: .init())
  }

  public func getBigQueryExport(
    request: GetBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    throw GoogleCloudGax.RequestError.unimplemented
  }

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

  public func updateBigQueryExport(request: UpdateBigQueryExportRequest) async throws
    -> GoogleCloudChronicleV1.BigQueryExport
  {
    try await self.updateBigQueryExport(request: request, options: .init())
  }

  public func updateBigQueryExport(
    request: UpdateBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateBigQueryExport(
    bigQueryExport: BigQueryExport?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    let request = UpdateBigQueryExportRequest().with {
      $0.bigQueryExport = bigQueryExport
      $0.updateMask = updateMask
    }
    return try await self.updateBigQueryExport(request: request)
  }

  public func provisionBigQueryExport(request: ProvisionBigQueryExportRequest) async throws
    -> GoogleCloudChronicleV1.BigQueryExport
  {
    try await self.provisionBigQueryExport(request: request, options: .init())
  }

  public func provisionBigQueryExport(
    request: ProvisionBigQueryExportRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func provisionBigQueryExport(
    parent: Swift.String,
  ) async throws -> GoogleCloudChronicleV1.BigQueryExport {
    let request = ProvisionBigQueryExportRequest().with {
      $0.parent = parent
    }
    return try await self.provisionBigQueryExport(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)
  }
}
