// 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
import struct Logging.Logger

extension Clients {
  final class DataAccessControlServiceLogging: DataAccessControlServiceStub {
    let inner: any DataAccessControlServiceStub
    let logger: Logger

    public init(_ inner: any DataAccessControlServiceStub, logger: Logger) {
      var logger = logger
      logger[metadataKey: "gcp.artifact.id"] = "google-cloud-chronicle-v1"
      logger[metadataKey: "gcp.client.service"] = "chronicle"
      logger[metadataKey: "gcp.experimental.swift.client"] = "DataAccessControlService"
      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 createDataAccessLabel(
      request: CreateDataAccessLabelRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudChronicleV1.DataAccessLabel {
      try await self._intercept(
        request: request,
        options: options,
        name: "createDataAccessLabel",
        action: {
          (r: CreateDataAccessLabelRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleCloudChronicleV1.DataAccessLabel
          in
          return try await self.inner.createDataAccessLabel(request: r, options: o)
        })
    }

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

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

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

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

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

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

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

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

    public func deleteDataAccessScope(
      request: DeleteDataAccessScopeRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      try await self._intercept(
        request: request,
        options: options,
        name: "deleteDataAccessScope",
        action: {
          (r: DeleteDataAccessScopeRequest, o: GoogleCloudGax.RequestOptions) async throws -> Void
          in
          return try await self.inner.deleteDataAccessScope(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)
        })
    }
  }
}
