// 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 GoogleCloudLocation
import GoogleCloudWkt
import GoogleIAMV1
import GoogleLongRunning
import GoogleRpc
import GoogleCloudGax
import struct Logging.Logger

extension Clients {
  final class BusinessGlossaryServiceLogging: BusinessGlossaryServiceStub {
    let inner: any BusinessGlossaryServiceStub
    let logger: Logger

    public init(_ inner: any BusinessGlossaryServiceStub, logger: Logger) {
      var logger = logger
      logger[metadataKey: "gcp.artifact.id"] = "google-cloud-dataplex-v1"
      logger[metadataKey: "gcp.client.service"] = "dataplex"
      logger[metadataKey: "gcp.experimental.swift.client"] = "BusinessGlossaryService"
      self.inner = inner
      self.logger = logger
    }

    func _intercept<Input, Output>(
      request: Input,
      options: GoogleCloudGax.RequestOptions,
      name: Swift.String,
      action: (Input, GoogleCloudGax.RequestOptions) async throws -> Output,
    ) async throws -> Output {
      var logger = logger
      logger[metadataKey: "gcp.experimental.swift.request.id"] = "\(UUID())"
      logger[metadataKey: "gcp.experimental.swift.method"] = .string(name)
      logger.debug("enter  : \(request) \(options)")
      do {
        let output = try await action(request, options)
        logger.debug("success: \(request) \(options) \(output)")
        return output
      } catch let error {
        logger.debug("error  : \(request) \(options) \(error)")
        throw error
      }
    }

    public func createGlossary(
      request: CreateGlossaryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createGlossary",
        action: {
          (r: CreateGlossaryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createGlossary(request: r, options: o)
        })
    }

    public func updateGlossary(
      request: UpdateGlossaryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateGlossary",
        action: {
          (r: UpdateGlossaryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.updateGlossary(request: r, options: o)
        })
    }

    public func deleteGlossary(
      request: DeleteGlossaryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteGlossary",
        action: {
          (r: DeleteGlossaryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.deleteGlossary(request: r, options: o)
        })
    }

