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 { normalLimit } from '../middlewares/rate-limit.middleware.js';
import * as dashboardController from '../controllers/dashboard.controller.js';

const router: IRouter = Router();

router.use(authenticate);
router.use(normalLimit);
router.use(tenantMiddleware);
router.use(checkPlanLimits);

router.get('/kpis', dashboardController.getKpis);
router.get('/ingresos-egresos', dashboardController.getIngresosEgresos);
router.get('/regimenes-periodo', dashboardController.getRegimenesDelPeriodo);
router.get('/alertas', dashboardController.getAlertas);

export { router as dashboardRoutes };
