import { Router, type IRouter } from 'express';
import { authenticate } from '../middlewares/auth.middleware.js';
import { tenantMiddleware } from '../middlewares/tenant.middleware.js';
import * as ctrl from '../controllers/tareas.controller.js';

const router: IRouter = Router();

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

router.get('/', ctrl.listTareas);
router.post('/', ctrl.createTarea);
router.post('/seed', ctrl.seedDefaults);
router.patch('/:id', ctrl.updateTarea);
router.delete('/:id', ctrl.deleteTarea);

router.post('/periodo/:id/completar', ctrl.completarPeriodo);
router.delete('/periodo/:id/completar', ctrl.descompletarPeriodo);

export { router as tareasRoutes };
