"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.v2PublicGtfsRouter = exports.V2PublicGtfsRouter = void 0;
const V2PublicGtfsController_1 = require("../../controllers/v2/V2PublicGtfsController");
const Di_1 = require("../../ioc/Di");
const constants_1 = require("../../../shared/constants");
const AbstractRouter_1 = require("@golemio/core/dist/helpers/routing/AbstractRouter");
const Validation_1 = require("@golemio/core/dist/output-gateway/Validation");
const ioc_1 = require("@golemio/core/dist/output-gateway/ioc");
const express_1 = require("@golemio/core/dist/shared/express");
const express_validator_1 = require("@golemio/core/dist/shared/express-validator");
const CustomScopeValidator_1 = require("./helpers/CustomScopeValidator");
class V2PublicGtfsRouter extends AbstractRouter_1.AbstractRouter {
    constructor() {
        super(constants_1.RouteVersion.v2, "public/gtfs");
        this.router = (0, express_1.Router)();
        this.cacheHeaderMiddleware = Di_1.OgPublicContainer.resolve(ioc_1.ContainerToken.CacheHeaderMiddleware);
        this.compressionByDefaultMiddleware = Di_1.OgPublicContainer.resolve(ioc_1.ContainerToken.CompressionByDefaultMiddleware);
        this.gtfsController = new V2PublicGtfsController_1.V2PublicGtfsController();
        this.initRoutes();
    }
    initRoutes() {
        this.router.get("/trips/:gtfsTripId", [(0, express_validator_1.param)("gtfsTripId").exists(), (0, express_validator_1.query)("scopes").custom(CustomScopeValidator_1.CustomScopeValidator.validate)], Validation_1.checkErrors, 
        // max-age 4 hours, stale-while-revalidate 1 minute
        this.cacheHeaderMiddleware.getMiddleware(4 * 60 * 60, 60), this.compressionByDefaultMiddleware.getMiddleware(), this.gtfsController.getOneTrip);
    }
}
exports.V2PublicGtfsRouter = V2PublicGtfsRouter;
const v2PublicGtfsRouter = new V2PublicGtfsRouter();
exports.v2PublicGtfsRouter = v2PublicGtfsRouter;
//# sourceMappingURL=V2PublicGtfsRouter.js.map