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

  /// Tool Service for LLM powered Agent Assist. Tools can be used to interact with
  /// remote APIs (e.g. fetching orders) to retrieve additional information as
  /// input to LLM.
  ///
  /// @Snippet(path: "ToolsQuickstart")
  public class ToolsClient: Clients.ToolsProtocol {
    let inner: any Clients.ToolsStub

    /// Creates a new `ToolsClient` instance.
    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      var inner: any Clients.ToolsStub = try Clients.ToolsTransport(options)
      inner = Clients.ToolsRetry(inner, options: options)
      if let logger = options.logger {
        inner = Clients.ToolsLogging(inner, logger: logger)
      }
      self.inner = inner
    }

    /// Creates a tool.
    ///
    /// @Snippet(path: "Tools_CreateTool")
    public func createTool(
      request: CreateToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      try await self.inner.createTool(request: request, options: options)
    }

    /// Retrieves a tool.
    ///
    /// @Snippet(path: "Tools_GetTool")
    public func getTool(
      request: GetToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      try await self.inner.getTool(request: request, options: options)
    }

    /// Lists tools.
    ///
    /// @Snippet(path: "Tools_ListTools")
    public func listTools(
      request: ListToolsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.ListToolsResponse {
      try await self.inner.listTools(request: request, options: options)
    }

    /// Lists tools.
    ///
    /// @Snippet(path: "Tools_ListTools")
    public func listTools(
      byItem: ListToolsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Tool, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDialogflowV2.ListToolsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listTools(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Deletes a tool.
    ///
    /// @Snippet(path: "Tools_DeleteTool")
    public func deleteTool(
      request: DeleteToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self.inner.deleteTool(request: request, options: options)
    }

    /// Updates a tool.
    ///
    /// @Snippet(path: "Tools_UpdateTool")
    public func updateTool(
      request: UpdateToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      try await self.inner.updateTool(request: request, options: options)
    }

    /// Lists information about the supported locations for this service.
    ///
    /// This method lists locations based on the resource scope provided in
    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
    /// **Global locations**: If `name` is empty, the method lists the
    /// public locations available to all projects. * **Project-specific
    /// locations**: If `name` follows the format
    /// `projects/{project}`, the method lists locations visible to that
    /// specific project. This includes public, private, or other
    /// project-specific locations enabled for the project.
    ///
    /// For gRPC and client library implementations, the resource name is
    /// passed as the `name` field. For direct service calls, the resource
    /// name is
    /// incorporated into the request path based on the specific service
    /// implementation and version.
    ///
    /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
    ///
    /// @Snippet(path: "Tools_ListLocations")
    public func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse {
      try await self.inner.listLocations(request: request, options: options)
    }

    /// Lists information about the supported locations for this service.
    ///
    /// This method lists locations based on the resource scope provided in
    /// the [ListLocationsRequest.name][google.cloud.location.ListLocationsRequest.name] field: *
    /// **Global locations**: If `name` is empty, the method lists the
    /// public locations available to all projects. * **Project-specific
    /// locations**: If `name` follows the format
    /// `projects/{project}`, the method lists locations visible to that
    /// specific project. This includes public, private, or other
    /// project-specific locations enabled for the project.
    ///
    /// For gRPC and client library implementations, the resource name is
    /// passed as the `name` field. For direct service calls, the resource
    /// name is
    /// incorporated into the request path based on the specific service
    /// implementation and version.
    ///
    /// [google.cloud.location.ListLocationsRequest.name]: https://www.google.com/search?q=Swift+google.cloud.location+GoogleCloudLocation.ListLocationsRequest/name
    ///
    /// @Snippet(path: "Tools_ListLocations")
    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
        var request = byItem
        request.pageToken = token
        return try await self.listLocations(request: request, options: options)
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    /// Gets information about a location.
    ///
    /// @Snippet(path: "Tools_GetLocation")
    public func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location {
      try await self.inner.getLocation(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: "Tools_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: "Tools_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: "Tools_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: "Tools_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 `ToolsClient`.
    ///
    /// To mock `ToolsClient` change your functions to receive
    /// `some ToolsProtocol` or `any ToolsProtocol`
    /// and pass a mock implementation in your tests.
    public protocol ToolsProtocol {
      /// See `ToolsClient.createTool`.
      func createTool(request: CreateToolRequest) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.createTool`.
      func createTool(
        parent: Swift.String,
        tool: Tool?,
        toolId: Swift.String,
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.getTool`.
      func getTool(request: GetToolRequest) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.getTool`.
      func getTool(
        name: Swift.String,
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.listTools`.
      func listTools(request: ListToolsRequest) async throws
        -> GoogleCloudDialogflowV2.ListToolsResponse

      /// See `ToolsClient.listTools`.
      func listTools(
        byItem: ListToolsRequest
      ) throws -> any AsyncSequence<Tool, Swift.Error>

      /// See `ToolsClient.listTools`.
      func listTools(
        parent: Swift.String,
      ) throws -> any AsyncSequence<Tool, Swift.Error>

      /// See `ToolsClient.deleteTool`.
      func deleteTool(request: DeleteToolRequest) async throws

      /// See `ToolsClient.deleteTool`.
      func deleteTool(
        name: Swift.String,
      ) async throws

      /// See `ToolsClient.updateTool`.
      func updateTool(request: UpdateToolRequest) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.updateTool`.
      func updateTool(
        tool: Tool?,
        updateMask: GoogleCloudWkt.FieldMask?,
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.listLocations`.
      func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
        -> GoogleCloudLocation.ListLocationsResponse

      /// See `ToolsClient.listLocations`.
      func listLocations(
        byItem: GoogleCloudLocation.ListLocationsRequest
      ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

      /// See `ToolsClient.getLocation`.
      func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
        -> GoogleCloudLocation.Location

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

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

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

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

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

      /// See `ToolsClient.createTool`.
      func createTool(
        request: CreateToolRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.getTool`.
      func getTool(
        request: GetToolRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.listTools`.
      func listTools(
        request: ListToolsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowV2.ListToolsResponse

      /// See `ToolsClient.listTools`.
      func listTools(
        byItem: ListToolsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<Tool, Swift.Error>

      /// See `ToolsClient.deleteTool`.
      func deleteTool(
        request: DeleteToolRequest, options: GoogleCloudGax.RequestOptions
      ) async throws

      /// See `ToolsClient.updateTool`.
      func updateTool(
        request: UpdateToolRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudDialogflowV2.Tool

      /// See `ToolsClient.listLocations`.
      func listLocations(
        request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.ListLocationsResponse

      /// See `ToolsClient.listLocations`.
      func listLocations(
        byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
      ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error>

      /// See `ToolsClient.getLocation`.
      func getLocation(
        request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
      ) async throws -> GoogleCloudLocation.Location

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

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

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

  // Default implementations
  extension Clients.ToolsProtocol {
    public func createTool(request: CreateToolRequest) async throws -> GoogleCloudDialogflowV2.Tool
    {
      try await self.createTool(request: request, options: .init())
    }

    public func createTool(
      request: CreateToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func createTool(
      parent: Swift.String,
      tool: Tool?,
      toolId: Swift.String,
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      let request = CreateToolRequest().with {
        $0.parent = parent
        $0.tool = tool
        $0.toolId = toolId
      }
      return try await self.createTool(request: request)
    }

    public func getTool(request: GetToolRequest) async throws -> GoogleCloudDialogflowV2.Tool {
      try await self.getTool(request: request, options: .init())
    }

    public func getTool(
      request: GetToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func getTool(
      name: Swift.String,
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      let request = GetToolRequest().with {
        $0.name = name
      }
      return try await self.getTool(request: request)
    }

    public func listTools(request: ListToolsRequest) async throws
      -> GoogleCloudDialogflowV2.ListToolsResponse
    {
      try await self.listTools(request: request, options: .init())
    }

    public func listTools(
      request: ListToolsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.ListToolsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listTools(
      byItem: ListToolsRequest
    ) throws -> any AsyncSequence<Tool, Swift.Error> {
      try self.listTools(byItem: byItem, options: .init())
    }

    public func listTools(
      byItem: ListToolsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<Tool, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudDialogflowV2.ListToolsResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

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

    public func deleteTool(request: DeleteToolRequest) async throws {
      try await self.deleteTool(request: request, options: .init())
    }

    public func deleteTool(
      request: DeleteToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      throw GoogleCloudGax.RequestError.unimplemented
    }

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

    public func updateTool(request: UpdateToolRequest) async throws -> GoogleCloudDialogflowV2.Tool
    {
      try await self.updateTool(request: request, options: .init())
    }

    public func updateTool(
      request: UpdateToolRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func updateTool(
      tool: Tool?,
      updateMask: GoogleCloudWkt.FieldMask?,
    ) async throws -> GoogleCloudDialogflowV2.Tool {
      let request = UpdateToolRequest().with {
        $0.tool = tool
        $0.updateMask = updateMask
      }
      return try await self.updateTool(request: request)
    }

    public func listLocations(request: GoogleCloudLocation.ListLocationsRequest) async throws
      -> GoogleCloudLocation.ListLocationsResponse
    {
      try await self.listLocations(request: request, options: .init())
    }

    public func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      try self.listLocations(byItem: byItem, options: .init())
    }

    public func listLocations(
      byItem: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) throws -> any AsyncSequence<GoogleCloudLocation.Location, Swift.Error> {
      let listRpc = {
        (token: Swift.String) async throws -> GoogleCloudLocation.ListLocationsResponse in
        throw GoogleCloudGax.RequestError.unimplemented
      }
      return GoogleCloudGax.PaginatedResponseSequence(listRpc: listRpc)
    }

    public func getLocation(request: GoogleCloudLocation.GetLocationRequest) async throws
      -> GoogleCloudLocation.Location
    {
      try await self.getLocation(request: request, options: .init())
    }

    public func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location {
      throw GoogleCloudGax.RequestError.unimplemented
    }

    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 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)
    }
  }
#endif
