// Configuration structures for federated privacy algorithms

use super::super::DifferentialPrivacyConfig;
use std::time::Duration;

/// Federated privacy configuration
#[derive(Debug, Clone)]
pub struct FederatedPrivacyConfig {
    /// Base differential privacy config
    pub base_config: DifferentialPrivacyConfig,

    /// Number of participating clients per round
    pub clients_per_round: usize,

    /// Total number of clients in federation
    pub total_clients: usize,

    /// Client sampling strategy
    pub sampling_strategy: ClientSamplingStrategy,

    /// Secure aggregation settings
    pub secure_aggregation: SecureAggregationConfig,

    /// Privacy amplification settings
    pub amplification_config: AmplificationConfig,

    /// Cross-device privacy settings
    pub cross_device_config: CrossDeviceConfig,

    /// Federated composition method
    pub composition_method: FederatedCompositionMethod,

    /// Trust model
    pub trust_model: TrustModel,

    /// Communication privacy
    pub communication_privacy: CommunicationPrivacyConfig,
}

/// Client sampling strategies for federated learning
#[derive(Debug, Clone, Copy)]
pub enum ClientSamplingStrategy {
    /// Uniform random sampling
    UniformRandom,

    /// Stratified sampling based on data distribution
    Stratified,

    /// Importance sampling based on client importance
    ImportanceSampling,

    /// Poisson sampling for theoretical guarantees
    PoissonSampling,

    /// Fair sampling ensuring client diversity
    FairSampling,
}

/// Secure aggregation configuration
#[derive(Debug, Clone)]
pub struct SecureAggregationConfig {
    /// Enable secure aggregation
    pub enabled: bool,

    /// Minimum number of clients for aggregation
    pub min_clients: usize,

    /// Maximum number of dropouts tolerated
    pub max_dropouts: usize,

    /// Masking vector dimension
    pub masking_dimension: usize,

    /// Random seed sharing method
    pub seed_sharing: SeedSharingMethod,

    /// Quantization bits for compressed aggregation
    pub quantization_bits: Option<u8>,

    /// Enable differential privacy on aggregated result
    pub aggregate_dp: bool,
}

/// Privacy amplification configuration
#[derive(Debug, Clone)]
pub struct AmplificationConfig {
    /// Enable privacy amplification analysis
    pub enabled: bool,

    /// Subsampling amplification factor
    pub subsampling_factor: f64,

    /// Shuffling amplification (if applicable)
    pub shuffling_enabled: bool,

    /// Multi-round amplification
    pub multi_round_amplification: bool,

    /// Heterogeneous client amplification
    pub heterogeneous_amplification: bool,
}

/// Cross-device privacy configuration
#[derive(Debug, Clone, Default)]
pub struct CrossDeviceConfig {
    /// User-level privacy guarantees
    pub user_level_privacy: bool,

    /// Device clustering for privacy
    pub device_clustering: bool,

    /// Temporal privacy across rounds
    pub temporal_privacy: bool,

    /// Geographic privacy considerations
    pub geographic_privacy: bool,

    /// Demographic privacy protection
    pub demographic_privacy: bool,
}

/// Federated composition methods
#[derive(Debug, Clone, Copy, Default)]
pub enum FederatedCompositionMethod {
    /// Basic composition
    Basic,

    /// Advanced composition with amplification
    AdvancedComposition,

    /// Moments accountant for federated setting
    #[default]
    FederatedMomentsAccountant,

    /// Renyi differential privacy
    RenyiDP,

    /// Zero-concentrated differential privacy
    ZCDP,
}

/// Trust models for federated learning
#[derive(Debug, Clone, Copy)]
pub enum TrustModel {
    /// Honest-but-curious clients
    HonestButCurious,

    /// Semi-honest with some malicious clients
    SemiHonest,

    /// Byzantine fault tolerance
    Byzantine,

    /// Fully malicious adversary
    Malicious,
}

/// Communication privacy configuration
#[derive(Debug, Clone)]
pub struct CommunicationPrivacyConfig {
    /// Encrypt communications
    pub encryption_enabled: bool,

    /// Use anonymous communication channels
    pub anonymous_channels: bool,

    /// Add communication noise
    pub communication_noise: bool,

    /// Traffic analysis protection
    pub traffic_analysis_protection: bool,

    /// Advanced threat modeling configuration
    pub threat_modeling: AdvancedThreatModelingConfig,

    /// Cross-silo federated learning configuration
    pub cross_silo_config: Option<CrossSiloFederatedConfig>,
}

/// Advanced threat modeling configuration for comprehensive security analysis
#[derive(Debug, Clone, Default)]
pub struct AdvancedThreatModelingConfig {
    /// Enable advanced threat analysis
    pub enabled: bool,

    /// Adversarial capabilities modeling
    pub adversarial_capabilities: AdversarialCapabilities,

    /// Attack surface analysis
    pub attack_surface_analysis: AttackSurfaceConfig,

    /// Threat intelligence integration
    pub threat_intelligence: ThreatIntelligenceConfig,

    /// Risk assessment framework
    pub risk_assessment: RiskAssessmentConfig,

    /// Countermeasure effectiveness evaluation
    pub countermeasure_evaluation: CountermeasureEvaluationConfig,
}

/// Adversarial capabilities in federated learning environments
#[derive(Debug, Clone)]
pub struct AdversarialCapabilities {
    /// Computational resources available to adversary
    pub computational_resources: ComputationalThreatLevel,

    /// Network access and control capabilities
    pub network_capabilities: NetworkThreatCapabilities,

    /// Data access and manipulation capabilities
    pub data_capabilities: DataThreatCapabilities,

    /// Model and algorithm knowledge
    pub algorithmic_knowledge: AlgorithmicKnowledgeLevel,

    /// Collusion potential among malicious clients
    pub collusion_potential: CollusionThreatLevel,

    /// Persistence and adaptability of attacks
    pub attack_persistence: AttackPersistenceLevel,
}

/// Attack surface configuration for comprehensive analysis
#[derive(Debug, Clone, Default)]
pub struct AttackSurfaceConfig {
    /// Client-side attack vectors
    pub client_attack_vectors: ClientAttackVectors,

    /// Server-side attack vectors
    pub server_attack_vectors: ServerAttackVectors,

    /// Communication channel vulnerabilities
    pub communication_vulnerabilities: CommunicationVulnerabilities,

