use std::collections::HashMap;

use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ExperimentConfigSnapshot {
    pub variant: String,
    pub feature_flags: HashMap<String, bool>,
}

#[derive(Clone, Default)]
pub struct ExperimentsStore;

impl ExperimentsStore {
    pub fn new() -> Self {
        Self
    }

    pub fn config_for_variant(&self, variant: &str) -> ExperimentConfigSnapshot {
        ExperimentConfigSnapshot {
            variant: variant.to_string(),
            feature_flags: feature_flags_for_variant(variant),
        }
    }
}

fn feature_flags_for_variant(variant: &str) -> HashMap<String, bool> {
    let modern = variant == "modern";
    let mut flags = HashMap::new();
    flags.insert("control_mode".to_string(), !modern);
    flags.insert("modern_mode".to_string(), modern);
    flags.insert("animation_intensity_high".to_string(), modern);
    flags.insert("haptics_enabled".to_string(), true);
    flags.insert("autoplay_next_enabled".to_string(), true);
    flags.insert("countdown_style_compact".to_string(), modern);
    flags.insert("odds_update_visualization_enabled".to_string(), modern);
    flags.insert("result_card_style_modern".to_string(), modern);
    flags.insert("localization_source_contracts".to_string(), true);
    flags
}
