import UserMiddleware from "../Middleware/UserAuthorization";
import LlmProviderService from "../Services/LlmProviderService";
import Response from "../Utils/Response";
import BaseAPI from "./BaseAPI";
import LIMIT_MAX from "../../Types/Database/LimitMax";
import PositiveNumber from "../../Types/PositiveNumber";
import LlmProvider from "../../Models/DatabaseModels/LlmProvider";
export default class LlmProviderAPI extends BaseAPI {
    constructor() {
        var _a;
        super(LlmProvider, LlmProviderService);
        this.router.post(`${(_a = new this.entityType().getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/global-llms`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
            try {
                const llmProviders = await LlmProviderService.findBy({
                    query: {
                        isGlobalLlm: true,
                    },
                    select: {
                        name: true,
                        description: true,
                    },
                    props: {
                        isRoot: true,
                    },
                    skip: 0,
                    limit: LIMIT_MAX,
                });
                return Response.sendEntityArrayResponse(req, res, llmProviders, new PositiveNumber(llmProviders.length), LlmProvider);
            }
            catch (err) {
                next(err);
            }
        });
    }
}
//# sourceMappingURL=LlmProviderAPI.js.map