    public func getGlossary(
      request: GetGlossaryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.Glossary {
      try await self._intercept(
        request: request,
        options: options,
        name: "getGlossary",
        action: {
          (r: GetGlossaryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.Glossary
          in
          return try await self.inner.getGlossary(request: r, options: o)
        })
    }

    public func listGlossaries(
      request: ListGlossariesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.ListGlossariesResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listGlossaries",
        action: {
          (r: ListGlossariesRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.ListGlossariesResponse
          in
          return try await self.inner.listGlossaries(request: r, options: o)
        })
    }

    public func createGlossaryCategory(
      request: CreateGlossaryCategoryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryCategory {
      try await self._intercept(
        request: request,
        options: options,
        name: "createGlossaryCategory",
        action: {
          (r: CreateGlossaryCategoryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryCategory
          in
          return try await self.inner.createGlossaryCategory(request: r, options: o)
        })
    }

    public func updateGlossaryCategory(
      request: UpdateGlossaryCategoryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryCategory {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateGlossaryCategory",
        action: {
          (r: UpdateGlossaryCategoryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryCategory
          in
          return try await self.inner.updateGlossaryCategory(request: r, options: o)
        })
    }

    public func deleteGlossaryCategory(
      request: DeleteGlossaryCategoryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteGlossaryCategory",
        action: {
          (r: DeleteGlossaryCategoryRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void
          in
          return try await self.inner.deleteGlossaryCategory(request: r, options: o)
        })
    }

    public func getGlossaryCategory(
      request: GetGlossaryCategoryRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryCategory {
      try await self._intercept(
        request: request,
        options: options,
        name: "getGlossaryCategory",
        action: {
          (r: GetGlossaryCategoryRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryCategory
          in
          return try await self.inner.getGlossaryCategory(request: r, options: o)
        })
    }

    public func listGlossaryCategories(
      request: ListGlossaryCategoriesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.ListGlossaryCategoriesResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listGlossaryCategories",
        action: {
          (r: ListGlossaryCategoriesRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.ListGlossaryCategoriesResponse
          in
          return try await self.inner.listGlossaryCategories(request: r, options: o)
        })
    }

    public func createGlossaryTerm(
      request: CreateGlossaryTermRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryTerm {
      try await self._intercept(
        request: request,
        options: options,
        name: "createGlossaryTerm",
        action: {
          (r: CreateGlossaryTermRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryTerm
          in
          return try await self.inner.createGlossaryTerm(request: r, options: o)
        })
    }

    public func updateGlossaryTerm(
      request: UpdateGlossaryTermRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryTerm {
      try await self._intercept(
        request: request,
        options: options,
        name: "updateGlossaryTerm",
        action: {
          (r: UpdateGlossaryTermRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryTerm
          in
          return try await self.inner.updateGlossaryTerm(request: r, options: o)
        })
    }

    public func deleteGlossaryTerm(
      request: DeleteGlossaryTermRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteGlossaryTerm",
        action: {
          (r: DeleteGlossaryTermRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void in
          return try await self.inner.deleteGlossaryTerm(request: r, options: o)
        })
    }

    public func getGlossaryTerm(
      request: GetGlossaryTermRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.GlossaryTerm {
      try await self._intercept(
        request: request,
        options: options,
        name: "getGlossaryTerm",
        action: {
          (r: GetGlossaryTermRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.GlossaryTerm
          in
          return try await self.inner.getGlossaryTerm(request: r, options: o)
        })
    }

    public func listGlossaryTerms(
      request: ListGlossaryTermsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudDataplexV1.ListGlossaryTermsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listGlossaryTerms",
        action: {
          (r: ListGlossaryTermsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudDataplexV1.ListGlossaryTermsResponse
          in
          return try await self.inner.listGlossaryTerms(request: r, options: o)
        })
    }

    public func listLocations(
      request: GoogleCloudLocation.ListLocationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.ListLocationsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listLocations",
        action: {
          (r: GoogleCloudLocation.ListLocationsRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> GoogleCloudLocation.ListLocationsResponse
          in
          return try await self.inner.listLocations(request: r, options: o)
        })
    }

    public func getLocation(
      request: GoogleCloudLocation.GetLocationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudLocation.Location {
      try await self._intercept(
        request: request,
        options: options,
        name: "getLocation",
        action: {
          (r: GoogleCloudLocation.GetLocationRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudLocation.Location
          in
          return try await self.inner.getLocation(request: r, options: o)
        })
    }

    public func setIamPolicy(
      request: GoogleIAMV1.SetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy {
      try await self._intercept(
        request: request,
        options: options,
        name: "setIamPolicy",
        action: {
          (r: GoogleIAMV1.SetIamPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.Policy
          in
          return try await self.inner.setIamPolicy(request: r, options: o)
        })
    }

    public func getIamPolicy(
      request: GoogleIAMV1.GetIamPolicyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.Policy {
      try await self._intercept(
        request: request,
        options: options,
        name: "getIamPolicy",
        action: {
          (r: GoogleIAMV1.GetIamPolicyRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.Policy
          in
          return try await self.inner.getIamPolicy(request: r, options: o)
        })
    }

    public func testIamPermissions(
      request: GoogleIAMV1.TestIamPermissionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleIAMV1.TestIamPermissionsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "testIamPermissions",
        action: {
          (r: GoogleIAMV1.TestIamPermissionsRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleIAMV1.TestIamPermissionsResponse
          in
          return try await self.inner.testIamPermissions(request: r, options: o)
        })
    }

    public func listOperations(
      request: GoogleLongRunning.ListOperationsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.ListOperationsResponse {
      try await self._intercept(
        request: request,
        options: options,
        name: "listOperations",
        action: {
          (r: GoogleLongRunning.ListOperationsRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> GoogleLongRunning.ListOperationsResponse
          in
          return try await self.inner.listOperations(request: r, options: o)
        })
    }

    public func getOperation(
      request: GoogleLongRunning.GetOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "getOperation",
        action: {
          (r: GoogleLongRunning.GetOperationRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.getOperation(request: r, options: o)
        })
    }

    public func deleteOperation(
      request: GoogleLongRunning.DeleteOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteOperation",
        action: {
          (r: GoogleLongRunning.DeleteOperationRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> Void in
          return try await self.inner.deleteOperation(request: r, options: o)
        })
    }

    public func cancelOperation(
      request: GoogleLongRunning.CancelOperationRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "cancelOperation",
        action: {
          (r: GoogleLongRunning.CancelOperationRequest, o: GoogleCloudGax.RequestOptions)
            async throws -> Void in
          return try await self.inner.cancelOperation(request: r, options: o)
        })
    }
  }
}
