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

extension Clients {
  final class VideoStitcherServiceLogging: VideoStitcherServiceStub {
    let inner: any VideoStitcherServiceStub
    let logger: Logger

    public init(_ inner: any VideoStitcherServiceStub, logger: Logger) {
      var logger = logger
      logger[metadataKey: "gcp.artifact.id"] = "google-cloud-video-stitcher-v1"
      logger[metadataKey: "gcp.client.service"] = "videostitcher"
      logger[metadataKey: "gcp.experimental.swift.client"] = "VideoStitcherService"
      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 createCdnKey(
      request: CreateCdnKeyRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleLongRunning.Operation {
      try await self._intercept(
        request: request,
        options: options,
        name: "createCdnKey",
        action: {
          (r: CreateCdnKeyRequest, o: GoogleCloudGax.RequestOptions) async throws
            -> GoogleLongRunning.Operation
          in
          return try await self.inner.createCdnKey(request: r, options: o)
        })
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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