const express = require('express');
const router = express.Router();
const newsletterController = require('../controllers/newsletterController');
const { protect } = require('../middleware/authMiddleware');

// Public routes
router.post('/subscribe', newsletterController.subscribe);
router.post('/unsubscribe', newsletterController.unsubscribe);

// Admin routes (require authentication)
router.get('/', protect, newsletterController.getAllSubscribers);
router.get('/stats', protect, newsletterController.getStats);
router.delete('/:id', protect, newsletterController.deleteSubscriber);

module.exports = router;
