/**
 * Routes du jeu
 */
import { Router } from 'express';
import * as gameController from '../controllers/game.controller.js';
import { authenticateToken, authorizeRoles } from '../middleware/auth.js';
import { validate } from '../middleware/validate.js';
import { playGameSchema, getTicketsSchema } from '../validations/game.validation.js';

const router = Router();

// Toutes les routes nécessitent une authentification
router.use(authenticateToken);

// Jouer (seulement pour les clients)
router.post('/play', authorizeRoles('CLIENT'), validate(playGameSchema), gameController.play);

// Récupérer mes tickets
router.get('/my-tickets', validate(getTicketsSchema), gameController.getMyTickets);
router.get('/my-tickets/:id', gameController.getMyTicket);
router.get('/ticket/:code', gameController.getTicketByCode);

export default router;
