"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatasetFunctions = void 0;
const gql_1 = require("../gql");
const BaseFunctions_1 = require("./BaseFunctions");
class DatasetFunctions extends BaseFunctions_1.BaseFunctions {
    constructor(client) {
        super(client);
    }
    async listDatasets(options) {
        const query = (0, gql_1.graphql)(`
            query ListDatasets ($where: DatasetWhereInput, $skip: Int, $take: Int, $cursor: DatasetWhereUniqueInput, $distinct: [DatasetScalarFieldEnum!]) {
                datasets(where: $where, skip: $skip, take: $take, orderBy: { createdAt: desc }, cursor: $cursor, distinct: $distinct) {
                    id
                    name
                    createdAt
                    updatedAt
                    _count {
                        predictions
                        trainingPredictions
                    }
                }
            }
        `);
        return this.request(query, options);
    }
    async getDataset(datasetId) {
        const query = (0, gql_1.graphql)(`
            query GetDataset($datasetId: Int!) {
                dataset(where: { id: $datasetId }) {
                _count {
                    predictions
                    trainingPredictions
                }
                name
                id
                updatedAt
                createdAt
                }
            }
        `);
        return this.request(query, { datasetId });
    }
    async createDataset(data) {
        const mutation = (0, gql_1.graphql)(`
            mutation CreateDataset($data: DatasetCreateInput!) {
                createOneDataset(data: $data) {
                id
                name
                }
            }
        `);
        return this.request(mutation, { data });
    }
    async getDatasetCSV(datasetId) {
        const query = (0, gql_1.graphql)(`
            query GetDatasetCSV($datasetId: Float!) {
                datasetCSV(datasetId: $datasetId)
            }
        `);
        return this.request(query, { datasetId });
    }
}
exports.DatasetFunctions = DatasetFunctions;
