const express = require('express')
const router = express.Router()
const { authMiddleware } = require('../middleware/auth')
const {
  getInstallationTasks,
  getInstallationTaskById,
  createInstallationTask,
  updateInstallationTask,
  deleteInstallationTask,
  getInstallationTaskStats,
  batchUpdateStatus,
  batchDelete
} = require('../controllers/installationTaskController')

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

// 获取待安装任务列表
router.get('/', getInstallationTasks)

// 获取待安装任务统计信息
router.get('/stats', getInstallationTaskStats)

// 根据ID获取待安装任务详情
router.get('/:id', getInstallationTaskById)

// 创建待安装任务
router.post('/', createInstallationTask)

// 更新待安装任务
router.put('/:id', updateInstallationTask)

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

// 删除待安装任务
router.delete('/:id', deleteInstallationTask)

// 批量删除待安装任务
router.delete('/batch/delete', batchDelete)

module.exports = router
