const express = require('express');
const router = express.Router();
const commandeController = require('../controllers/commandeController');

// GET /api/commandes - Get all orders
router.get('/', (req, res, next) => commandeController.getAllCommandes(req, res, next));

// GET /api/commandes/stats - Get order statistics
router.get('/stats', (req, res, next) => commandeController.getCommandesStats(req, res, next));

// GET /api/commandes/kitchen - Get kitchen orders
router.get('/kitchen', (req, res, next) => commandeController.getKitchenOrders(req, res, next));

// GET /api/commandes/status/:status - Get orders by status
router.get('/status/:status', (req, res, next) => commandeController.getCommandesByStatut(req, res, next));

// GET /api/commandes/:id - Get order by ID
router.get('/:id', (req, res, next) => commandeController.getCommandeById(req, res, next));

// POST /api/commandes - Create new order
router.post('/', (req, res, next) => commandeController.createCommande(req, res, next));

// PUT /api/commandes/:id/status - Update order status
router.put('/:id/status', (req, res, next) => commandeController.updateStatut(req, res, next));

// DELETE /api/commandes/:id - Delete order
router.delete('/:id', (req, res, next) => commandeController.deleteCommande(req, res, next));

module.exports = router;

