const express = require('express');
const router = express.Router();
const employeeController = require('../controllers/employeeController');
const { requireAuth, requireRole } = require('../middleware/auth');

// All authenticated users can read employee data
router.use(requireAuth);

// Status report is admin-only
router.get('/status/report', requireRole('admin'), employeeController.getStatusReport);
router.get('/search', employeeController.search);
router.get('/', employeeController.getAll);
router.get('/:id', employeeController.getById);
router.post('/', requireRole('admin'), employeeController.create);
router.put('/:id', requireRole('admin'), employeeController.update);
router.delete('/:id', requireRole('admin'), employeeController.remove);

module.exports = router;
