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

extension Clients {
  protocol EnterpriseKnowledgeGraphServiceStub {
    func createEntityReconciliationJob(
      request: CreateEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob

    func getEntityReconciliationJob(
      request: GetEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob

    func listEntityReconciliationJobs(
      request: ListEntityReconciliationJobsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.ListEntityReconciliationJobsResponse

    func cancelEntityReconciliationJob(
      request: CancelEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func deleteEntityReconciliationJob(
      request: DeleteEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws

    func lookup(
      request: LookupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.LookupResponse

    func search(
      request: SearchRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.SearchResponse

    func lookupPublicKg(
      request: LookupPublicKgRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.LookupPublicKgResponse

    func searchPublicKg(
      request: SearchPublicKgRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.SearchPublicKgResponse
  }

  class EnterpriseKnowledgeGraphServiceTransport: EnterpriseKnowledgeGraphServiceStub {
    let inner: GoogleCloudGax.HTTPClient

    public init(_ options: GoogleCloudGax.ClientOptions = .init()) throws {
      self.inner = try GoogleCloudGax.HTTPClient(
        from: options, withDefaultEndpoint: "https://enterpriseknowledgegraph.googleapis.com")
    }

    public func createEntityReconciliationJob(
      request: CreateEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/entityReconciliationJobs"
      }()
      let query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "POST"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      if let body = request.entityReconciliationJob {
        req.setValue("application/json", forHTTPHeaderField: "Content-Type")
        req.httpBody = try JSONEncoder().encode(body)
      }
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob.self, from: data)
    }

    public func getEntityReconciliationJob(
      request: GetEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
        }
        return "/v1/\(pathVariable0)"
      }()
      let query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.EntityReconciliationJob.self, from: data)
    }

    public func listEntityReconciliationJobs(
      request: ListEntityReconciliationJobsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.ListEntityReconciliationJobsResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/entityReconciliationJobs"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.filter, prefix: "filter"))
      query.append(contentsOf: try encoder.encode(request.pageSize, prefix: "pageSize"))
      query.append(contentsOf: try encoder.encode(request.pageToken, prefix: "pageToken"))
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.ListEntityReconciliationJobsResponse.self, from: data)
    }

    public func cancelEntityReconciliationJob(
      request: CancelEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
        }
        return "/v1/\(pathVariable0):cancel"
      }()
      let query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "POST"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      req.setValue("application/json", forHTTPHeaderField: "Content-Type")
      req.httpBody = try JSONEncoder().encode(request)
      _ = try await self.inner.rpc(for: req).get()
    }

    public func deleteEntityReconciliationJob(
      request: DeleteEntityReconciliationJobRequest, options: GoogleCloudGax.RequestOptions
    ) async throws {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.name as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.name' is not set or is empty")
        }
        return "/v1/\(pathVariable0)"
      }()
      let query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "DELETE"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      _ = try await self.inner.rpc(for: req).get()
    }

    public func lookup(
      request: LookupRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.LookupResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/cloudKnowledgeGraphEntities:Lookup"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.ids, prefix: "ids"))
      query.append(contentsOf: try encoder.encode(request.languages, prefix: "languages"))
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.LookupResponse.self, from: data)
    }

    public func search(
      request: SearchRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.SearchResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/cloudKnowledgeGraphEntities:Search"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.query, prefix: "query"))
      query.append(contentsOf: try encoder.encode(request.languages, prefix: "languages"))
      query.append(contentsOf: try encoder.encode(request.types, prefix: "types"))
      query.append(contentsOf: try encoder.encode(request.limit, prefix: "limit"))
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.SearchResponse.self, from: data)
    }

    public func lookupPublicKg(
      request: LookupPublicKgRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.LookupPublicKgResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/publicKnowledgeGraphEntities:Lookup"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.ids, prefix: "ids"))
      query.append(contentsOf: try encoder.encode(request.languages, prefix: "languages"))
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.LookupPublicKgResponse.self, from: data)
    }

    public func searchPublicKg(
      request: SearchPublicKgRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudEnterpriseKnowledgeGraphV1.SearchPublicKgResponse {
      let path = try { () throws -> Swift.String in
        guard let pathVariable0 = request.parent as Swift.String?, !pathVariable0.isEmpty else {
          throw GoogleCloudGax.RequestError.binding("'request.parent' is not set or is empty")
        }
        return "/v1/\(pathVariable0)/publicKnowledgeGraphEntities:Search"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.query, prefix: "query"))
      query.append(contentsOf: try encoder.encode(request.languages, prefix: "languages"))
      query.append(contentsOf: try encoder.encode(request.types, prefix: "types"))
      query.append(contentsOf: try encoder.encode(request.limit, prefix: "limit"))
      var req = try await self.inner.Request(path: path, query: query)
      req.httpMethod = "GET"
      req.setValue(Clients.clientHeader, forHTTPHeaderField: "X-Goog-Api-Client")
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudEnterpriseKnowledgeGraphV1.SearchPublicKgResponse.self, from: data)
    }
  }
}
