import { Router } from 'express';
import { ViewAyncReportController } from './controller.js';
import { AsyncController } from '../controller.js';
import { loadReportDefinition } from '../../../../../middleware/loadReportDefinition.js';
import { validateFilters } from '../../../../../validation/validateFilters.js';

function routes({ layoutPath, services }) {
    const router = Router({ mergeParams: true });
    const asyncReportController = new ViewAyncReportController(layoutPath, services);
    const viewReportController = new AsyncController(layoutPath, services);
    router.get([`/`, `/download-disabled`], asyncReportController.GET);
    // ----------------------------
    // FILTERS
    // ----------------------------
    router.post('/apply-filters', loadReportDefinition(services), 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;
}

export { routes as default, routes };
//# sourceMappingURL=routes.js.map
