"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = require("express");
const permissions_1 = require("../../util/config/permissions");
const argusController_1 = require("../controller/argus/argusController");
const truPulseToolController_1 = require("../controller/argus/tools/truPulseToolController");
const truEvalToolController_1 = require("../controller/argus/tools/truEvalToolController");
const truScoutToolController_1 = require("../controller/argus/tools/truScoutToolController");
const describeDataModelController_1 = require("../controller/argus/tools/describeDataModelController");
const clickhouseTextToSqlController_1 = require("../controller/argus/tools/clickhouseTextToSqlController");
const permission_1 = require("../middlewares/permission");
const router = (0, express_1.Router)();
// Main query endpoint
router.post('/:domain/ask', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.ask);
// Argus chat history endpoint (domain-agnostic, filterable by context)
router.get('/history', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.getHistory);
// Search chat history
router.get('/search', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.searchHistory);
// Get chat list (previous conversations)
router.get('/chats', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.getChatList);
// Create a new chat group for a context (marks previous inactive)
router.post('/chat-groups/new', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.createNewChatGroup);
// Activate an existing chat group for a context (marks others inactive)
router.post('/chat-groups/activate', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.activateChatGroup);
// Save chat feedback (thumbs up/down)
router.post('/feedback', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), argusController_1.ArgusController.submitFeedback);
// TruPulse domain tool APIs (Traces, Spans, Sessions) - All GET requests
// Discovery / schema
router.get('/tools/describe-data-model', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), describeDataModelController_1.DescribeDataModelController.describe);
router.post('/tools/text-to-sql', 
//hasPermission(Permission.PROJECT_READ),
clickhouseTextToSqlController_1.ClickhouseTextToSqlController.textToSql);
router.get('/tools/list-dimensions', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.listDimensions);
router.get('/tools/get-dimension-values', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getDimensionValues);
// Traces
router.get('/tools/search-traces', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.searchTraces);
router.get('/tools/get-traces-by-ids', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getTracesByIds);
router.get('/tools/get-trace', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getTrace);
router.get('/tools/get-trace-span-tree', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getTraceSpanTree);
router.get('/tools/get-trace-logs', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getTraceLogs);
// Spans
router.get('/tools/search-spans', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.searchSpans);
router.get('/tools/get-spans-by-ids', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSpansByIds);
router.get('/tools/get-span', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSpan);
router.get('/tools/get-span-events', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSpanEvents);
router.get('/tools/get-span-logs', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSpanLogs);
// Sessions
router.get('/tools/search-sessions', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.searchSessions);
router.get('/tools/get-sessions-by-ids', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSessionsByIds);
router.get('/tools/get-session', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSession);
router.get('/tools/get-session-traces', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSessionTraces);
router.get('/tools/get-session-graph', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truPulseToolController_1.TruPulseToolController.getSessionGraph);
// TruEval (Evaluations) tool APIs
router.get('/tools/search-evaluations', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truEvalToolController_1.TruEvalToolController.searchEvaluations);
router.get('/tools/get-evaluation', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truEvalToolController_1.TruEvalToolController.getEvaluation);
router.get('/tools/get-entity-evaluation-rollup', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truEvalToolController_1.TruEvalToolController.getEntityEvaluationRollup);
// TruScout (Security findings) tool APIs
router.get('/tools/search-security-findings', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truScoutToolController_1.TruScoutToolController.searchSecurityFindings);
router.get('/tools/get-security-finding', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truScoutToolController_1.TruScoutToolController.getSecurityFinding);
router.get('/tools/get-entity-security-rollup', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), truScoutToolController_1.TruScoutToolController.getEntitySecurityRollup);
// Future: TruEval and TruScout routes will be added here
exports.default = router;
//# sourceMappingURL=argus.js.map