    /// Aggregation phase vulnerabilities
    pub aggregation_vulnerabilities: AggregationVulnerabilities,

    /// Privacy mechanism vulnerabilities
    pub privacy_mechanism_vulnerabilities: PrivacyMechanismVulnerabilities,
}

/// Threat intelligence integration for real-time threat assessment
#[derive(Debug, Clone, Default)]
pub struct ThreatIntelligenceConfig {
    /// Enable threat intelligence feeds
    pub enabled: bool,

    /// Real-time threat monitoring
    pub real_time_monitoring: bool,

    /// Threat signature database
    pub signature_database: ThreatSignatureDatabase,

    /// Anomaly detection for novel threats
    pub anomaly_detection: AnomalyDetectionConfig,

    /// Threat correlation and analysis
    pub threat_correlation: ThreatCorrelationConfig,
}

/// Risk assessment framework for quantitative security analysis
#[derive(Debug, Clone)]
pub struct RiskAssessmentConfig {
    /// Risk assessment methodology
    pub methodology: RiskAssessmentMethodology,

    /// Risk tolerance levels
    pub risk_tolerance: RiskToleranceLevels,

    /// Impact assessment criteria
    pub impact_assessment: ImpactAssessmentCriteria,

    /// Likelihood estimation methods
    pub likelihood_estimation: LikelihoodEstimationMethods,

    /// Risk mitigation strategies
    pub mitigation_strategies: RiskMitigationStrategies,
}

/// Effectiveness metrics for countermeasure evaluation
#[derive(Debug, Clone, Default)]
pub struct EffectivenessMetrics {
    /// Accuracy of threat detection
    pub detection_accuracy: f64,
    /// False positive rate
    pub false_positive_rate: f64,
    /// False negative rate
    pub false_negative_rate: f64,
    /// Response time metrics
    pub response_times: Vec<f64>,
}

/// Cost-benefit analysis configuration
#[derive(Debug, Clone, Default)]
pub struct CostBenefitAnalysisConfig {
    /// Implementation costs
    pub implementation_costs: Vec<f64>,
    /// Operational costs
    pub operational_costs: Vec<f64>,
    /// Benefit metrics
    pub benefits: Vec<f64>,
    /// ROI calculation methods
    pub roi_methods: Vec<String>,
}

/// Dynamic adaptation configuration
#[derive(Debug, Clone, Default)]
pub struct DynamicAdaptationConfig {
    /// Adaptation triggers
    pub triggers: Vec<String>,
    /// Adaptation strategies
    pub strategies: Vec<String>,
    /// Learning rate for adaptation
    pub learning_rate: f64,
    /// Minimum adaptation threshold
    pub min_threshold: f64,
}

/// Countermeasure optimization configuration
#[derive(Debug, Clone, Default)]
pub struct CountermeasureOptimizationConfig {
    /// Optimization algorithms
    pub algorithms: Vec<String>,
    /// Target metrics
    pub target_metrics: Vec<String>,
    /// Constraints
    pub constraints: Vec<String>,
    /// Optimization frequency
    pub frequency: String,
}

/// Countermeasure effectiveness evaluation framework
#[derive(Debug, Clone, Default)]
pub struct CountermeasureEvaluationConfig {
    /// Effectiveness metrics
    pub effectiveness_metrics: EffectivenessMetrics,

    /// Cost-benefit analysis
    pub cost_benefit_analysis: CostBenefitAnalysisConfig,

    /// Dynamic adaptation based on threat landscape
    pub dynamic_adaptation: DynamicAdaptationConfig,

    /// Countermeasure optimization
    pub optimization: CountermeasureOptimizationConfig,
}

/// Data marketplace configuration
#[derive(Debug, Clone)]
pub struct DataMarketplaceConfig {
    /// Enable data marketplace
    pub enabled: bool,
    /// Pricing models
    pub pricing_models: Vec<String>,
    /// Quality metrics
    pub quality_metrics: Vec<String>,
    /// Access controls
    pub access_controls: Vec<String>,
}

/// Regulatory compliance configuration
#[derive(Debug, Clone)]
pub struct RegulatoryComplianceConfig {
    /// Applicable regulations
    pub regulations: Vec<String>,
    /// Compliance checks
    pub compliance_checks: Vec<String>,
    /// Reporting requirements
    pub reporting_requirements: Vec<String>,
    /// Audit trails
    pub audit_trails: bool,
}

/// Audit and accountability configuration
#[derive(Debug, Clone)]
pub struct AuditAccountabilityConfig {
    /// Audit logging
    pub audit_logging: bool,
    /// Accountability mechanisms
    pub accountability_mechanisms: Vec<String>,
    /// Verification methods
    pub verification_methods: Vec<String>,
    /// Compliance tracking
    pub compliance_tracking: bool,
}

/// Trust establishment methods
#[derive(Debug, Clone)]
pub struct TrustEstablishmentMethods {
    /// Certification authorities
    pub certification_authorities: Vec<String>,
    /// Reputation systems
    pub reputation_systems: Vec<String>,
    /// Verification protocols
    pub verification_protocols: Vec<String>,
}

/// Trust verification mechanisms
#[derive(Debug, Clone)]
pub struct TrustVerificationMechanisms {
    /// Verification methods
    pub methods: Vec<String>,
    /// Validation frequency
    pub frequency: String,
    /// Trust thresholds
    pub thresholds: Vec<f64>,
}

/// Organization reputation system
#[derive(Debug, Clone)]
pub struct OrganizationReputationSystem {
    /// Reputation metrics
    pub metrics: Vec<String>,
    /// Scoring algorithms
    pub scoring_algorithms: Vec<String>,
    /// Update frequencies
    pub update_frequencies: Vec<String>,
}

/// Trust lifecycle management
#[derive(Debug, Clone)]
pub struct TrustLifecycleManagement {
    /// Trust establishment phases
    pub establishment_phases: Vec<String>,
    /// Trust maintenance procedures
    pub maintenance_procedures: Vec<String>,
    /// Trust recovery mechanisms
    pub recovery_mechanisms: Vec<String>,
    /// Trust degradation triggers
    pub degradation_triggers: Vec<String>,
}

/// Data governance configuration
#[derive(Debug, Clone)]
pub struct DataGovernanceConfig {
    /// Data classification
    pub classification: Vec<String>,
    /// Access policies
    pub access_policies: Vec<String>,
    /// Quality standards
    pub quality_standards: Vec<String>,
    /// Retention policies
    pub retention_policies: Vec<String>,
}

