"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LabelFunctions = void 0;
const gql_1 = require("../gql");
const BaseFunctions_1 = require("./BaseFunctions");
class LabelFunctions extends BaseFunctions_1.BaseFunctions {
    constructor(client) {
        super(client);
    }
    async listLabels(options) {
        const query = (0, gql_1.graphql)(`
      query ListLabels(
        $where: LabelWhereInput
        $skip: Int
        $take: Int
        $cursor: LabelWhereUniqueInput
        $distinct: [LabelScalarFieldEnum!]
        $orderBy: [LabelOrderByWithRelationInput!]
      ) {
        labels(
          where: $where
          skip: $skip
          take: $take
          orderBy: $orderBy
          cursor: $cursor
          distinct: $distinct
        ) {
          id
          value
          confidence
          predictionId
          createdAt
          name
          trainingPredictionId
          updatedAt
        }
      }
    `);
        return this.request(query, options);
    }
    async getLabel(where) {
        const query = (0, gql_1.graphql)(`
      query GetLabel($where: LabelWhereUniqueInput!) {
        label(where: $where) {
          id
          value
          confidence
          predictionId
        }
      }
    `);
        return this.request(query, { where });
    }
    async createLabel(labelData) {
        const mutation = (0, gql_1.graphql)(`
      mutation CreateLabel($data: LabelCreateInput!) {
        createOneLabel(data: $data) {
          id
          value
          confidence
          predictionId
        }
      }
    `);
        return this.request(mutation, { data: labelData });
    }
    async updateLabel(labelId, labelData) {
        const mutation = (0, gql_1.graphql)(`
      mutation UpdateLabel($where: LabelWhereUniqueInput!, $data: LabelUpdateInput!) {
        updateOneLabel(where: $where, data: $data) {
          id
          value
          confidence
          predictionId
        }
      }
    `);
        const variables = {
            where: { id: labelId },
            data: labelData,
        };
        return this.request(mutation, variables);
    }
    async deleteLabel(labelId) {
        const mutation = (0, gql_1.graphql)(`
      mutation DeleteLabel($where: LabelWhereUniqueInput!) {
        deleteOneLabel(where: $where) {
          id
        }
      }
    `);
        const variables = { where: { id: labelId } };
        return this.request(mutation, variables);
    }
}
exports.LabelFunctions = LabelFunctions;
