import { Router } from 'express';
import { BizStrategyController } from '../controllers/BizStrategyController';
import { requireTraceContext } from '../../core/guards/trace-context.guard';
import { requirePermission } from '../../core/guards/rbac.guard';

const router = Router();

/**
 * [BIZ_AI_16] 交互式策略建议 (Actionable Insights)
 */
router.get('/advice', requireTraceContext, requirePermission('strategy:read'), BizStrategyController.getAdvice);
router.post('/advice/approve', requireTraceContext, requirePermission('strategy:execute'), BizStrategyController.approveAdvice);
router.get('/advice/:adviceId/explanation', requireTraceContext, requirePermission('strategy:read'), BizStrategyController.getAdviceExplanation);

/**
 * [UX_IAT_01] 自治控制中心：停机与模式切换
 */
router.post('/kill-switch', requireTraceContext, requirePermission('strategy:kill'), BizStrategyController.toggleKillSwitch);
router.post('/mode', requireTraceContext, requirePermission('strategy:write'), BizStrategyController.updateAutonomousMode);
router.get('/status', requireTraceContext, BizStrategyController.getAutonomousStatus);

/**
 * [FE_SB_01] 策略仿真沙盒 (Sandbox Dashboard)
 */
router.post('/sandbox/run', requireTraceContext, requirePermission('strategy:write'), BizStrategyController.runSandboxSimulation);
router.get('/sandbox/results', requireTraceContext, requirePermission('strategy:read'), BizStrategyController.getSandboxResults);

/**
 * [BIZ_SC_11] 供应链询盘流 (Semi-Inquiry)
 */
router.post('/inquiry/start', requireTraceContext, BizStrategyController.startInquiry);
router.post('/inquiry/:inquiryId/review', requireTraceContext, BizStrategyController.reviewInquiry);
router.post('/inquiry/:inquiryId/send', requireTraceContext, BizStrategyController.sendInquiry);
router.post('/inquiry/:inquiryId/accept', requireTraceContext, BizStrategyController.acceptAndPurchase);

/**
 * [BIZ_TRADE_02] 多仓库存编排 (Inventory Orchestration)
 */
router.get('/inventory/orchestrate', requireTraceContext, BizStrategyController.orchestrateInventory);
router.post('/inventory/transfer', requireTraceContext, BizStrategyController.approveTransfer);

/**
 * [BIZ_AIS_01] 独立站套利回流 (Pixel Feedback)
 */
router.post('/pixel/event', requireTraceContext, BizStrategyController.collectPixelEvent);

export default router;
