// routes/discountRoutes.js
const express = require('express');
const router = express.Router();
const discountController = require('../controllers/discountController');
const { authenticate, authorize } = require('../middleware/auth');



// 🔍 Public route: validate a discount code before login
// router.get('/validate/:code', discountController.validateDiscountCode);

// // 🔐 All routes below require authentication
// router.use(authenticate);

// // 🧾 Fetch all discounts
// router.get('/', discountController.getAllDiscounts);

// // 🔍 Get a single discount by ID
// router.get('/:id', discountController.getDiscountById);

// // ➕ Create a new discount (admin or manager only)
// router.post('/', authorize(['admin', 'manager']), discountController.createDiscount);

// // ✏️ Update a discount (admin or manager only)
// router.put('/:id', authorize(['admin', 'manager']), discountController.updateDiscount);

// // 🗑️ Delete or deactivate a discount (admin only)
// router.delete('/:id', authorize(['admin']), discountController.deleteDiscount);

module.exports = router;
