"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InferenceBackendFunctions = void 0;
const gql_1 = require("../gql");
const BaseFunctions_1 = require("./BaseFunctions");
class InferenceBackendFunctions extends BaseFunctions_1.BaseFunctions {
    constructor(client) {
        super(client);
    }
    async listInferenceBackends(options) {
        const query = (0, gql_1.graphql)(`
      query ListInferenceBackends($where: InferenceBackendWhereInput, $skip: Int, $take: Int, $cursor: InferenceBackendWhereUniqueInput, $distinct: [InferenceBackendScalarFieldEnum!]) {
        inferenceBackends(where: $where, skip: $skip, take: $take, orderBy: { createdAt: desc }, cursor: $cursor, distinct: $distinct) {
          id
          name
          active
          urls
          apiKey
        }
      }
    `);
        return this.request(query, options);
    }
    async getInferenceBackend(modelId) {
        const query = (0, gql_1.graphql)(`
      query GetInferenceBackend($where: InferenceBackendWhereUniqueInput!) {
        inferenceBackend(where: $where) {
          id
          name
          active
          urls
          apiKey
        }
      }
    `);
        return this.request(query, { where: { id: modelId } });
    }
    async createInferenceBackend(InferenceBackendData) {
        const mutation = (0, gql_1.graphql)(`
      mutation CreateInferenceBackend($data: InferenceBackendCreateInput!) {
        createOneInferenceBackend(data: $data) {
          id
          name
          active
          urls
          apiKey
        }
      }
    `);
        return this.request(mutation, { data: InferenceBackendData });
    }
    async updateInferenceBackend(modelId, InferenceBackendData) {
        const mutation = (0, gql_1.graphql)(`
      mutation UpdateInferenceBackend(
        $where: InferenceBackendWhereUniqueInput!
        $data: InferenceBackendUpdateInput!
      ) {
        updateOneInferenceBackend(where: $where, data: $data) {
          id
          name
          active
          urls
          apiKey
        }
      }
    `);
        const variables = {
            where: { id: modelId },
            data: InferenceBackendData,
        };
        return this.request(mutation, variables);
    }
    async deleteInferenceBackend(modelId) {
        const mutation = (0, gql_1.graphql)(`
      mutation DeleteInferenceBackend($where: InferenceBackendWhereUniqueInput!) {
        deleteOneInferenceBackend(where: $where) {
          id
        }
      }
    `);
        const variables = { where: { id: modelId } };
        return this.request(mutation, variables);
    }
}
exports.InferenceBackendFunctions = InferenceBackendFunctions;