/// Privacy agreement configuration
#[derive(Debug, Clone)]
pub struct PrivacyAgreementConfig {
    /// Agreement templates
    pub templates: Vec<String>,
    /// Negotiation protocols
    pub negotiation_protocols: Vec<String>,
    /// Enforcement mechanisms
    pub enforcement_mechanisms: Vec<String>,
    /// Compliance monitoring
    pub compliance_monitoring: bool,
}

/// Data classification configuration
#[derive(Debug, Clone)]
pub struct DataClassificationConfig {
    /// Classification schemes
    pub schemes: Vec<String>,
    /// Sensitivity levels
    pub sensitivity_levels: Vec<String>,
    /// Labeling rules
    pub labeling_rules: Vec<String>,
}

/// Data lineage configuration
#[derive(Debug, Clone)]
pub struct DataLineageConfig {
    /// Tracking methods
    pub tracking_methods: Vec<String>,
    /// Provenance recording
    pub provenance_recording: bool,
    /// Audit trails
    pub audit_trails: bool,
}

/// Data quality assurance configuration
#[derive(Debug, Clone)]
pub struct DataQualityAssuranceConfig {
    /// Quality metrics
    pub metrics: Vec<String>,
    /// Validation rules
    pub validation_rules: Vec<String>,
    /// Monitoring frequency
    pub monitoring_frequency: String,
}

/// Data retention policies
#[derive(Debug, Clone)]
pub struct DataRetentionPolicies {
    /// Retention periods
    pub retention_periods: Vec<String>,
    /// Disposal methods
    pub disposal_methods: Vec<String>,
    /// Archive policies
    pub archive_policies: Vec<String>,
}

/// Cross-silo federated learning configuration for enterprise scenarios
#[derive(Debug, Clone)]
pub struct CrossSiloFederatedConfig {
    /// Enable cross-silo federated learning
    pub enabled: bool,

    /// Organization trust levels and relationships
    pub organization_trust: OrganizationTrustConfig,

    /// Data governance and compliance
    pub data_governance: DataGovernanceConfig,

    /// Inter-organizational privacy agreements
    pub privacy_agreements: PrivacyAgreementConfig,

    /// Federated data marketplaces
    pub data_marketplace: DataMarketplaceConfig,

    /// Regulatory compliance framework
    pub regulatory_compliance: RegulatoryComplianceConfig,

    /// Audit and accountability mechanisms
    pub audit_accountability: AuditAccountabilityConfig,
}

/// Organization trust configuration for cross-silo scenarios
#[derive(Debug, Clone)]
pub struct OrganizationTrustConfig {
    /// Trust establishment methods
    pub trust_establishment: TrustEstablishmentMethods,

    /// Trust verification mechanisms
    pub trust_verification: TrustVerificationMechanisms,

    /// Reputation systems for organizations
    pub reputation_system: OrganizationReputationSystem,

    /// Trust degradation and recovery
    pub trust_lifecycle: TrustLifecycleManagement,
}

// Supporting enums and types for the advanced configurations

#[derive(Debug, Clone, Copy)]
pub enum ComputationalThreatLevel {
    Limited,     // Individual attacker with limited resources
    Moderate,    // Small organization or group
    Substantial, // Large organization or nation-state
    Unlimited,   // Theoretical unlimited computational resources
}

#[derive(Debug, Clone, Default)]
pub struct NetworkThreatCapabilities {
    /// Can intercept communications
    pub can_intercept: bool,
    /// Can modify communications
    pub can_modify: bool,
    /// Can inject malicious communications
    pub can_inject: bool,
    /// Can perform traffic analysis
    pub can_analyze_traffic: bool,
    /// Can conduct timing attacks
    pub can_timing_attack: bool,
    /// Can perform network-level denial of service
    pub can_dos: bool,
}

