const express = require('express')
const router = express.Router()
const { authMiddleware } = require('../middleware/auth')
const {
  getCompletedSupervisions,
  getCompletedSupervisionById,
  createCompletedSupervision,
  updateCompletedSupervision,
  deleteCompletedSupervision,
  getCompletedSupervisionStats,
  batchUpdateStatus,
  batchDelete
} = require('../controllers/completedSupervisionController')

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

// 获取监管任务已结项列表
router.get('/', getCompletedSupervisions)

// 获取监管任务已结项统计信息
router.get('/stats', getCompletedSupervisionStats)

// 根据ID获取监管任务已结项详情
router.get('/:id', getCompletedSupervisionById)

// 创建监管任务已结项
router.post('/', createCompletedSupervision)

// 更新监管任务已结项
router.put('/:id', updateCompletedSupervision)

// 批量更新结清状态
router.put('/batch/status', batchUpdateStatus)

// 删除监管任务已结项
router.delete('/:id', deleteCompletedSupervision)

// 批量删除监管任务已结项
router.delete('/batch/delete', batchDelete)

module.exports = router
