use std::{collections::HashMap, sync::LazyLock};

use crate::{
    registry_frameworks::FRAMEWORKS,
    schema::{FrameworkName, Mode, Registry, RegistryEntry, RegistryItemType},
};

pub static THEMES: LazyLock<HashMap<FrameworkName, Registry>> = LazyLock::new(|| {
    let mut themes = HashMap::new();

    for framework in FRAMEWORKS.iter() {
        themes.insert(
            framework.name,
            vec![
                RegistryEntry {
                    name: "theme-daylight".into(),
                    r#type: RegistryItemType::Theme,
                    description: None,
                    dependencies: None,
                    dev_dependencies: None,
                    registry_dependencies: None,
                    files: None,
                    tailwind: None,
                    css_vars: Some(HashMap::from([
                        (
                            Mode::Light,
                            HashMap::from([
                                ("background".into(), "36 39% 88%".into()),
                                ("foreground".into(), "36 45% 15%".into()),
                                ("primary".into(), "36 45% 70%".into()),
                                ("primary-foreground".into(), "36 45% 11%".into()),
                                ("secondary".into(), "40 35% 77%".into()),
                                ("secondary-foreground".into(), "36 45% 25%".into()),
                                ("accent".into(), "36 64% 57%".into()),
                                ("accent-foreground".into(), "36 72% 17%".into()),
                                ("destructive".into(), "0 84% 37%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("muted".into(), "36 33% 75%".into()),
                                ("muted-foreground".into(), "36 45% 25%".into()),
                                ("card".into(), "36 46% 82%".into()),
                                ("card-foreground".into(), "36 45% 20%".into()),
                                ("popover".into(), "0 0% 100%".into()),
                                ("popover-foreground".into(), "240 10% 3.9%".into()),
                                ("border".into(), "36 45% 60%".into()),
                                ("input".into(), "36 45% 60%".into()),
                                ("ring".into(), "36 45% 30%".into()),
                                ("chart-1".into(), "25 34% 28%".into()),
                                ("chart-2".into(), "26 36% 34%".into()),
                                ("chart-3".into(), "28 40% 40%".into()),
                                ("chart-4".into(), "31 41% 48%".into()),
                                ("chart-5".into(), "35 43% 53%".into()),
                            ]),
                        ),
                        (
                            Mode::Dark,
                            HashMap::from([
                                ("background".into(), "36 39% 88%".into()),
                                ("foreground".into(), "36 45% 15%".into()),
                                ("primary".into(), "36 45% 70%".into()),
                                ("primary-foreground".into(), "36 45% 11%".into()),
                                ("secondary".into(), "40 35% 77%".into()),
                                ("secondary-foreground".into(), "36 45% 25%".into()),
                                ("accent".into(), "36 64% 57%".into()),
                                ("accent-foreground".into(), "36 72% 17%".into()),
                                ("destructive".into(), "0 84% 37%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("muted".into(), "36 33% 75%".into()),
                                ("muted-foreground".into(), "36 45% 25%".into()),
                                ("card".into(), "36 46% 82%".into()),
                                ("card-foreground".into(), "36 45% 20%".into()),
                                ("popover".into(), "0 0% 100%".into()),
                                ("popover-foreground".into(), "240 10% 3.9%".into()),
                                ("border".into(), "36 45% 60%".into()),
                                ("input".into(), "36 45% 60%".into()),
                                ("ring".into(), "36 45% 30%".into()),
                                ("chart-1".into(), "25 34% 28%".into()),
                                ("chart-2".into(), "26 36% 34%".into()),
                                ("chart-3".into(), "28 40% 40%".into()),
                                ("chart-4".into(), "31 41% 48%".into()),
                                ("chart-5".into(), "35 43% 53%".into()),
                            ]),
                        ),
                    ])),
                    source: None,
                    category: None,
                    subcategory: None,
                    chunks: None,
                    docs: None,
                },
                RegistryEntry {
                    name: "theme-midnight".into(),
                    r#type: RegistryItemType::Theme,
                    description: None,
                    dependencies: None,
                    dev_dependencies: None,
                    registry_dependencies: None,
                    files: None,
                    tailwind: None,
                    css_vars: Some(HashMap::from([
                        (
                            Mode::Light,
                            HashMap::from([
                                ("background".into(), "240 5% 6%".into()),
                                ("foreground".into(), "60 5% 90%".into()),
                                ("primary".into(), "240 0% 90%".into()),
                                ("primary-foreground".into(), "60 0% 0%".into()),
                                ("secondary".into(), "240 4% 15%".into()),
                                ("secondary-foreground".into(), "60 5% 85%".into()),
                                ("accent".into(), "240 0% 13%".into()),
                                ("accent-foreground".into(), "60 0% 100%".into()),
                                ("destructive".into(), "0 60% 50%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("muted".into(), "240 5% 25%".into()),
                                ("muted-foreground".into(), "60 5% 85%".into()),
                                ("card".into(), "240 4% 10%".into()),
                                ("card-foreground".into(), "60 5% 90%".into()),
                                ("popover".into(), "240 5% 15%".into()),
                                ("popover-foreground".into(), "60 5% 85%".into()),
                                ("border".into(), "240 6% 20%".into()),
                                ("input".into(), "240 6% 20%".into()),
                                ("ring".into(), "240 5% 90%".into()),
                                ("chart-1".into(), "359 2% 90%".into()),
                                ("chart-2".into(), "240 1% 74%".into()),
                                ("chart-3".into(), "240 1% 58%".into()),
                                ("chart-4".into(), "240 1% 42%".into()),
                                ("chart-5".into(), "240 2% 26%".into()),
                            ]),
                        ),
                        (
                            Mode::Dark,
                            HashMap::from([
                                ("background".into(), "240 5% 6%".into()),
                                ("foreground".into(), "60 5% 90%".into()),
                                ("primary".into(), "240 0% 90%".into()),
                                ("primary-foreground".into(), "60 0% 0%".into()),
                                ("secondary".into(), "240 4% 15%".into()),
                                ("secondary-foreground".into(), "60 5% 85%".into()),
                                ("accent".into(), "240 0% 13%".into()),
                                ("accent-foreground".into(), "60 0% 100%".into()),
                                ("destructive".into(), "0 60% 50%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("muted".into(), "240 5% 25%".into()),
                                ("muted-foreground".into(), "60 5% 85%".into()),
                                ("card".into(), "240 4% 10%".into()),
                                ("card-foreground".into(), "60 5% 90%".into()),
                                ("popover".into(), "240 5% 15%".into()),
                                ("popover-foreground".into(), "60 5% 85%".into()),
                                ("border".into(), "240 6% 20%".into()),
                                ("input".into(), "240 6% 20%".into()),
                                ("ring".into(), "240 5% 90%".into()),
                                ("chart-1".into(), "359 2% 90%".into()),
                                ("chart-2".into(), "240 1% 74%".into()),
                                ("chart-3".into(), "240 1% 58%".into()),
                                ("chart-4".into(), "240 1% 42%".into()),
                                ("chart-5".into(), "240 2% 26%".into()),
                            ]),
                        ),
                    ])),
                    source: None,
                    category: None,
                    subcategory: None,
                    chunks: None,
                    docs: None,
                },
                RegistryEntry {
                    name: "theme-emerald".into(),
                    r#type: RegistryItemType::Theme,
                    description: None,
                    dependencies: None,
                    dev_dependencies: None,
                    registry_dependencies: None,
                    files: None,
                    tailwind: None,
                    css_vars: Some(HashMap::from([
                        (
                            Mode::Light,
                            HashMap::from([
                                ("background".into(), "0 0% 100%".into()),
                                ("foreground".into(), "240 10% 3.9%".into()),
                                ("card".into(), "0 0% 100%".into()),
                                ("card-foreground".into(), "240 10% 3.9%".into()),
                                ("popover".into(), "0 0% 100%".into()),
                                ("popover-foreground".into(), "240 10% 3.9%".into()),
                                ("primary".into(), "142 86% 28%".into()),
                                ("primary-foreground".into(), "356 29% 98%".into()),
                                ("secondary".into(), "240 4.8% 95.9%".into()),
                                ("secondary-foreground".into(), "240 5.9% 10%".into()),
                                ("muted".into(), "240 4.8% 95.9%".into()),
                                ("muted-foreground".into(), "240 3.8% 45%".into()),
                                ("accent".into(), "240 4.8% 95.9%".into()),
                                ("accent-foreground".into(), "240 5.9% 10%".into()),
                                ("destructive".into(), "0 72% 51%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("border".into(), "240 5.9% 90%".into()),
                                ("input".into(), "240 5.9% 90%".into()),
                                ("ring".into(), "142 86% 28%".into()),
                                ("chart-1".into(), "139 65% 20%".into()),
                                ("chart-2".into(), "140 74% 44%".into()),
                                ("chart-3".into(), "142 88% 28%".into()),
                                ("chart-4".into(), "137 55% 15%".into()),
                                ("chart-5".into(), "141 40% 9%".into()),
                            ]),
                        ),
                        (
                            Mode::Dark,
                            HashMap::from([
                                ("background".into(), "240 10% 3.9%".into()),
                                ("foreground".into(), "0 0% 98%".into()),
                                ("card".into(), "240 10% 3.9%".into()),
                                ("card-foreground".into(), "0 0% 98%".into()),
                                ("popover".into(), "240 10% 3.9%".into()),
                                ("popover-foreground".into(), "0 0% 98%".into()),
                                ("primary".into(), "142 86% 28%".into()),
                                ("primary-foreground".into(), "356 29% 98%".into()),
                                ("secondary".into(), "240 4.8% 95.9%".into()),
                                ("secondary-foreground".into(), "240 5.9% 10%".into()),
                                ("muted".into(), "240 3.7% 15.9%".into()),
                                ("muted-foreground".into(), "240 5% 64.9%".into()),
                                ("accent".into(), "240 3.7% 15.9%".into()),
                                ("accent-foreground".into(), "0 0% 98%".into()),
                                ("destructive".into(), "0 72% 51%".into()),
                                ("destructive-foreground".into(), "0 0% 98%".into()),
                                ("border".into(), "240 3.7% 15.9%".into()),
                                ("input".into(), "240 3.7% 15.9%".into()),
                                ("ring".into(), "142 86% 28%".into()),
                                ("chart-1".into(), "142 88% 28%".into()),
                                ("chart-2".into(), "139 65% 20%".into()),
                                ("chart-3".into(), "140 74% 24%".into()),
                                ("chart-4".into(), "137 55% 15%".into()),
                                ("chart-5".into(), "141 40% 9%".into()),
                            ]),
                        ),
                    ])),
                    source: None,
                    category: None,
                    subcategory: None,
                    chunks: None,
                    docs: None,
                },
            ],
        );
    }

    themes
});
