import { BudgetViolationRecord, DegradationState, BudgetThreshold } from '../performance-budgets'; /** * Budget status for a specific metric */ export interface BudgetStatus { readonly name: string; readonly status: 'ok' | 'warning' | 'critical' | 'unknown'; readonly currentValue: number | null; readonly threshold: BudgetThreshold | undefined; readonly percentOfBudget: number; readonly formattedValue: string; readonly formattedThreshold: string; } /** * Hook options */ export interface UsePerformanceBudgetOptions { /** Specific budgets to monitor (default: all) */ readonly budgets?: string[]; /** Callback on violation */ readonly onViolation?: (violation: BudgetViolationRecord) => void; /** Callback on degradation change */ readonly onDegradationChange?: (state: DegradationState) => void; /** Enable debug logging */ readonly debug?: boolean; } /** * Hook return value */ export interface UsePerformanceBudgetReturn { /** Check if a specific budget is within limits */ readonly isWithinBudget: (budgetName: string) => boolean; /** Get status for a specific budget */ readonly getBudgetStatus: (budgetName: string) => BudgetStatus | null; /** Get all monitored budget statuses */ readonly budgetStatuses: BudgetStatus[]; /** Current degradation state */ readonly degradationState: DegradationState; /** Whether any budget is violated */ readonly hasViolations: boolean; /** Recent violations */ readonly recentViolations: BudgetViolationRecord[]; /** Overall health score (0-100) */ readonly healthScore: number; /** Check a custom budget value */ readonly checkBudget: (name: string, value: number, threshold?: number) => boolean; /** Record a metric value */ readonly recordMetric: (name: string, value: number) => void; /** Check if degradation strategy is active */ readonly isStrategyActive: (strategy: string) => boolean; /** Force degradation deactivation */ readonly deactivateDegradation: () => void; } /** * Hook for performance budget awareness */ export declare function usePerformanceBudget(options?: UsePerformanceBudgetOptions): UsePerformanceBudgetReturn; /** * Hook to get a single budget status */ export declare function useBudgetStatus(budgetName: string): BudgetStatus | null; /** * Hook to check if in degraded mode */ export declare function useDegradedMode(): { isDegraded: boolean; level: DegradationState['level']; strategies: string[]; }; /** * Hook to conditionally render based on budget */ export declare function useBudgetConditional(budgetName: string, fullValue: T, reducedValue: T): T;