/**
 * REST API Router for MCP Tools
 *
 * Provides HTTP REST endpoints for all registered MCP tools.
 * Handles routing, validation, execution, and response formatting.
 */
import { IncomingMessage, ServerResponse } from 'node:http';
import { RestToolRegistry, ToolInfo } from './rest-registry';
import { RestRouteRegistry } from './rest-route-registry';
import { Logger } from '../core/error-handling';
import { DotAI } from '../core/index';
import { PluginManager } from '../core/plugin-manager';
/**
 * HTTP status codes for REST responses
 */
export declare enum HttpStatus {
    OK = 200,
    BAD_REQUEST = 400,
    NOT_FOUND = 404,
    METHOD_NOT_ALLOWED = 405,
    INTERNAL_SERVER_ERROR = 500,
    BAD_GATEWAY = 502,
    SERVICE_UNAVAILABLE = 503
}
/**
 * Standard REST API response format
 */
export interface RestApiResponse {
    success: boolean;
    data?: unknown;
    error?: {
        code: string;
        message: string;
        details?: unknown;
    };
    meta?: {
        timestamp: string;
        requestId?: string;
        version: string;
    };
}
/**
 * Tool execution response format
 */
export interface ToolExecutionResponse extends RestApiResponse {
    data?: {
        result: unknown;
        tool: string;
        executionTime?: number;
    };
}
/**
 * Tool discovery response format
 */
export interface ToolDiscoveryResponse extends RestApiResponse {
    data?: {
        tools: ToolInfo[];
        total: number;
        categories?: string[];
        tags?: string[];
    };
}
/**
 * Visualization types supported by the API
 * PRD #320: Added 'diff' type for before/after comparisons
 * PRD #328: Added 'bar-chart' type for metrics visualization
 */
export type VisualizationType = 'mermaid' | 'cards' | 'code' | 'table' | 'diff' | 'bar-chart';
/**
 * Diff visualization content (PRD #320)
 */
export interface DiffVisualizationContent {
    before: {
        language: string;
        code: string;
    };
    after: {
        language: string;
        code: string;
    };
}
/**
 * Bar chart data item (PRD #328)
 */
export interface BarChartDataItem {
    label: string;
    value: number;
    max?: number;
    status?: 'error' | 'warning' | 'ok';
}
/**
 * Bar chart visualization content (PRD #328)
 */
export interface BarChartVisualizationContent {
    data: BarChartDataItem[];
    unit?: string;
    orientation?: 'horizontal' | 'vertical';
}
/**
 * Individual visualization item
 */
export interface Visualization {
    id: string;
    label: string;
    type: VisualizationType;
    content: string | {
        language: string;
        code: string;
    } | {
        headers: string[];
        rows: string[][];
    } | Array<{
        id: string;
        title: string;
        description?: string;
        tags?: string[];
    }> | DiffVisualizationContent | BarChartVisualizationContent;
}
/**
 * Visualization endpoint response format
 * PRD #320: Added toolsUsed for test validation of mermaid validation
 */
export interface VisualizationResponse {
    title: string;
    visualizations: Visualization[];
    insights: string[];
    toolsUsed?: string[];
}
/**
 * REST API router configuration
 */
export interface RestApiConfig {
    basePath: string;
    version: string;
    enableCors: boolean;
    requestTimeout: number;
}
/**
 * REST API Router for MCP tools
 */
