"use strict";
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2024-2026 Gracker (Chris)
// This file is part of SmartPerfetto. See LICENSE for details.
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * Skill Routes
 *
 * API endpoints for the skill-based trace analysis system.
 * Skills are configurable analysis workflows defined in YAML files.
 */
const express_1 = __importDefault(require("express"));
const skillController_1 = __importDefault(require("../controllers/skillController"));
const router = express_1.default.Router();
const skillController = new skillController_1.default();
// =============================================================================
// Skill Discovery
// =============================================================================
/**
 * GET /api/skills
 *
 * List all available skills
 *
 * Response: { skills: SkillListItem[], count: number }
 */
router.get('/', skillController.listSkills);
/**
 * GET /api/skills/:skillId
 *
 * Get detailed information about a specific skill
 *
 * Params: skillId - The skill ID (e.g., "startup_analysis")
 * Response: Skill definition with steps, thresholds, and SOP content
 */
router.get('/:skillId', skillController.getSkillDetail);
// =============================================================================
// Skill Execution
// =============================================================================
/**
 * POST /api/skills/execute/:skillId
 *
 * Execute a specific skill against a trace
 *
 * Params: skillId - The skill ID to execute
 * Body: { traceId: string, packageName?: string }
 * Response: SkillAnalysisResponse
 */
router.post('/execute/:skillId', skillController.executeSkill);
/**
 * POST /api/skills/analyze
 *
 * Analyze a trace with automatic skill detection
 *
 * Body: {
 *   traceId: string,
 *   question?: string,   // Natural language question for intent detection
 *   skillId?: string,    // Or specify skill directly
 *   packageName?: string
 * }
 * Response: SkillAnalysisResponse
 */
router.post('/analyze', skillController.analyzeTrace);
// =============================================================================
// Utility Endpoints
// =============================================================================
/**
 * POST /api/skills/detect-intent
 *
 * Detect which skill matches a natural language question
 *
 * Body: { question: string }
 * Response: { matched: boolean, skillId?: string, skillName?: string }
 */
router.post('/detect-intent', skillController.detectIntent);
/**
 * POST /api/skills/detect-vendor
 *
 * Detect the device vendor from trace content
 *
 * Body: { traceId: string }
 * Response: { vendor: string, confidence: string, matchedPatterns: string[] }
 */
router.post('/detect-vendor', skillController.detectVendor);
exports.default = router;
//# sourceMappingURL=skillRoutes.js.map