'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var express = require('express');
var controller = require('./controller.js');
var controller$1 = require('../controller.js');
var loadReportDefinition = require('../../../../../middleware/loadReportDefinition.js');
var validateFilters = require('../../../../../validation/validateFilters.js');

function routes({ layoutPath, services }) {
    const router = express.Router({ mergeParams: true });
    const asyncReportController = new controller.ViewAyncReportController(layoutPath, services);
    const viewReportController = new controller$1.AsyncController(layoutPath, services);
    router.get([`/`, `/download-disabled`], asyncReportController.GET);
    // ----------------------------
    // FILTERS
    // ----------------------------
    router.post('/apply-filters', loadReportDefinition.loadReportDefinition(services), validateFilters.validateFilters({ interactive: true }), asyncReportController.applyFilters);
    router.post('/reset-filters', asyncReportController.resetFilters);
    // ---------------------------
    // COLUMNS
    // ----------------------------
    router.post('/apply-columns', asyncReportController.applyColumns);
    router.post('/reset-columns', asyncReportController.resetColumns);
    // ----------------------------
    // User defined defaults
    // ----------------------------
    router.post('/save-defaults', viewReportController.saveDefaultFilterValues);
    router.post('/remove-defaults', viewReportController.removeDefaultFilterValues);
    return router;
}

exports.default = routes;
exports.routes = routes;
//# sourceMappingURL=routes.js.map
