import express from 'express';
import { createReview, getReviewsByListing, deleteReview } from '../controllers/reviewController.js';
import verifyToken from '../middleware/authMiddleware.js';

const router = express.Router();

// Public: Get reviews for a listing
router.get('/:listingId', getReviewsByListing);

// Authenticated: Submit a review
router.post('/', verifyToken, createReview);
router.post('/:listingId', verifyToken, createReview);

// Admin: Delete a review
router.delete('/:id', verifyToken, deleteReview);

export default router;
