import { Router, type IRouter } from 'express';
import { authenticate } from '../middlewares/auth.middleware.js';
import { tenantMiddleware } from '../middlewares/tenant.middleware.js';
import { checkPlanLimits } from '../middlewares/plan-limits.middleware.js';
import { requireFeature } from '../middlewares/feature-gate.middleware.js';
import { normalLimit } from '../middlewares/rate-limit.middleware.js';
import * as reportesController from '../controllers/reportes.controller.js';

const router: IRouter = Router();

router.use(authenticate);
router.use(normalLimit);
router.use(tenantMiddleware);
router.use(checkPlanLimits);
router.use(requireFeature('reportes'));

router.get('/estado-resultados', reportesController.getEstadoResultados);
router.get('/flujo-efectivo', reportesController.getFlujoEfectivo);
router.get('/comparativo', reportesController.getComparativo);
router.get('/concentrado-rfc', reportesController.getConcentradoRfc);
router.get('/cuentas-x-pagar', reportesController.getCuentasXPagar);
router.get('/cuentas-x-cobrar', reportesController.getCuentasXCobrar);

export { router as reportesRoutes };
