import { Router, type IRouter } from 'express';
import rateLimit from 'express-rate-limit';
import { signup, getMyPlan } from '../controllers/despacho.controller.js';
import { authenticate } from '../middlewares/auth.middleware.js';

const router: IRouter = Router();

const signupLimiter = rateLimit({
  windowMs: 60 * 60 * 1000,
  max: 5,
  message: { message: 'Demasiados intentos de registro. Intenta en una hora.' },
});

router.post('/signup', signupLimiter, signup);
router.get('/me/plan', authenticate, getMyPlan);

export default router;
