/**
 * Graceful Degradation Framework
 * Provides intelligent fallback strategies for analysis failures
 */
import type { DataPilotError, ErrorCategory } from '../utils/error-handler';
export declare enum DegradationLevel {
    NONE = 0,
    MINIMAL = 1,
    MODERATE = 2,
    AGGRESSIVE = 3,
    EMERGENCY = 4
}
export interface DegradationContext {
    availableMemoryMB: number;
    processingTimeMs: number;
    dataQualityScore: number;
    userExperienceLevel: 'beginner' | 'intermediate' | 'expert';
    analysisScope: 'comprehensive' | 'standard' | 'basic';
    errorHistory: DataPilotError[];
}
export interface DegradationStrategy {
    level: DegradationLevel;
    trigger: DegradationTrigger;
    actions: DegradationAction[];
    fallbackAnalyses: string[];
    qualityImpact: number;
    userMessage: string;
}
export interface DegradationTrigger {
    memoryThresholdMB?: number;
    processingTimeThresholdMs?: number;
    errorCountThreshold?: number;
    dataQualityThreshold?: number;
    specificErrors?: ErrorCategory[];
}
export interface DegradationAction {
    type: 'disable_feature' | 'reduce_scope' | 'simplify_algorithm' | 'skip_optional' | 'use_sampling';
    target: string;
    parameters?: Record<string, any>;
    impact: string;
}
export interface PartialAnalysisResult<T> {
    result: Partial<T>;
    degradationLevel: DegradationLevel;
    appliedStrategies: DegradationStrategy[];
    completedSections: string[];
    failedSections: string[];
    partialSections: string[];
    qualityRetained: number;
    userGuidance: string;
    recoveryOptions: RecoveryOption[];
}
export interface RecoveryOption {
    description: string;
    action: 'retry' | 'adjust_settings' | 'reduce_data' | 'contact_support';
    command?: string;
    automated: boolean;
    estimatedTime: string;
    successProbability: number;
}
/**
 * Main Graceful Degradation Engine
 */
export declare class GracefulDegradationEngine {
    private strategies;
    private currentLevel;
    private appliedStrategies;
    constructor();
    /**
     * Evaluate context and determine appropriate degradation level
     */
    assessDegradationNeeds(context: DegradationContext): DegradationLevel;
    /**
     * Apply degradation strategies based on context
     */
    applyDegradation<T>(context: DegradationContext, analysisFunction: () => Promise<T>): Promise<PartialAnalysisResult<T>>;
    /**
     * Execute analysis with progressive degradation
     */
    private executeWithDegradation;
    /**
     * Attempt analysis with progressive fallbacks
     */
    private attemptAnalysisWithFallbacks;
    /**
     * Apply strategies before analysis begins
     */
    private applyPreAnalysisStrategies;
    /**
     * Check if strategy should be applied
     */
    private shouldApplyStrategy;
    /**
     * Apply specific degradation strategy
     */
    private applyStrategy;
    /**
     * Execute degradation action
     */
    private executeAction;
    /**
     * Escalate degradation level for retry
     */
    private escalateDegradation;
    /**
     * Handle complete analysis failure
     */
    private handleCompleteFailure;
    /**
     * Initialize default degradation strategies
     */
    private initializeDefaultStrategies;
    private disableFeature;
    private reduceScope;
    private simplifyAlgorithm;
    private skipOptional;
    private enableSampling;
    private getStrategiesForLevel;
    private getCompletedSections;
    private getPartialSections;
    private calculateQualityRetention;
    private generateUserGuidance;
    private generateRecoveryOptions;
    private generateEmergencyRecoveryOptions;
}
export declare const globalDegradationEngine: GracefulDegradationEngine;
//# sourceMappingURL=graceful-degradation.d.ts.map