export declare class RestApiRouter {
    private registry;
    private routeRegistry;
    private logger;
    private dotAI;
    private config;
    private openApiGenerator;
    private requestCounter;
    private pluginManager?;
    constructor(registry: RestToolRegistry, dotAI: DotAI, logger: Logger, pluginManager?: PluginManager, config?: Partial<RestApiConfig>);
    /**
     * Handle incoming HTTP requests for REST API
     *
     * PRD #354: Uses route registry for matching, dispatches to handlers based on route path.
     */
    handleRequest(req: IncomingMessage, res: ServerResponse, body?: unknown): Promise<void>;
    /**
     * Dispatch request to appropriate handler based on matched route
     * PRD #354: Central dispatch using handler map for registry-matched routes.
     */
    private dispatchRoute;
    /**
     * Handle tool discovery requests
     */
    private handleToolDiscovery;
    /**
     * Handle tool execution requests
     */
    private handleToolExecution;
    /**
     * Handle OpenAPI specification requests
     */
    private handleOpenApiSpec;
    /**
     * Handle resource sync requests from controller
     */
    private handleResourceSyncRequest;
    /**
     * Handle GET /api/v1/resources/kinds (PRD #328)
     * Returns all unique resource kinds with counts
     * Supports optional namespace query parameter for filtering
     */
    private handleGetResourceKinds;
    /**
     * Handle GET /api/v1/resources/search (PRD #328)
     * Semantic search for resources with optional exact filters
     */
    private handleSearchResources;
    /**
     * Handle GET /api/v1/resources (PRD #328)
     * Returns filtered and paginated list of resources
     * Supports optional live status enrichment from K8s API
     */
    private handleListResources;
    /**
     * Handle GET /api/v1/namespaces (PRD #328)
     * Returns all unique namespaces
     */
    private handleGetNamespaces;
    /**
     * Handle GET /api/v1/resource (PRD #328)
     * Returns a single resource with full metadata, spec, and status
     */
    private handleGetResource;
    /**
     * Handle GET /api/v1/events (PRD #328)
     * Returns Kubernetes events for a specific resource
     */
    private handleGetEvents;
    /**
     * Handle GET /api/v1/logs (PRD #328)
     * Returns container logs for a pod
     */
    private handleGetLogs;
    /**
     * Handle prompts list requests
     */
    private handlePromptsListRequest;
    /**
     * Handle prompt get requests
     */
    private handlePromptsGetRequest;
    /**
     * Handle prompts cache refresh requests (PRD #386)
     */
    private handlePromptsCacheRefresh;
    /**
     * Handle visualization requests (PRD #317)
     * Returns structured visualization data for a query session
     * PRD #320: Supports ?reload=true to regenerate visualization from current session data
     */
    private handleVisualize;
    /**
     * Handle GET /api/v1/sessions (PRD #425)
     * Lists sessions with optional status filtering and pagination.
     * Returns summary-only data (excludes finalAnalysis).
     */
    private handleListSessions;
    /**
     * Handle SSE streaming for remediation session events
     * PRD #425: Real-time event stream filtered to toolName='remediate'
     */
    private handleRemediationSSE;
    /**
     * Handle generic session retrieval requests
     * Returns raw session data for any tool type (remediate, query, recommend, etc.)
     * Session type is determined by the session ID prefix (rem-, qry-, rec-, opr-, etc.)
     */
    private handleSessionRetrieval;
    /**
     * Handle DELETE /api/v1/knowledge/source/:sourceIdentifier (PRD #356)
     * Delete all knowledge base chunks for a source identifier
     * Used by controller for GitKnowledgeSource cleanup
     */
    private handleDeleteKnowledgeSource;
    /**
     * Handle POST /api/v1/knowledge/ask (PRD #356)
     * Ask a question and receive an AI-synthesized answer from the knowledge base.
     * Uses an agentic approach with toolLoop to allow multiple searches if needed.
     */
    private handleKnowledgeAsk;
    /**
     * Handle embedding migration request (PRD #384)
     */
    private handleEmbeddingMigrationRequest;
    /**
     * Handle POST /api/v1/users — create a new Dex static user
     */
    private handleCreateUser;
    /**
     * Handle GET /api/v1/users — list all Dex static users
     */
    private handleListUsers;
    /**
     * Handle DELETE /api/v1/users/:email — delete a Dex static user
     */
    private handleDeleteUser;
    /**
     * Set CORS headers
     */
    private setCorsHeaders;
    /**
     * Send JSON response
     */
    private sendJsonResponse;
    /**
     * Send error response
     */
    private sendErrorResponse;
    /**
     * Generate unique request ID
     */
    private generateRequestId;
    /**
     * Check if the given path matches the REST API pattern
     */
    isApiRequest(pathname: string): boolean;
    /**
     * Get API configuration
     */
    getConfig(): RestApiConfig;
    /**
     * Get the route registry for OpenAPI generation and fixture validation
     * PRD #354: Exposes route registry for downstream consumers
     */
    getRouteRegistry(): RestRouteRegistry;
}
//# sourceMappingURL=rest-api.d.ts.map