import { Router, type Request, type Response, type NextFunction } from 'express';
import * as controller from '../controllers/client-invitations.controller.js';
import { authenticate } from '../middlewares/auth.middleware.js';

const router: Router = Router();

// Público: validar token y registrarse desde invitación
router.get('/validate/:token', controller.validateToken);
router.post('/register/:token', controller.registerFromInvitation);

// Protegido: admin global crea, reenvia y lista invitaciones
router.post('/', authenticate, controller.createInvitation);
router.post('/:id/resend', authenticate, controller.resendInvitation);
router.get('/', authenticate, controller.listInvitations);

export default router;
