import express from 'express';
import {
  getActivePromotions,
  createPromotion,
  updatePromotion,
  deletePromotion
} from '../controllers/promotionController.js';
import verifyToken from '../middleware/authMiddleware.js';

const router = express.Router();

// Public route to get active promotions for landing page visitors
router.get('/', getActivePromotions);
router.get('/active', getActivePromotions);

// Administrative routes
router.post('/', verifyToken, createPromotion);
router.put('/:id', verifyToken, updatePromotion);
router.delete('/:id', verifyToken, deletePromotion);

export default router;
