const express = require('express');
const router = express.Router();
const {
  getAllTours,
  getTourById,
  getTourBySlug,
  getFeaturedTours,
  createTour,
  updateTour,
  deleteTour,
  getNearestUmrahTours
} = require('../controllers/newTourController');
const { protect, adminOnly } = require('../middleware/authMiddleware');

// Public routes
router.get('/', getAllTours);
router.get('/featured', getFeaturedTours);
router.get('/nearest-umrah', getNearestUmrahTours);
router.get('/:id', getTourById);
router.get('/slug/:slug', getTourBySlug);

// Admin routes
router.post('/', protect, adminOnly, createTour);
router.put('/:id', protect, adminOnly, updateTour);
router.delete('/:id', protect, adminOnly, deleteTour);

module.exports = router;
