/**
 * Routes employé
 */
import { Router } from 'express';
import * as employeeController from '../controllers/employee.controller.js';
import { authenticateToken, authorizeRoles } from '../middleware/auth.js';
import { validate } from '../middleware/validate.js';
import {
  validateTicketSchema,
  searchTicketSchema,
  getPendingTicketsSchema,
} from '../validations/employee.validation.js';

const router = Router();

// Toutes les routes nécessitent une authentification et le rôle EMPLOYEE ou ADMIN
router.use(authenticateToken);
router.use(authorizeRoles('EMPLOYEE', 'ADMIN'));

router.get('/pending-tickets', validate(getPendingTicketsSchema), employeeController.getPendingTickets);
router.get('/search-ticket', validate(searchTicketSchema), employeeController.searchTicket);
router.post('/validate-ticket', validate(validateTicketSchema), employeeController.validateTicket);
router.get('/stats', employeeController.getEmployeeStats);
router.get('/client-prizes', employeeController.getClientPrizes);
router.get('/history', employeeController.getEmployeeHistory);

export default router;
