"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtegeEngineSDK = void 0;
const graphql_request_1 = require("graphql-request");
const FeedbackFunctions_1 = require("./FeedbackFunctions");
const LabelFunctions_1 = require("./LabelFunctions");
const InferenceBackendFunctions_1 = require("./InferenceBackendFunctions");
const PredictionFunctions_1 = require("./PredictionFunctions");
const UserFunctions_1 = require("./UserFunctions");
const DatasetFunctions_1 = require("./DatasetFunctions");
class ProtegeEngineSDK {
    client;
    user;
    inferenceBackend;
    prediction; // Add the prediction property
    label; // Add the label property
    feedback; // Add the feedback property
    dataset;
    constructor({ endpoint, auth }) {
        if (!auth) {
            throw new Error('No API key provided');
        }
        if (!endpoint) {
            throw new Error('No endpoint provided');
        }
        this.client = new graphql_request_1.GraphQLClient(endpoint, {
            requestMiddleware: async (request) => {
                // console.log(`DEBUG -- request: ${JSON.stringify(request, null, 2)}`)
                const authHeader = await auth.getAuthHeader();
                const newRequest = {
                    ...request,
                    headers: {
                        ...request.headers,
                        Authorization: authHeader,
                    },
                };
                // console.log(`DEBUG -- newRequest: ${JSON.stringify(newRequest, null, 2)}`)
                return newRequest;
            }
        });
        this.user = new UserFunctions_1.UserFunctions(this.client);
        this.inferenceBackend = new InferenceBackendFunctions_1.InferenceBackendFunctions(this.client);
        this.prediction = new PredictionFunctions_1.PredictionFunctions(this.client);
        this.label = new LabelFunctions_1.LabelFunctions(this.client);
        this.feedback = new FeedbackFunctions_1.FeedbackFunctions(this.client);
        this.dataset = new DatasetFunctions_1.DatasetFunctions(this.client);
    }
}
exports.ProtegeEngineSDK = ProtegeEngineSDK;
