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

const router = Router();

/**
 * [BIZ_CRM_10] 智能售后与客户成功 API
 */

// 获取争议列表
router.get('/disputes', requireTraceContext, requirePermission('order:read'), CustomerController.getDisputes);

// 同步争议事件 (平台回调使用)
router.post('/disputes/sync', requireTraceContext, requirePermission('order:write'), CustomerController.syncDispute);

/**
 * [BIZ_CSM_20] 多语言 AGI 智能客服 API
 */

// 触发自动回复
router.post('/support/tickets/:ticketId/auto-reply', requireTraceContext, requirePermission('order:write'), CustomerController.autoReply);

// 获取工单统计
router.get('/support/stats', requireTraceContext, requirePermission('order:read'), CustomerController.getSupportStats);

/**
 * [BIZ_CUS_15] 多模态售后自动化处理 API
 */
router.post('/after-sales/auto-audit', requireTraceContext, requirePermission('order:write'), CustomerController.autoAudit);

export default router;
