const express = require('express');
const router = express.Router();

/**
 * @swagger
 * components:
 *   schemas:
 *     Ticket:
 *       type: object
 *       properties:
 *         id:
 *           type: integer
 *         numero_ticket:
 *           type: string
 *         table_id:
 *           type: integer
 *         serveur_nom:
 *           type: string
 *         serveur_prenom:
 *           type: string
 *         client_nom:
 *           type: string
 *         montant_ttc:
 *           type: number
 *         statut:
 *           type: string
 *           enum: [brouillon, emis, paye, rembourse, annule]
 */

// Routes pour les tickets (sans référence utilisateur)
router.get('/', ticketController.getAllTickets);
router.get('/stats', ticketController.getTicketStats);
router.get('/search', ticketController.searchTickets);
router.get('/sales-report', ticketController.getSalesReport);
router.get('/:id', ticketController.getTicketById);
router.post('/from-order', ticketController.createTicketFromOrder);
router.post('/manual', ticketController.createManualTicket);
router.post('/:id/duplicate', ticketController.duplicateTicket);
router.put('/:id/status', ticketController.updateTicketStatus);
router.get('/:id/pdf', ticketController.generatePDF);
router.delete('/:id', ticketController.deleteTicket);

module.exports = router;
