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

const router = Router();

/**
 * [AI_CHAT_01] 智能客服机器人API
 */
router.post('/message', requireTraceContext, ChatBotController.handleMessage);
router.get('/history', requireTraceContext, ChatBotController.getChatHistory);
router.post('/train', requireTraceContext, requirePermission('admin:all'), ChatBotController.trainIntentModel);
router.post('/init', requireTraceContext, requirePermission('admin:all'), ChatBotController.initChatBot);
router.get('/health', (req, res) => {
  res.json({ status: 'ok', service: 'ChatBotService' });
});

export default router;
