// 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 GkeInferenceQuickstartStub {
    func fetchModels(
      request: FetchModelsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelsResponse

    func fetchModelServers(
      request: FetchModelServersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelServersResponse

    func fetchModelServerVersions(
      request: FetchModelServerVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelServerVersionsResponse

    func fetchProfiles(
      request: FetchProfilesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchProfilesResponse

    func generateOptimizedManifest(
      request: GenerateOptimizedManifestRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.GenerateOptimizedManifestResponse

    func fetchBenchmarkingData(
      request: FetchBenchmarkingDataRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchBenchmarkingDataResponse
  }

  class GkeInferenceQuickstartTransport: GkeInferenceQuickstartStub {
    let inner: GoogleCloudGax.HTTPClient

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

    public func fetchModels(
      request: FetchModelsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelsResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/models:fetch"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      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(
        GoogleCloudGKERecommenderV1.FetchModelsResponse.self, from: data)
    }

    public func fetchModelServers(
      request: FetchModelServersRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelServersResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/modelServers:fetch"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.model, prefix: "model"))
      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(
        GoogleCloudGKERecommenderV1.FetchModelServersResponse.self, from: data)
    }

    public func fetchModelServerVersions(
      request: FetchModelServerVersionsRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchModelServerVersionsResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/modelServerVersions:fetch"
      }()
      var query = [
        URLQueryItem(name: "$alt", value: "json;enum-encoding=int")
      ]
      let encoder = GoogleCloudGax.QueryParameterEncoder()
      query.append(contentsOf: try encoder.encode(request.model, prefix: "model"))
      query.append(contentsOf: try encoder.encode(request.modelServer, prefix: "modelServer"))
      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(
        GoogleCloudGKERecommenderV1.FetchModelServerVersionsResponse.self, from: data)
    }

    public func fetchProfiles(
      request: FetchProfilesRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchProfilesResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/profiles:fetch"
      }()
      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)
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudGKERecommenderV1.FetchProfilesResponse.self, from: data)
    }

    public func generateOptimizedManifest(
      request: GenerateOptimizedManifestRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.GenerateOptimizedManifestResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/optimizedManifest:generate"
      }()
      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)
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudGKERecommenderV1.GenerateOptimizedManifestResponse.self, from: data)
    }

    public func fetchBenchmarkingData(
      request: FetchBenchmarkingDataRequest, options: GoogleCloudGax.RequestOptions
    ) async throws -> GoogleCloudGKERecommenderV1.FetchBenchmarkingDataResponse {
      let path = try { () throws -> Swift.String in
        return "/v1/benchmarkingData:fetch"
      }()
      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)
      let (data, _) = try await self.inner.rpc(for: req).get()
      return try GoogleCloudWkt._ProtoJSONDecoder().decode(
        GoogleCloudGKERecommenderV1.FetchBenchmarkingDataResponse.self, from: data)
    }
  }
}
