"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenApiController = void 0;
const tslib_1 = require("tslib");
const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
const http_1 = require("../http");
const serializer_1 = require("./serializer");
let _OpenApiControllerMetadata_1;
let OpenApiController = class OpenApiController {
    app;
    constructor(app) {
        this.app = app;
    }
    getOpenApiJson() {
        const schema = (0, serializer_1.serializeOpenApiSchema)(this.app);
        return (0, http_1.rawResponse)(JSON.stringify(schema, undefined, 2), {
            contentType: 'application/json; charset=utf-8'
        });
    }
    getOpenApiYaml() {
        return (0, http_1.rawResponse)((0, serializer_1.serializeOpenApiYaml)(this.app), {
            contentType: 'application/yaml; charset=utf-8'
        });
    }
    static __tsfType = _OpenApiControllerMetadata_1 = _a.decodeCompactMetadataV1("[1,{\"kind\":16,\"name\":\"OpenApiController\",\"typeName\":\"OpenApiController\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"getOpenApiJson\",\"parameters\":[],\"returnType\":{\"kind\":16,\"typeName\":\"RawResponseResult\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"RawResponseResult\"]}}},{\"name\":\"getOpenApiYaml\",\"parameters\":[],\"returnType\":{\"kind\":16,\"typeName\":\"RawResponseResult\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"RawResponseResult\"]}}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"app\",\"type\":{\"kind\":18,\"typeName\":\"OpenApiSerializableApp\",\"types\":[{\"kind\":20,\"name\":\"router\",\"type\":{\"kind\":16,\"typeName\":\"HttpRouter\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpRouter\"]}},\"optional\":false},{\"kind\":20,\"name\":\"config\",\"type\":{\"kind\":16,\"typeName\":\"BaseAppConfig\",\"classType\":{\"$tsfImport\":[1,\"../app/index\",\"BaseAppConfig\"]}},\"optional\":false}]},\"optional\":false,\"default\":false}]}]", [() => OpenApiController, require]);
};
exports.OpenApiController = OpenApiController;
tslib_1.__decorate([
    http_1.http.GET('/openapi.json'),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", []),
    tslib_1.__metadata("design:returntype", Function)
], OpenApiController.prototype, "getOpenApiJson", null);
tslib_1.__decorate([
    http_1.http.GET('/openapi.yaml'),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", []),
    tslib_1.__metadata("design:returntype", Function)
], OpenApiController.prototype, "getOpenApiYaml", null);
exports.OpenApiController = OpenApiController = tslib_1.__decorate([
    http_1.http.controller(),
    tslib_1.__metadata("design:paramtypes", [Object])
], OpenApiController);
_OpenApiControllerMetadata_1.classType = OpenApiController;
OpenApiController.__tsfType = _OpenApiControllerMetadata_1;
//# sourceMappingURL=controller.js.map