/**
 * Admin Dashboard API Endpoints
 *
 * Provides observability endpoints for the admin dashboard including:
 * - Dashboard summary metrics
 * - Trust analytics and forecasting
 * - Intent analytics and timelines
 * - Proof chain status
 * - System health monitoring
 *
 * All endpoints require admin authentication.
 *
 * @packageDocumentation
 */
import type { FastifyInstance } from 'fastify';
import type { TrustLevel } from '../../common/types.js';
/**
 * Time range for analytics queries
 */
export type TimeRange = '24h' | '7d' | '30d';
/**
 * Intent status counts by time range
 */
export interface IntentCountsByRange {
    '24h': number;
    '7d': number;
    '30d': number;
}
/**
 * Dashboard summary response
 */
export interface DashboardSummaryResponse {
    totalIntents: IntentCountsByRange;
    approvalRate: {
        '24h': number;
        '7d': number;
        '30d': number;
    };
    averageTrustScore: number;
    activeEntitiesCount: number;
    escalationCount: {
        pending: number;
        total24h: number;
    };
    topDenialReasons: Array<{
        reason: string;
        count: number;
        percentage: number;
    }>;
    timestamp: string;
}
/**
 * Trust tier distribution
 */
export interface TrustTierDistribution {
    tier: TrustLevel;
    tierName: string;
    count: number;
    percentage: number;
    scoreRange: {
        min: number;
        max: number;
    };
}
/**
 * Trust distribution response
 */
export interface TrustDistributionResponse {
    distribution: TrustTierDistribution[];
    totalEntities: number;
    averageScore: number;
    scoreTrend: Array<{
        date: string;
        averageScore: number;
        entityCount: number;
    }>;
    timestamp: string;
}
/**
 * Entity approaching decay threshold
 */
export interface DecayForecastEntity {
    entityId: string;
    currentScore: number;
    currentTier: TrustLevel;
    daysSinceActivity: number;
    predictedScore7d: number;
    predictedTier7d: TrustLevel;
    nextMilestone: {
        days: number;
        multiplier: number;
    } | null;
    riskLevel: 'low' | 'medium' | 'high';
}
/**
 * Trust decay forecast response
 */
export interface TrustDecayForecastResponse {
    entitiesAtRisk: DecayForecastEntity[];
    totalAtRisk: number;
    summary: {
        highRisk: number;
        mediumRisk: number;
        lowRisk: number;
    };
    timestamp: string;
}
/**
 * Intent timeline data point
 */
export interface IntentTimelinePoint {
    timestamp: string;
    approved: number;
    denied: number;
    escalated: number;
    pending: number;
    total: number;
}
/**
 * Intent timeline response
 */
export interface IntentTimelineResponse {
    timeline: IntentTimelinePoint[];
    granularity: 'hour' | 'day';
    timeRange: TimeRange;
    totals: {
        approved: number;
        denied: number;
        escalated: number;
        pending: number;
    };
    timestamp: string;
}
/**
 * Top entity by activity or denial rate
 */
export interface TopEntity {
    entityId: string;
    totalIntents: number;
    approvedCount: number;
    deniedCount: number;
    escalatedCount: number;
    approvalRate: number;
    denialRate: number;
}
/**
 * Top entities response
 */
export interface TopEntitiesResponse {
    mostActive: TopEntity[];
    highestDenialRate: TopEntity[];
    timestamp: string;
}
/**
 * Proof chain status response
 */
export interface ProofChainStatusResponse {
    totalProofs: number;
    chainLength: number;
    chainIntegrity: {
        status: 'valid' | 'invalid' | 'unknown';
        lastVerifiedAt: string | null;
        lastVerifiedPosition: number | null;
        issuesFound: number;
    };
    lastProofAt: string | null;
    merkleAggregation: {
        enabled: boolean;
        lastAggregationAt: string | null;
        pendingProofs: number;
    };
    timestamp: string;
}
/**
 * Service health status
 */
export interface ServiceHealth {
    name: string;
    status: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
    latencyMs?: number;
    message?: string;
    details?: Record<string, unknown>;
}
/**
 * Circuit breaker state
 */
export interface CircuitBreakerStatus {
    name: string;
    state: 'closed' | 'open' | 'half-open';
    failures: number;
    lastFailure: string | null;
    nextRetry: string | null;
}
/**
 * Queue depth information
 */
export interface QueueDepth {
    name: string;
    waiting: number;
    active: number;
    completed: number;
    failed: number;
    delayed: number;
}
/**
 * System health response
 */
export interface SystemHealthResponse {
    overall: 'healthy' | 'degraded' | 'unhealthy';
    services: ServiceHealth[];
    circuitBreakers: CircuitBreakerStatus[];
    queues: QueueDepth[];
    resources: {
        memoryUsageMb: number;
        heapUsedMb: number;
        uptimeSeconds: number;
    };
    timestamp: string;
}
/**
 * Register admin dashboard routes
 */
export declare function registerDashboardRoutesV1(fastify: FastifyInstance): Promise<void>;
//# sourceMappingURL=dashboard.d.ts.map