import { Router } from 'express';
import { ViewSyncReportController } from './controller.js';
import { loadReportDefinition } from '../../../../../middleware/loadReportDefinition.js';
import { validateFilters } from '../../../../../validation/validateFilters.js';
import { LoadType } from '../../../../../types/UserReports.js';

/* eslint-disable no-param-reassign */
function routes({ layoutPath, services }) {
    const router = Router({ mergeParams: true });
    const controller = new ViewSyncReportController(layoutPath, services);
    router.get([`/`, `/download-disabled`], controller.GET);
    // ----------------------------
    // FILTERS
    // ----------------------------
    router.post('/apply-filters', loadReportDefinition(services), validateFilters({ interactive: true, loadType: LoadType.SYNC }), controller.applyFilters);
    router.post('/reset-filters', controller.resetFilters);
    // ---------------------------
    // COLUMNS
    // ----------------------------
    router.post('/apply-columns', controller.applyColumns);
    router.post('/reset-columns', controller.resetColumns);
    // ----------------------------
    // User defined defaults
    // ----------------------------
    router.post('/save-defaults', controller.saveDefaultFilterValues);
    router.post('/remove-defaults', controller.removeDefaultFilterValues);
    return router;
}

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