#[derive(Debug, Clone, Default)]
pub struct DataThreatCapabilities {
    /// Can access training data
    pub can_access_training_data: bool,
    /// Can modify training data
    pub can_modify_training_data: bool,
    /// Can inject poisoned data
    pub can_inject_poisoned_data: bool,
    /// Can perform membership inference
    pub can_membership_inference: bool,
    /// Can extract model parameters
    pub can_extract_parameters: bool,
    /// Can perform gradient inversion
    pub can_gradient_inversion: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum AlgorithmicKnowledgeLevel {
    BlackBox, // No knowledge of algorithms
    GrayBox,  // Partial knowledge
    WhiteBox, // Full algorithm knowledge
    Adaptive, // Can adapt based on observations
}

#[derive(Debug, Clone, Copy)]
pub enum CollusionThreatLevel {
    None,        // No collusion
    Limited,     // Small number of colluding clients
    Substantial, // Significant fraction colluding
    Majority,    // Majority collusion attack
}

#[derive(Debug, Clone, Copy)]
pub enum AttackPersistenceLevel {
    OneTime,      // Single attack attempt
    Intermittent, // Sporadic attacks
    Persistent,   // Continuous attack pressure
    Adaptive,     // Evolving attack strategies
}

#[derive(Debug, Clone, Default)]
pub struct ClientAttackVectors {
    /// Model poisoning attacks
    pub model_poisoning: bool,
    /// Data poisoning attacks
    pub data_poisoning: bool,
    /// Gradient manipulation
    pub gradient_manipulation: bool,
    /// Local model extraction
    pub local_model_extraction: bool,
    /// Client impersonation
    pub client_impersonation: bool,
}

#[derive(Debug, Clone, Default)]
pub struct ServerAttackVectors {
    /// Server compromise scenarios
    pub server_compromise: bool,
    /// Malicious aggregation
    pub malicious_aggregation: bool,
    /// Model backdoor injection
    pub backdoor_injection: bool,
    /// Privacy budget manipulation
    pub budget_manipulation: bool,
    /// Client discrimination
    pub client_discrimination: bool,
}

#[derive(Debug, Clone, Default)]
pub struct CommunicationVulnerabilities {
    /// Man-in-the-middle attacks
    pub mitm_attacks: bool,
    /// Eavesdropping vulnerabilities
    pub eavesdropping: bool,
    /// Replay attacks
    pub replay_attacks: bool,
    /// Message injection
    pub message_injection: bool,
    /// Communication timing analysis
    pub timing_analysis: bool,
}

#[derive(Debug, Clone, Default)]
pub struct AggregationVulnerabilities {
    /// Secure aggregation bypass
    pub secure_aggregation_bypass: bool,
    /// Aggregation manipulation
    pub aggregation_manipulation: bool,
    /// Statistical attacks on aggregation
    pub statistical_attacks: bool,
    /// Reconstruction attacks
    pub reconstruction_attacks: bool,
}

#[derive(Debug, Clone, Default)]
pub struct PrivacyMechanismVulnerabilities {
    /// Differential privacy parameter inference
    pub dp_parameter_inference: bool,
    /// Privacy budget exhaustion attacks
    pub budget_exhaustion: bool,
    /// Composition attack vulnerabilities
    pub composition_attacks: bool,
    /// Auxiliary information attacks
    pub auxiliary_info_attacks: bool,
}

#[derive(Debug, Clone, Default)]
pub struct ThreatSignatureDatabase {
    /// Known attack patterns
    pub attack_patterns: Vec<AttackPattern>,
    /// Threat actor profiles
    pub threat_actors: Vec<ThreatActorProfile>,
    /// Vulnerability signatures
    pub vulnerability_signatures: Vec<VulnerabilitySignature>,
}

#[derive(Debug, Clone)]
pub struct AttackPattern {
    /// Pattern identifier
    pub id: String,
    /// Attack description
    pub description: String,
    /// Attack indicators
    pub indicators: Vec<AttackIndicator>,
    /// Severity level
    pub severity: ThreatSeverity,
    /// Mitigation recommendations
    pub mitigations: Vec<String>,
}

#[derive(Debug, Clone)]
pub struct ThreatActorProfile {
    /// Actor identifier
    pub id: String,
    /// Actor capabilities
    pub capabilities: AdversarialCapabilities,
    /// Known attack methods
    pub attack_methods: Vec<String>,
    /// Targeting preferences
    pub targeting_preferences: Vec<String>,
}

#[derive(Debug, Clone)]
pub struct VulnerabilitySignature {
    /// Vulnerability identifier
    pub id: String,
    /// Affected components
    pub affected_components: Vec<String>,
    /// Exploitation indicators
    pub exploitation_indicators: Vec<String>,
    /// Severity score
    pub severity_score: f64,
}

#[derive(Debug, Clone)]
pub struct AttackIndicator {
    /// Indicator type
    pub indicator_type: IndicatorType,
    /// Indicator value or pattern
    pub value: String,
    /// Confidence level
    pub confidence: f64,
}

#[derive(Debug, Clone, Copy)]
pub enum IndicatorType {
    NetworkTraffic,
    GradientPattern,
    ModelBehavior,
    PerformanceAnomaly,
    CommunicationPattern,
}

#[derive(Debug, Clone, Copy)]
pub enum ThreatSeverity {
    Low,
    Medium,
    High,
    Critical,
}

#[derive(Debug, Clone)]
pub struct AnomalyDetectionConfig {
    /// Detection algorithms
    pub algorithms: Vec<AnomalyDetectionAlgorithm>,
    /// Detection thresholds
    pub thresholds: AnomalyThresholds,
    /// Response actions
    pub response_actions: AnomalyResponseActions,
}

#[derive(Debug, Clone, Copy)]
pub enum AnomalyDetectionAlgorithm {
    StatisticalBaseline,
    MachineLearningBased,
    DeepLearningBased,
    EnsembleMethods,
}

#[derive(Debug, Clone)]
pub struct AnomalyThresholds {
    /// Statistical significance threshold
    pub statistical_threshold: f64,
    /// Confidence threshold for ML-based detection
    pub confidence_threshold: f64,
    /// False positive tolerance
    pub false_positive_rate: f64,
}

#[derive(Debug, Clone)]
pub struct AnomalyResponseActions {
    /// Alert generation
    pub alert_generation: bool,
    /// Automatic quarantine
    pub automatic_quarantine: bool,
    /// Enhanced monitoring
    pub enhanced_monitoring: bool,
    /// Incident escalation
    pub incident_escalation: bool,
}

#[derive(Debug, Clone)]
pub struct ThreatCorrelationConfig {
    /// Correlation algorithms
    pub correlation_algorithms: Vec<CorrelationAlgorithm>,
    /// Temporal correlation window
    pub temporal_window: Duration,
    /// Cross-client correlation analysis
    pub cross_client_correlation: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum CorrelationAlgorithm {
    TemporalPatternMatching,
    BehavioralProfiling,
    GraphBasedAnalysis,
    StatisticalCorrelation,
}

#[derive(Debug, Clone, Copy)]
pub enum RiskAssessmentMethodology {
    QualitativeAssessment,
    QuantitativeAssessment,
    SemiQuantitativeAssessment,
    ScenarioBasedAssessment,
}

#[derive(Debug, Clone)]
pub struct RiskToleranceLevels {
    /// Privacy risk tolerance
    pub privacy_risk_tolerance: f64,
    /// Security risk tolerance
    pub security_risk_tolerance: f64,
    /// Utility risk tolerance
    pub utility_risk_tolerance: f64,
    /// Operational risk tolerance
    pub operational_risk_tolerance: f64,
}

#[derive(Debug, Clone)]
pub struct ImpactAssessmentCriteria {
    /// Data confidentiality impact
    pub confidentiality_impact: ImpactLevel,
    /// Model integrity impact
    pub integrity_impact: ImpactLevel,
    /// Service availability impact
    pub availability_impact: ImpactLevel,
    /// Regulatory compliance impact
    pub compliance_impact: ImpactLevel,
}

#[derive(Debug, Clone, Copy)]
pub enum ImpactLevel {
    Low,
    Medium,
    High,
    Critical,
}

#[derive(Debug, Clone)]
pub struct LikelihoodEstimationMethods {
    /// Historical data analysis
    pub historical_analysis: bool,
    /// Expert judgment
    pub expert_judgment: bool,
    /// Threat modeling
    pub threat_modeling: bool,
    /// Simulation-based estimation
    pub simulation_based: bool,
}

#[derive(Debug, Clone, Default)]
pub struct RiskMitigationStrategies {
    /// Risk avoidance strategies
    pub avoidance_strategies: Vec<String>,
    /// Risk mitigation controls
    pub mitigation_controls: Vec<String>,
    /// Risk transfer mechanisms
    pub transfer_mechanisms: Vec<String>,
    /// Risk acceptance criteria
    pub acceptance_criteria: Vec<String>,
}

/// Seed sharing methods for secure aggregation
#[derive(Debug, Clone, Copy)]
pub enum SeedSharingMethod {
    /// Shamir secret sharing
    ShamirSecretSharing,

