"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HealthcheckController = void 0;
const tslib_1 = require("tslib");
const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
const decorators_1 = require("../http/decorators");
const package_1 = require("../helpers/io/package");
const healthcheck_service_1 = require("./healthcheck.service");
const __tsf_metadata_type = _a.createCompactMetadataRegistryV1("[1,[{\"kind\":22,\"type\":{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"version\",\"type\":{\"kind\":6},\"optional\":false}]}},{\"kind\":22,\"type\":{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"ok\",\"type\":{\"kind\":10,\"literal\":true},\"optional\":false}]}}]]", []);
let _HealthcheckControllerMetadata_1;
let HealthcheckController = class HealthcheckController {
    healthcheckService;
    constructor(healthcheckService) {
        this.healthcheckService = healthcheckService;
    }
    async index() {
        await this.healthcheckService.check();
        return { version: (0, package_1.getPackageVersion)() ?? 'unknown' };
    }
    async ready() {
        await this.healthcheckService.checkReady();
        return { ok: true };
    }
    async live() {
        await this.healthcheckService.checkLiveness();
        return { ok: true };
    }
    static __tsfType = _HealthcheckControllerMetadata_1 = _a.decodeCompactMetadataV1("[1,{\"kind\":16,\"name\":\"HealthcheckController\",\"typeName\":\"HealthcheckController\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"index\",\"parameters\":[],\"returnType\":{\"$tsfType\":0}},{\"name\":\"ready\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"live\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"healthcheckService\",\"type\":{\"kind\":16,\"typeName\":\"HealthcheckService\",\"classType\":{\"$tsfImport\":[1,\"./healthcheck.service\",\"HealthcheckService\"]}},\"optional\":false,\"default\":false}]}]", [() => HealthcheckController, require], __tsf_metadata_type);
};
exports.HealthcheckController = HealthcheckController;
tslib_1.__decorate([
    decorators_1.http.GET('/healthz'),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", []),
    tslib_1.__metadata("design:returntype", Promise)
], HealthcheckController.prototype, "index", null);
tslib_1.__decorate([
    decorators_1.http.GET('/readyz'),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", []),
    tslib_1.__metadata("design:returntype", Promise)
], HealthcheckController.prototype, "ready", null);
tslib_1.__decorate([
    decorators_1.http.GET('/livez'),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", []),
    tslib_1.__metadata("design:returntype", Promise)
], HealthcheckController.prototype, "live", null);
exports.HealthcheckController = HealthcheckController = tslib_1.__decorate([
    decorators_1.http.controller(),
    tslib_1.__metadata("design:paramtypes", [healthcheck_service_1.HealthcheckService])
], HealthcheckController);
_HealthcheckControllerMetadata_1.classType = HealthcheckController;
HealthcheckController.__tsfType = _HealthcheckControllerMetadata_1;
//# sourceMappingURL=healthcheck.controller.js.map