const express = require('express');
const router = express.Router();
const projectController = require('../controllers/projectController');
const { authMiddleware } = require('../middleware/auth');

// 应用认证中间件到所有路由
router.use(authMiddleware);

// 获取项目列表
// GET /api/projects
router.get('/', projectController.getProjects);

// 获取项目统计
// GET /api/projects/stats
router.get('/stats', projectController.getProjectStats);

// 获取项目详情
// GET /api/projects/:id
router.get('/:id', projectController.getProjectById);

// 创建项目
// POST /api/projects
router.post('/', projectController.createProject);

// 更新项目
// PUT /api/projects/:id
router.put('/:id', projectController.updateProject);

// 删除项目
// DELETE /api/projects/:id
router.delete('/:id', projectController.deleteProject);

// 批量更新项目状态
// PUT /api/projects/batch/status
router.put('/batch/status', projectController.batchUpdateStatus);

module.exports = router;