    /// Threshold encryption
    ThresholdEncryption,

    /// Distributed key generation
    DistributedKeyGeneration,
}

/// Byzantine-robust aggregation algorithms
#[derive(Debug, Clone, Copy)]
pub enum ByzantineRobustMethod {
    /// Trimmed mean aggregation
    TrimmedMean { trim_ratio: f64 },

    /// Coordinate-wise median
    CoordinateWiseMedian,

    /// Krum aggregation
    Krum { f: usize },

    /// Multi-Krum aggregation
    MultiKrum { f: usize, m: usize },

    /// Bulyan aggregation
    Bulyan { f: usize },

    /// Centered clipping
    CenteredClipping { tau: f64 },

    /// FedAvg with outlier detection
    FedAvgOutlierDetection { threshold: f64 },

    /// Robust aggregation with reputation
    ReputationWeighted { reputation_decay: f64 },
}

/// Personalization strategies for federated learning
#[derive(Debug, Clone)]
pub enum PersonalizationStrategy {
    /// No personalization (standard federated learning)
    None,

    /// Fine-tuning on local data
    FineTuning { local_epochs: usize },

    /// Meta-learning based personalization (MAML)
    MetaLearning { inner_lr: f64, outer_lr: f64 },

    /// Clustered federated learning
    ClusteredFL { num_clusters: usize },

    /// Federated multi-task learning
    MultiTask { task_similarity_threshold: f64 },

    /// Personalized layers (some layers personalized, others shared)
    PersonalizedLayers { personal_layer_indices: Vec<usize> },

    /// Model interpolation
    ModelInterpolation { interpolation_weight: f64 },

    /// Adaptive personalization
    Adaptive { adaptation_rate: f64 },
}

/// Communication compression strategies
#[derive(Debug, Clone, Copy)]
pub enum CompressionStrategy {
    /// No compression
    None,

    /// Quantization with specified bits
    Quantization { bits: u8 },

    /// Top-K sparsification
    TopK { k: usize },

    /// Random sparsification
    RandomSparsification { sparsity_ratio: f64 },

    /// Error feedback compression
    ErrorFeedback,

    /// Gradient compression with memory
    GradientMemory { memory_factor: f64 },

    /// Low-rank approximation
    LowRank { rank: usize },

    /// Structured compression
    Structured { structure_type: StructureType },
}

/// Structure types for compression
#[derive(Debug, Clone, Copy)]
pub enum StructureType {
    Circulant,
    Toeplitz,
    Hankel,
    BlockDiagonal,
}

/// Continual learning strategies in federated settings
#[derive(Debug, Clone, Copy)]
pub enum ContinualLearningStrategy {
    /// Elastic Weight Consolidation (EWC)
    EWC { lambda: f64 },

    /// Memory-Aware Synapses (MAS)
    MAS { lambda: f64 },

    /// Progressive Neural Networks
    Progressive,

    /// Learning without Forgetting (LwF)
    LwF { distillation_temperature: f64 },

    /// Gradient Episodic Memory (GEM)
    GEM { memory_size: usize },

    /// Federated Continual Learning with Memory
    FedContinual { memory_budget: usize },

    /// Task-agnostic continual learning
    TaskAgnostic,
}

/// Advanced federated learning configuration
#[derive(Debug, Clone)]
pub struct AdvancedFederatedConfig {
    /// Byzantine robustness settings
    pub byzantine_config: ByzantineRobustConfig,

    /// Personalization settings
    pub personalization_config: PersonalizationConfig,

    /// Adaptive privacy budgeting
    pub adaptive_budget_config: AdaptiveBudgetConfig,

    /// Communication efficiency settings
    pub communication_config: CommunicationConfig,

    /// Continual learning settings
    pub continual_learning_config: ContinualLearningConfig,

    /// Multi-level privacy settings
    pub multi_level_privacy: MultiLevelPrivacyConfig,
}

/// Byzantine robustness configuration
#[derive(Debug, Clone)]
pub struct ByzantineRobustConfig {
    /// Aggregation method
    pub method: ByzantineRobustMethod,

    /// Expected number of Byzantine clients
    pub expected_byzantine_ratio: f64,

    /// Enable dynamic Byzantine detection
    pub dynamic_detection: bool,

    /// Reputation system settings
    pub reputation_system: ReputationSystemConfig,

    /// Statistical tests for outlier detection
    pub statistical_tests: StatisticalTestConfig,
}

/// Personalization configuration
#[derive(Debug, Clone)]
pub struct PersonalizationConfig {
    /// Personalization strategy
    pub strategy: PersonalizationStrategy,

    /// Local adaptation parameters
    pub local_adaptation: LocalAdaptationConfig,

    /// Clustering parameters for clustered FL
    pub clustering: ClusteringConfig,

    /// Meta-learning parameters
    pub meta_learning: MetaLearningConfig,

    /// Privacy-preserving personalization
    pub privacy_preserving: bool,
}

/// Adaptive privacy budget configuration
#[derive(Debug, Clone)]
pub struct AdaptiveBudgetConfig {
    /// Enable adaptive budgeting
    pub enabled: bool,

    /// Budget allocation strategy
    pub allocation_strategy: BudgetAllocationStrategy,

    /// Dynamic privacy parameters
    pub dynamic_privacy: DynamicPrivacyConfig,

    /// Client importance weighting
    pub importance_weighting: bool,

    /// Contextual privacy adjustment
    pub contextual_adjustment: ContextualAdjustmentConfig,
}

/// Communication efficiency configuration
#[derive(Debug, Clone)]
pub struct CommunicationConfig {
    /// Compression strategy
    pub compression: CompressionStrategy,

    /// Lazy aggregation settings
    pub lazy_aggregation: LazyAggregationConfig,

    /// Federated dropout settings
    pub federated_dropout: FederatedDropoutConfig,

    /// Asynchronous update settings
    pub async_updates: AsyncUpdateConfig,

    /// Bandwidth adaptation
    pub bandwidth_adaptation: BandwidthAdaptationConfig,
}

/// Continual learning configuration
#[derive(Debug, Clone)]
pub struct ContinualLearningConfig {
    /// Continual learning strategy
    pub strategy: ContinualLearningStrategy,

