const express = require('express');
const router = express.Router();
const incidentDetailsController = require('../controllers/incidentDetailsController');
const requireAdmin = require('../middleware/adminMiddleware');

// Get all incident details (admin only)
router.get('/', requireAdmin, incidentDetailsController.getAll);

// Get incident details by request ID (specific route before generic :id)
router.get('/request/:requestId', incidentDetailsController.getByRequestId);

// Get incident details by ID (admin only)
router.get('/:id', requireAdmin, incidentDetailsController.getById);

// Create new incident details (admin only)
router.post('/', requireAdmin, incidentDetailsController.create);

// Update incident details (admin only)
router.put('/:id', requireAdmin, incidentDetailsController.update);

// Delete incident details (admin only)
router.delete('/:id', requireAdmin, incidentDetailsController.delete);

module.exports = router;

