"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pulseRouter = void 0;
const express_1 = require("express");
const permissions_1 = require("../../util/config/permissions");
const pulse_1 = require("../controller/pulse");
const pulse_alerts_1 = require("../controller/pulse/pulse-alerts");
const pulse_evaluation_1 = require("../controller/pulse/pulse-evaluation");
const pulse_graph_1 = require("../controller/pulse/pulse-graph");
const pulse_monitoring_1 = require("../controller/pulse/pulse-monitoring");
const pulse_session_1 = require("../controller/pulse/pulse-session");
const permission_1 = require("../middlewares/permission");
const router = (0, express_1.Router)();
// Metrics
router.get('/metrics/dashboard', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getDashboard);
router.get('/metrics/total-requests', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalRequests);
router.get('/metrics/avg-request-duration', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getAverageRequestDuration);
router.get('/metrics/avg-tokens-per-request', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getAverageTokensPerRequest);
router.get('/metrics/avg-cost-per-request', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getAverageCostPerRequest);
// Graphs
router.get('/metrics/graph/request-per-time', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getGraphRequestPerTime);
router.get('/metrics/graph/total-records', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getTotalRecords);
router.get('/metrics/graph/current-health-score', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getCurrentHealthScore);
router.get('/metrics/graph/sessions-evaluated', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getSessionsEvaluated);
router.get('/metrics/graph/traces-evaluated', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getTracesEvaluated);
router.get('/metrics/graph/metric-failure-analysis/total', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getMetricFailureAnalysisTotal);
router.get('/metrics/graph/metric-failure-analysis/success', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getMetricFailureAnalysisSuccess);
router.get('/metrics/graph/metric-failure-analysis/failure', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getMetricFailureAnalysisFailure);
router.get('/metrics/graph/evaluation-coverage', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getEvaluationCoverage);
router.get('/metrics/graph/metric-volume-analysis', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getMetricVolumeAnalysis);
router.get('/metrics/graph/call-outcome-analysis/:metricName', pulse_graph_1.PulseGraphController.getAudioMetricAnalysis);
router.get('/metrics/graph/avg-response-time/:metricName', pulse_graph_1.PulseGraphController.getAudioMetricTimeAnalysis);
// Graph Records Sessions
router.get('/metrics/graph/metric-failure-analysis-sessions/total', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_graph_1.PulseGraphController.getMetricFailureAnalysisTotalSessions);
// Reports
router.get('/reports', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getReports);
router.get('/reports/:traceId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getReportData);
// Graph Records
router.get('/metrics/results/total-records/pass', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalRecordsPass);
router.get('/metrics/results/total-records/fail', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalRecordsFail);
router.get('/metrics/results/total-records/error', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalRecordsError);
router.get('/metrics/results/metric-failure-analysis', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getMetricFailureAnalysis);
// Graph Records Sessions
router.get('/metrics/results/total-sessions/pass', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalSessionsPass);
router.get('/metrics/results/total-sessions/fail', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalSessionsFail);
router.get('/metrics/results/total-sessions/error', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getTotalSessionsError);
router.get('/metrics/results/metric-failure-analysis-sessions', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_1.PulseController.getMetricFailureAnalysisSessions);
// Monitoring
router.get('/monitoring/config', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_monitoring_1.PulseMonitoringController.getMonitoringConfig);
router.post('/monitoring/create', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_monitoring_1.PulseMonitoringController.createMonitoring);
router.post('/monitoring/update', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_monitoring_1.PulseMonitoringController.updateMonitoring);
// Evaluation
router.post('/trace/:traceId/evaluation', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_evaluation_1.PulseEvaluationController.runEvaluation);
router.get('/trace/:traceId/evaluation', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvalResult);
router.get('/getEvaluationAudio/:traceId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationAudio);
// Evaluation Results by Project
router.get('/evaluationResults/:applicationId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getAllEvalResultsForProject);
// Evaluation Results by Project
router.get('/evaluationResults/:applicationId/overview', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityOverviewForProject);
router.get('/evaluationResults/:applicationId/testRuns', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationTestRunsForProject);
router.get('/evaluationResults/:applicationId/securityTestRuns', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityTestRunsForProject);
router.get('/evaluationResults/:applicationId/securityVulnerabilitiesOverTime', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityVulnerabilitiesOverTimeForProject);
router.get('/evaluationResults/:applicationId/securityCategoryWiseVolume', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityCategoryWiseVolumeForProject);
router.get('/evaluationResults/:applicationId/securityTestSuitesTable', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityTestSuitesTableForProject);
router.get('/evaluationResults/:applicationId/securityTestSuiteSidebar', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getEvaluationSecurityTestSuitePluginSidebarForProject);
// Security board charts (specific-purpose APIs)
router.get('/metrics/security-probes', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getSecurityProbes);
router.get('/metrics/vulnerabilities-detected', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getVulnerabilitiesDetected);
router.get('/metrics/vulnerabilities-over-time', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getVulnerabilitiesOverTime);
router.get('/metrics/category-wise-volume-analysis', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getCategoryWiseVolumeAnalysis);
router.get('/metrics/security-evaluations-trend', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getSecurityEvaluationsTrend);
router.get('/metrics/recent-security-evaluations', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getRecentSecurityEvaluations);
router.get('/metrics/security-probes-stats', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getSecurityProbesStats);
router.get('/metrics/probe-results-over-time', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getProbeResultsOverTime);
router.get('/metrics/top-security-control-failures', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_evaluation_1.PulseEvaluationController.getTopSecurityControlFailures);
// Alerts
router.get('/alerts', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_alerts_1.PulseAlertsController.getAlerts);
router.post('/alerts/create', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_alerts_1.PulseAlertsController.createAlert);
router.post('/alerts/update', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_alerts_1.PulseAlertsController.updateAlert);
router.get('/alerts/applications-with-monitoring', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_alerts_1.PulseAlertsController.getApplicationsWithMonitoring);
router.get('/alerts/details/:alertId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_alerts_1.PulseAlertsController.getAlertDetails);
router.get('/alert-logs/:alertId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_alerts_1.PulseAlertsController.getAlertLogs);
router.get('/metrics/ai-reliability', 
// hasPermission(Permission.PROJECT_READ),
pulse_graph_1.PulseGraphController.getAiReliability);
// Sessions
router.get('/sessions', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_session_1.PulseSessionController.getSessions);
router.get('/sessions/:sessionId', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_session_1.PulseSessionController.getSessionById);
router.post('/sessions/:sessionId/evaluation', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_WRITE), pulse_session_1.PulseSessionController.evaluateSession);
router.get('/sessions/:sessionId/evaluation', (0, permission_1.hasPermission)(permissions_1.Permission.PROJECT_READ), pulse_session_1.PulseSessionController.getSessionEvalResult);
router.get('/usage/spans', (0, permission_1.hasPermission)(permissions_1.Permission.BILLING_READ), pulse_1.PulseController.getSpansUsage);
router.get('/cron/usage/spans', pulse_1.PulseController.getSpansUsage);
exports.pulseRouter = router;
//# sourceMappingURL=pulse.js.map