/**
 * [BE-ROUTE-012] 批量操作路由
 * 提供批量操作的RESTful API路由
 * AI注意: 所有批量操作路由必须通过此文件注册
 */

import { Router, Request, Response, NextFunction } from 'express';
import { BatchOperationController } from '../controllers/BatchOperationController';
import { AIBatchController } from '../controllers/AIBatchController';
import { requireTraceContext } from '../../core/guards/trace-context.guard';
import { requirePermission } from '../../core/guards/rbac.guard';

const router = Router();

router.post('/validate', requireTraceContext, BatchOperationController.validate);
router.post('/create', requireTraceContext, requirePermission('batch:write'), BatchOperationController.create);
router.get('/history', requireTraceContext, BatchOperationController.getHistory);
router.get('/summary', requireTraceContext, BatchOperationController.getSummary);
router.get('/:id', requireTraceContext, BatchOperationController.getOne);
router.post('/:id/execute', requireTraceContext, requirePermission('batch:write'), BatchOperationController.execute);
router.post('/:id/confirm', requireTraceContext, requirePermission('batch:write'), BatchOperationController.confirm);
router.post('/:id/cancel', requireTraceContext, requirePermission('batch:write'), BatchOperationController.cancel);
router.post('/edit/price', requireTraceContext, requirePermission('batch:write'), BatchOperationController.editPrice);
router.post('/edit/inventory', requireTraceContext, requirePermission('batch:write'), BatchOperationController.editInventory);

export default router;
