import { Router, type IRouter } from 'express';
import * as ctrl from '../controllers/plan-catalogo.controller.js';
import { authenticate } from '../middlewares/auth.middleware.js';

const router: IRouter = Router();

// Public endpoints — no auth needed (pricing page)
router.get('/', ctrl.getPlans);
router.get('/addons', ctrl.getAddons);

// Catálogo despacho — admin only (require auth)
router.get('/despacho', authenticate, ctrl.listDespachoCatalogo);
router.patch('/despacho/:plan', authenticate, ctrl.updateDespachoCatalogo);

router.get('/:codename', ctrl.getPlan);

export default router;
