"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.jisRouter = exports.JISRouter = void 0;
const CheckContentTypeMiddleware_1 = require("@golemio/core/dist/input-gateway/helpers/CheckContentTypeMiddleware");
const express_1 = require("@golemio/core/dist/shared/express");
const JISEventsController_1 = require("./controllers/JISEventsController");
const JISInfotextsController_1 = require("./controllers/JISInfotextsController");
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
class JISRouter extends AbstractRouter_1.AbstractRouter {
    constructor() {
        super("v1", "jis");
        this.postEvents = async (req, res, next) => {
            try {
                await this.eventsController.processData(req.body);
                res.sendStatus(204);
            }
            catch (err) {
                next(err);
            }
        };
        this.postInfotexts = async (req, res, next) => {
            try {
                await this.infotextsController.processData(req.body);
                res.sendStatus(204);
            }
            catch (err) {
                next(err);
            }
        };
        this.router = (0, express_1.Router)();
        this.eventsController = new JISEventsController_1.JISEventsController();
        this.infotextsController = new JISInfotextsController_1.JISInfotextsController();
        this.initRoutes();
    }
    initRoutes() {
        this.router.post("/events", (0, CheckContentTypeMiddleware_1.checkContentTypeMiddleware)(["application/json"]), this.postEvents);
        this.router.post("/infotexts", (0, CheckContentTypeMiddleware_1.checkContentTypeMiddleware)(["application/json"]), this.postInfotexts);
    }
}
exports.JISRouter = JISRouter;
const jisRouter = new JISRouter();
exports.jisRouter = jisRouter;
//# sourceMappingURL=JISRouter.js.map