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

// Public routes
router.get('/categories', umreController.getAllCategories);
router.get('/sub-categories', umreController.getAllSubCategories);
router.get('/tours', umreController.getAllUmreTours);
router.get('/tours/featured', umreController.getFeaturedUmreTours);
router.get('/tours/upcoming', umreController.getUpcomingUmreTours);
router.get('/tours/:id', umreController.getUmreTourById);
router.get('/tours/slug/:slug', umreController.getUmreTourBySlug);

// Admin routes - Categories
router.post('/categories', protect, adminOnly, umreController.createCategory);
router.put('/categories/:id', protect, adminOnly, umreController.updateCategory);
router.delete('/categories/:id', protect, adminOnly, umreController.deleteCategory);

// Admin routes - Sub-categories
router.post('/sub-categories', protect, adminOnly, umreController.createSubCategory);
router.put('/sub-categories/:id', protect, adminOnly, umreController.updateSubCategory);
router.delete('/sub-categories/:id', protect, adminOnly, umreController.deleteSubCategory);

// Admin routes - Tours
router.post('/tours', protect, adminOnly, umreController.createUmreTour);
router.put('/tours/:id', protect, adminOnly, umreController.updateUmreTour);
router.delete('/tours/:id', protect, adminOnly, umreController.deleteUmreTour);

module.exports = router;
