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

router.use(requireAuth);

router.get('/', departmentController.getAll);
router.get('/:id', departmentController.getById);
router.post('/', requireRole('admin'), departmentController.create);
router.put('/:id', requireRole('admin'), departmentController.update);
router.delete('/:id', requireRole('admin'), departmentController.remove);

module.exports = router;