    /// Memory management settings
    pub memory_management: MemoryManagementConfig,

    /// Task detection settings
    pub task_detection: TaskDetectionConfig,

    /// Knowledge transfer settings
    pub knowledge_transfer: KnowledgeTransferConfig,

    /// Catastrophic forgetting prevention
    pub forgetting_prevention: ForgettingPreventionConfig,
}

/// Multi-level privacy configuration
#[derive(Debug, Clone)]
pub struct MultiLevelPrivacyConfig {
    /// Local differential privacy
    pub local_dp: LocalDPConfig,

    /// Global differential privacy
    pub global_dp: GlobalDPConfig,

    /// User-level privacy
    pub user_level: UserLevelPrivacyConfig,

    /// Hierarchical privacy
    pub hierarchical: HierarchicalPrivacyConfig,

    /// Context-aware privacy
    pub context_aware: ContextAwarePrivacyConfig,
}

// Supporting configuration structures

/// Reputation system configuration
#[derive(Debug, Clone)]
pub struct ReputationSystemConfig {
    pub enabled: bool,
    pub initial_reputation: f64,
    pub reputation_decay: f64,
    pub min_reputation: f64,
    pub outlier_penalty: f64,
    pub contribution_bonus: f64,
}

/// Statistical test configuration for outlier detection
#[derive(Debug, Clone)]
pub struct StatisticalTestConfig {
    pub enabled: bool,
    pub test_type: StatisticalTestType,
    pub significancelevel: f64,
    pub window_size: usize,
    pub adaptive_threshold: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum StatisticalTestType {
    ZScore,
    ModifiedZScore,
    IQRTest,
    GrubbsTest,
    ChauventCriterion,
}

/// Local adaptation configuration
#[derive(Debug, Clone)]
pub struct LocalAdaptationConfig {
    pub adaptation_rate: f64,
    pub local_epochs: usize,
    pub adaptation_frequency: usize,
    pub adaptation_method: AdaptationMethod,
    pub regularization_strength: f64,
}

#[derive(Debug, Clone, Copy)]
pub enum AdaptationMethod {
    FineTuning,
    FeatureExtraction,
    LayerWiseAdaptation,
    AttentionBasedAdaptation,
}

/// Clustering configuration
#[derive(Debug, Clone)]
pub struct ClusteringConfig {
    pub num_clusters: usize,
    pub clustering_method: ClusteringMethod,
    pub similarity_metric: SimilarityMetric,
    pub cluster_update_frequency: usize,
    pub privacy_preserving_clustering: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum ClusteringMethod {
    KMeans,
    DBSCAN,
    AgglomerativeClustering,
    SpectralClustering,
    PrivacyPreservingKMeans,
}

#[derive(Debug, Clone, Copy)]
pub enum SimilarityMetric {
    CosineSimilarity,
    EuclideanDistance,
    ModelParameters,
    GradientSimilarity,
    LossLandscape,
}

/// Meta-learning configuration
#[derive(Debug, Clone)]
pub struct MetaLearningConfig {
    pub inner_learning_rate: f64,
    pub outer_learning_rate: f64,
    pub inner_steps: usize,
    pub meta_batch_size: usize,
    pub adaptation_method: MetaAdaptationMethod,
}

#[derive(Debug, Clone, Copy)]
pub enum MetaAdaptationMethod {
    MAML,
    Reptile,
    ProtoNets,
    RelationNets,
    FOMAML,
}

/// Budget allocation strategy
#[derive(Debug, Clone, Copy)]
pub enum BudgetAllocationStrategy {
    Uniform,
    ProportionalToData,
    ProportionalToParticipation,
    UtilityBased,
    FairnessAware,
    AdaptiveAllocation,
}

/// Dynamic privacy configuration
#[derive(Debug, Clone)]
pub struct DynamicPrivacyConfig {
    pub enabled: bool,
    pub adaptation_frequency: usize,
    pub privacy_sensitivity: f64,
    pub utility_weight: f64,
    pub fairness_weight: f64,
}

/// Contextual adjustment configuration
#[derive(Debug, Clone)]
pub struct ContextualAdjustmentConfig {
    pub enabled: bool,
    pub context_factors: Vec<ContextFactor>,
    pub adjustment_sensitivity: f64,
    pub temporal_adaptation: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum ContextFactor {
    DataSensitivity,
    ClientTrustLevel,
    NetworkConditions,
    ModelAccuracy,
    ParticipationHistory,
}

/// Lazy aggregation configuration
#[derive(Debug, Clone)]
pub struct LazyAggregationConfig {
    pub enabled: bool,
    pub aggregation_threshold: f64,
    pub staleness_tolerance: usize,
    pub gradient_similarity_threshold: f64,
}

/// Federated dropout configuration
#[derive(Debug, Clone)]
pub struct FederatedDropoutConfig {
    pub enabled: bool,
    pub dropout_probability: f64,
    pub adaptive_dropout: bool,
    pub importance_sampling: bool,
}

/// Asynchronous update configuration
#[derive(Debug, Clone)]
pub struct AsyncUpdateConfig {
    pub enabled: bool,
    pub staleness_threshold: usize,
    pub mixing_coefficient: f64,
    pub buffering_strategy: BufferingStrategy,
}

#[derive(Debug, Clone, Copy)]
pub enum BufferingStrategy {
    FIFO,
    LIFO,
    PriorityBased,
    AdaptiveMixing,
}

/// Bandwidth adaptation configuration
#[derive(Debug, Clone, Default)]
pub struct BandwidthAdaptationConfig {
    pub enabled: bool,
    pub compression_adaptation: bool,
    pub transmission_scheduling: bool,
    pub quality_of_service: QoSConfig,
}

/// Quality of Service configuration
#[derive(Debug, Clone)]
pub struct QoSConfig {
    pub priority_levels: usize,
    pub latency_targets: Vec<f64>,
    pub throughput_targets: Vec<f64>,
    pub fairness_constraints: bool,
}

/// Memory management configuration
#[derive(Debug, Clone)]
pub struct MemoryManagementConfig {
    pub memory_budget: usize,
    pub eviction_strategy: EvictionStrategy,
    pub compression_enabled: bool,
    pub memory_adaptation: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum EvictionStrategy {
    LRU,
    LFU,
    FIFO,
    ImportanceBased,
    TemporalDecay,
}

/// Task detection configuration
#[derive(Debug, Clone)]
pub struct TaskDetectionConfig {
    pub enabled: bool,
    pub detection_method: TaskDetectionMethod,
    pub sensitivity_threshold: f64,
    pub adaptation_delay: usize,
}

#[derive(Debug, Clone, Copy)]
pub enum TaskDetectionMethod {
    GradientBased,
    LossBased,
    StatisticalTest,
    ChangePointDetection,
    EnsembleMethods,
}

/// Knowledge transfer configuration
#[derive(Debug, Clone)]
pub struct KnowledgeTransferConfig {
    pub transfer_method: KnowledgeTransferMethod,
    pub transfer_strength: f64,
    pub selective_transfer: bool,
    pub privacy_preserving: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum KnowledgeTransferMethod {
    ParameterTransfer,
    FeatureTransfer,
    AttentionTransfer,
    DistillationBased,
    GradientBased,
}

/// Forgetting prevention configuration
#[derive(Debug, Clone)]
pub struct ForgettingPreventionConfig {
    pub method: ForgettingPreventionMethod,
    pub regularization_strength: f64,
    pub memory_replay_ratio: f64,
    pub importance_estimation: ImportanceEstimationMethod,
}

#[derive(Debug, Clone, Copy)]
pub enum ForgettingPreventionMethod {
    EWC,
    MAS,
    PackNet,
    ProgressiveNets,
    MemoryReplay,
}

#[derive(Debug, Clone, Copy)]
pub enum ImportanceEstimationMethod {
    FisherInformation,
    GradientNorm,
    PathIntegral,
    AttentionWeights,
}

/// Local differential privacy configuration
#[derive(Debug, Clone)]
pub struct LocalDPConfig {
    pub enabled: bool,
    pub epsilon: f64,
    pub mechanism: LocalDPMechanism,
    pub data_preprocessing: DataPreprocessingConfig,
}

#[derive(Debug, Clone, Copy)]
pub enum LocalDPMechanism {
    Randomized,
    Duchi,
    RAPPOR,
    PrivUnit,
    Harmony,
}

/// Global differential privacy configuration
#[derive(Debug, Clone)]
pub struct GlobalDPConfig {
    pub epsilon: f64,
    pub delta: f64,
    pub composition_method: CompositionMethod,
    pub amplification_analysis: bool,
}

#[derive(Debug, Clone, Copy)]
pub enum CompositionMethod {
    Basic,
    Advanced,
    RDP,
    ZCDP,
    Moments,
}

/// User-level privacy configuration
#[derive(Debug, Clone)]
pub struct UserLevelPrivacyConfig {
    pub enabled: bool,
    pub user_epsilon: f64,
    pub user_delta: f64,
    pub cross_device_correlation: bool,
    pub temporal_correlation: bool,
}

/// Hierarchical privacy configuration
#[derive(Debug, Clone)]
pub struct HierarchicalPrivacyConfig {
    pub levels: Vec<PrivacyLevel>,
    pub level_allocation: LevelAllocationStrategy,
    pub inter_level_composition: bool,
}

#[derive(Debug, Clone)]
pub struct PrivacyLevel {
    pub name: String,
    pub epsilon: f64,
    pub delta: f64,
    pub scope: PrivacyScope,
}

#[derive(Debug, Clone, Copy)]
pub enum PrivacyScope {
    Individual,
    Group,
    Organization,
    Global,
}

#[derive(Debug, Clone, Copy)]
pub enum LevelAllocationStrategy {
    Uniform,
    ProportionalToSensitivity,
    OptimalAllocation,
    AdaptiveAllocation,
}

/// Context-aware privacy configuration
#[derive(Debug, Clone)]
pub struct ContextAwarePrivacyConfig {
    pub enabled: bool,
    pub context_sensitivity: f64,
    pub dynamic_adjustment: bool,
    pub privacy_preferences: PrivacyPreferencesConfig,
}

/// Privacy preferences configuration
#[derive(Debug, Clone)]
pub struct PrivacyPreferencesConfig {
    pub user_controlled: bool,
    pub preference_learning: bool,
    pub default_privacy_level: PrivacyLevel,
    pub granular_control: bool,
}

/// Data preprocessing configuration for local DP
#[derive(Debug, Clone)]
pub struct DataPreprocessingConfig {
    pub normalization: bool,
    pub discretization: bool,
    pub dimensionality_reduction: bool,
    pub feature_selection: bool,
}

// Default implementations for configurations

impl Default for FederatedPrivacyConfig {
    fn default() -> Self {
        Self {
            base_config: DifferentialPrivacyConfig::default(),
            clients_per_round: 100,
            total_clients: 1000,
            sampling_strategy: ClientSamplingStrategy::UniformRandom,
            secure_aggregation: SecureAggregationConfig::default(),
            amplification_config: AmplificationConfig::default(),
            cross_device_config: CrossDeviceConfig::default(),
            composition_method: FederatedCompositionMethod::FederatedMomentsAccountant,
            trust_model: TrustModel::HonestButCurious,
            communication_privacy: CommunicationPrivacyConfig::default(),
        }
    }
}

impl Default for SecureAggregationConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            min_clients: 10,
            max_dropouts: 5,
            masking_dimension: 1000,
            seed_sharing: SeedSharingMethod::ShamirSecretSharing,
            quantization_bits: None,
            aggregate_dp: true,
        }
    }
}

impl Default for AmplificationConfig {
    fn default() -> Self {
        Self {
            enabled: true,
            subsampling_factor: 1.0,
            shuffling_enabled: false,
            multi_round_amplification: true,
            heterogeneous_amplification: false,
        }
    }
}

impl Default for CommunicationPrivacyConfig {
    fn default() -> Self {
        Self {
            encryption_enabled: true,
            anonymous_channels: false,
            communication_noise: false,
            traffic_analysis_protection: false,
            threat_modeling: AdvancedThreatModelingConfig::default(),
            cross_silo_config: None,
        }
    }
}

impl Default for AdversarialCapabilities {
    fn default() -> Self {
        Self {
            computational_resources: ComputationalThreatLevel::Limited,
            network_capabilities: NetworkThreatCapabilities::default(),
            data_capabilities: DataThreatCapabilities::default(),
            algorithmic_knowledge: AlgorithmicKnowledgeLevel::BlackBox,
            collusion_potential: CollusionThreatLevel::None,
            attack_persistence: AttackPersistenceLevel::OneTime,
        }
    }
}

impl Default for AnomalyDetectionConfig {
    fn default() -> Self {
        Self {
            algorithms: vec![AnomalyDetectionAlgorithm::StatisticalBaseline],
            thresholds: AnomalyThresholds::default(),
            response_actions: AnomalyResponseActions::default(),
        }
    }
}

impl Default for AnomalyThresholds {
    fn default() -> Self {
        Self {
            statistical_threshold: 0.95,
            confidence_threshold: 0.8,
            false_positive_rate: 0.05,
        }
    }
}

impl Default for AnomalyResponseActions {
    fn default() -> Self {
        Self {
            alert_generation: true,
            automatic_quarantine: false,
            enhanced_monitoring: true,
            incident_escalation: false,
        }
    }
}

impl Default for ThreatCorrelationConfig {
    fn default() -> Self {
        Self {
            correlation_algorithms: vec![CorrelationAlgorithm::StatisticalCorrelation],
            temporal_window: Duration::from_secs(3600), // 1 hour
            cross_client_correlation: false,
        }
    }
}

impl Default for RiskAssessmentConfig {
    fn default() -> Self {
        Self {
            methodology: RiskAssessmentMethodology::QualitativeAssessment,
            risk_tolerance: RiskToleranceLevels::default(),
            impact_assessment: ImpactAssessmentCriteria::default(),
            likelihood_estimation: LikelihoodEstimationMethods::default(),
            mitigation_strategies: RiskMitigationStrategies::default(),
        }
    }
}

impl Default for RiskToleranceLevels {
    fn default() -> Self {
        Self {
            privacy_risk_tolerance: 0.1,
            security_risk_tolerance: 0.05,
            utility_risk_tolerance: 0.2,
            operational_risk_tolerance: 0.15,
        }
    }
}

impl Default for ImpactAssessmentCriteria {
    fn default() -> Self {
        Self {
            confidentiality_impact: ImpactLevel::Medium,
            integrity_impact: ImpactLevel::High,
            availability_impact: ImpactLevel::Medium,
            compliance_impact: ImpactLevel::High,
        }
    }
}

impl Default for LikelihoodEstimationMethods {
    fn default() -> Self {
        Self {
            historical_analysis: true,
            expert_judgment: true,
            threat_modeling: false,
            simulation_based: false,
        }
    }
}

impl Default for ReputationSystemConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            initial_reputation: 1.0,
            reputation_decay: 0.95,
            min_reputation: 0.1,
            outlier_penalty: 0.1,
            contribution_bonus: 0.05,
        }
    }
}

impl Default for StatisticalTestConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            test_type: StatisticalTestType::ZScore,
            significancelevel: 0.05,
            window_size: 10,
            adaptive_threshold: false,
        }
    }
}

