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

/// The SnoozeService API is used to temporarily prevent an alert policy from
/// generating alerts. A Snooze is a description of the criteria under which one
/// or more alert policies should not fire alerts for the specified duration.
///
/// @Snippet(path: "SnoozeServiceQuickstart")
public class SnoozeServiceClient: Clients.SnoozeServiceProtocol {
  let inner: any Clients.SnoozeServiceStub

  /// Creates a new `SnoozeServiceClient` instance.
  public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
    var inner: any Clients.SnoozeServiceStub = try Clients.SnoozeServiceTransport(options)
    inner = Clients.SnoozeServiceRetry(inner, options: options)
    if let logger = options.logger {
      inner = Clients.SnoozeServiceLogging(inner, logger: logger)
    }
    self.inner = inner
  }

  /// Creates a `Snooze` that will prevent alerts, which match the provided
  /// criteria, from being opened. The `Snooze` applies for a specific time
  /// interval.
  ///
  /// @Snippet(path: "SnoozeService_CreateSnooze")
  public func createSnooze(
    request: CreateSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    try await self.inner.createSnooze(request: request, options: options)
  }

  /// Lists the `Snooze`s associated with a project. Can optionally pass in
  /// `filter`, which specifies predicates to match `Snooze`s.
  ///
  /// @Snippet(path: "SnoozeService_ListSnoozes")
  public func listSnoozes(
    request: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.ListSnoozesResponse {
    try await self.inner.listSnoozes(request: request, options: options)
  }

  /// Lists the `Snooze`s associated with a project. Can optionally pass in
  /// `filter`, which specifies predicates to match `Snooze`s.
  ///
  /// @Snippet(path: "SnoozeService_ListSnoozes")
  public func listSnoozes(
    byItem: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Snooze, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMonitoringV3.ListSnoozesResponse in
      var request = byItem
      request.pageToken = token
      return try await self.listSnoozes(request: request, options: options)
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  /// Retrieves a `Snooze` by `name`.
  ///
  /// @Snippet(path: "SnoozeService_GetSnooze")
  public func getSnooze(
    request: GetSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    try await self.inner.getSnooze(request: request, options: options)
  }

  /// Updates a `Snooze`, identified by its `name`, with the parameters in the
  /// given `Snooze` object.
  ///
  /// @Snippet(path: "SnoozeService_UpdateSnooze")
  public func updateSnooze(
    request: UpdateSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    try await self.inner.updateSnooze(request: request, options: options)
  }
}

extension Clients {
  /// A Swift protocol to mock `SnoozeServiceClient`.
  ///
  /// To mock `SnoozeServiceClient` change your functions to receive
  /// `some SnoozeServiceProtocol` or `any SnoozeServiceProtocol`
  /// and pass a mock implementation in your tests.
  public protocol SnoozeServiceProtocol {
    /// See `SnoozeServiceClient.createSnooze`.
    func createSnooze(request: CreateSnoozeRequest) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.createSnooze`.
    func createSnooze(
      parent: Swift.String,
      snooze: Snooze?,
    ) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.listSnoozes`.
    func listSnoozes(request: ListSnoozesRequest) async throws
      -> GoogleCloudMonitoringV3.ListSnoozesResponse

    /// See `SnoozeServiceClient.listSnoozes`.
    func listSnoozes(
      byItem: ListSnoozesRequest
    ) throws -> any AsyncSequence<Snooze, Swift.Error>

    /// See `SnoozeServiceClient.listSnoozes`.
    func listSnoozes(
      parent: Swift.String,
    ) throws -> any AsyncSequence<Snooze, Swift.Error>

    /// See `SnoozeServiceClient.getSnooze`.
    func getSnooze(request: GetSnoozeRequest) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.getSnooze`.
    func getSnooze(
      name: Swift.String,
    ) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.updateSnooze`.
    func updateSnooze(request: UpdateSnoozeRequest) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.updateSnooze`.
    func updateSnooze(
      snooze: Snooze?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.createSnooze`.
    func createSnooze(
      request: CreateSnoozeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.listSnoozes`.
    func listSnoozes(
      request: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMonitoringV3.ListSnoozesResponse

    /// See `SnoozeServiceClient.listSnoozes`.
    func listSnoozes(
      byItem: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Snooze, Swift.Error>

    /// See `SnoozeServiceClient.getSnooze`.
    func getSnooze(
      request: GetSnoozeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMonitoringV3.Snooze

    /// See `SnoozeServiceClient.updateSnooze`.
    func updateSnooze(
      request: UpdateSnoozeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudMonitoringV3.Snooze
  }
}

// Default implementations
extension Clients.SnoozeServiceProtocol {
  public func createSnooze(request: CreateSnoozeRequest) async throws
    -> GoogleCloudMonitoringV3.Snooze
  {
    try await self.createSnooze(request: request, options: .init())
  }

  public func createSnooze(
    request: CreateSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func createSnooze(
    parent: Swift.String,
    snooze: Snooze?,
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    let request = CreateSnoozeRequest().with {
      $0.parent = parent
      $0.snooze = snooze
    }
    return try await self.createSnooze(request: request)
  }

  public func listSnoozes(request: ListSnoozesRequest) async throws
    -> GoogleCloudMonitoringV3.ListSnoozesResponse
  {
    try await self.listSnoozes(request: request, options: .init())
  }

  public func listSnoozes(
    request: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.ListSnoozesResponse {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func listSnoozes(
    byItem: ListSnoozesRequest
  ) throws -> any AsyncSequence<Snooze, Swift.Error> {
    try self.listSnoozes(byItem: byItem, options: .init())
  }

  public func listSnoozes(
    byItem: ListSnoozesRequest, options: GoogleCloudGax.RequestOptions
  ) throws -> any AsyncSequence<Snooze, Swift.Error> {
    let listRpc = {
      (token: Swift.String) async throws -> GoogleCloudMonitoringV3.ListSnoozesResponse in
      throw GoogleCloudGax.RequestError.unimplemented
    }
    return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
  }

  public func listSnoozes(
    parent: Swift.String,
  ) throws -> any AsyncSequence<Snooze, Swift.Error> {
    let request = ListSnoozesRequest().with {
      $0.parent = parent
    }
    return try self.listSnoozes(byItem: request)
  }

  public func getSnooze(request: GetSnoozeRequest) async throws -> GoogleCloudMonitoringV3.Snooze {
    try await self.getSnooze(request: request, options: .init())
  }

  public func getSnooze(
    request: GetSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func getSnooze(
    name: Swift.String,
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    let request = GetSnoozeRequest().with {
      $0.name = name
    }
    return try await self.getSnooze(request: request)
  }

  public func updateSnooze(request: UpdateSnoozeRequest) async throws
    -> GoogleCloudMonitoringV3.Snooze
  {
    try await self.updateSnooze(request: request, options: .init())
  }

  public func updateSnooze(
    request: UpdateSnoozeRequest, options: GoogleCloudGax.RequestOptions
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    throw GoogleCloudGax.RequestError.unimplemented
  }

  public func updateSnooze(
    snooze: Snooze?,
    updateMask: GoogleCloudWkt.FieldMask?,
  ) async throws -> GoogleCloudMonitoringV3.Snooze {
    let request = UpdateSnoozeRequest().with {
      $0.snooze = snooze
      $0.updateMask = updateMask
    }
    return try await self.updateSnooze(request: request)
  }
}
