/**
 * [BE-ROUTE-014] 定价决策路由
 * 提供定价决策AI介入的RESTful API路由
 * AI注意: 所有定价决策路由必须通过此文件注册
 */

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

const router = Router();

router.post('/validate', requireTraceContext, PricingDecisionController.validate);
router.post('/ai-decision', requireTraceContext, PricingDecisionController.makeDecision);
router.post('/decisions', requireTraceContext, requirePermission('pricing:write'), PricingDecisionController.createDecision);
router.get('/decisions', requireTraceContext, PricingDecisionController.getDecisions);
router.get('/decisions/stats', requireTraceContext, PricingDecisionController.getStats);
router.get('/decisions/:id', requireTraceContext, PricingDecisionController.getDecisionById);
router.post('/decisions/:id/execute', requireTraceContext, requirePermission('pricing:write'), PricingDecisionController.executeDecision);
router.post('/decisions/:id/approve', requireTraceContext, requirePermission('pricing:write'), PricingDecisionController.approveDecision);
router.post('/decisions/:id/reject', requireTraceContext, requirePermission('pricing:write'), PricingDecisionController.rejectDecision);

export default router;