impl Default for LocalAdaptationConfig {
    fn default() -> Self {
        Self {
            adaptation_rate: 0.01,
            local_epochs: 1,
            adaptation_frequency: 1,
            adaptation_method: AdaptationMethod::FineTuning,
            regularization_strength: 0.01,
        }
    }
}

impl Default for ClusteringConfig {
    fn default() -> Self {
        Self {
            num_clusters: 5,
            clustering_method: ClusteringMethod::KMeans,
            similarity_metric: SimilarityMetric::CosineSimilarity,
            cluster_update_frequency: 10,
            privacy_preserving_clustering: false,
        }
    }
}

impl Default for MetaLearningConfig {
    fn default() -> Self {
        Self {
            inner_learning_rate: 0.01,
            outer_learning_rate: 0.001,
            inner_steps: 5,
            meta_batch_size: 32,
            adaptation_method: MetaAdaptationMethod::MAML,
        }
    }
}

impl Default for DynamicPrivacyConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            adaptation_frequency: 10,
            privacy_sensitivity: 1.0,
            utility_weight: 0.5,
            fairness_weight: 0.3,
        }
    }
}

impl Default for ContextualAdjustmentConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            context_factors: vec![ContextFactor::DataSensitivity],
            adjustment_sensitivity: 0.1,
            temporal_adaptation: false,
        }
    }
}

