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