const express = require('express');
const router = express.Router();
const slaughterhouseController = require('../controllers/SlaughterhouseController');
const authMiddleware = require('../middleware/auth');

// 应用认证中间件
router.use(authMiddleware);

// 屠宰场管理路由
router.get('/slaughterhouses', slaughterhouseController.getSlaughterhouses);
router.get('/slaughterhouses/:id', slaughterhouseController.getSlaughterhouseById);
router.post('/slaughterhouses', slaughterhouseController.createSlaughterhouse);
router.put('/slaughterhouses/:id', slaughterhouseController.updateSlaughterhouse);
router.delete('/slaughterhouses/:id', slaughterhouseController.deleteSlaughterhouse);
router.patch('/slaughterhouses/:id/status', slaughterhouseController.toggleSlaughterhouseStatus);

module.exports = router;