impl Default for LazyAggregationConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            aggregation_threshold: 0.9,
            staleness_tolerance: 5,
            gradient_similarity_threshold: 0.8,
        }
    }
}

impl Default for FederatedDropoutConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            dropout_probability: 0.1,
            adaptive_dropout: false,
            importance_sampling: false,
        }
    }
}

impl Default for AsyncUpdateConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            staleness_threshold: 10,
            mixing_coefficient: 0.9,
            buffering_strategy: BufferingStrategy::FIFO,
        }
    }
}

impl Default for QoSConfig {
    fn default() -> Self {
        Self {
            priority_levels: 3,
            latency_targets: vec![100.0, 200.0, 500.0],
            throughput_targets: vec![10.0, 5.0, 1.0],
            fairness_constraints: true,
        }
    }
}

impl Default for MemoryManagementConfig {
    fn default() -> Self {
        Self {
            memory_budget: 1000,
            eviction_strategy: EvictionStrategy::LRU,
            compression_enabled: false,
            memory_adaptation: false,
        }
    }
}

impl Default for TaskDetectionConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            detection_method: TaskDetectionMethod::GradientBased,
            sensitivity_threshold: 0.1,
            adaptation_delay: 5,
        }
    }
}

impl Default for KnowledgeTransferConfig {
    fn default() -> Self {
        Self {
            transfer_method: KnowledgeTransferMethod::ParameterTransfer,
            transfer_strength: 0.5,
            selective_transfer: false,
            privacy_preserving: true,
        }
    }
}

impl Default for ForgettingPreventionConfig {
    fn default() -> Self {
        Self {
            method: ForgettingPreventionMethod::EWC,
            regularization_strength: 0.1,
            memory_replay_ratio: 0.1,
            importance_estimation: ImportanceEstimationMethod::FisherInformation,
        }
    }
}

impl Default for AdaptiveBudgetConfig {
    fn default() -> Self {
        Self {
            enabled: false,
            allocation_strategy: BudgetAllocationStrategy::Uniform,
            dynamic_privacy: DynamicPrivacyConfig::default(),
            importance_weighting: false,
            contextual_adjustment: ContextualAdjustmentConfig::default(),
        }
    }
}
