use ratatui::style::Color;

#[derive(Debug, Clone, Copy)]
pub struct Theme {
    // Accent / selection
    pub accent: Color,
    pub accent_text: Color, // text on accent background

    // General text
    pub text: Color,
    pub text_dim: Color,
    pub text_muted: Color,

    // Semantic
    pub success: Color, // stages, YAML lists
    pub warning: Color, // manual jobs, exports, tags
    pub error: Color,   // errors
    pub info: Color,    // image labels, shebangs

    // DAG
    pub edge_dim: Color,
    pub box_border: Color,

    // Borders
    pub border_focused: Color,
    pub border_unfocused: Color,

    // Title bar
    pub title_bg: Color,
    pub title_fg: Color,
    pub title_path: Color,
}

impl Theme {
    pub fn dark() -> Self {
        Theme {
            accent: Color::Cyan,
            accent_text: Color::Black,

            text: Color::White,
            text_dim: Color::DarkGray,
            text_muted: Color::Gray,

            success: Color::Green,
            warning: Color::Yellow,
            error: Color::Red,
            info: Color::Magenta,

            edge_dim: Color::DarkGray,
            box_border: Color::Gray,

            border_focused: Color::Cyan,
            border_unfocused: Color::Gray,

            title_bg: Color::Cyan,
            title_fg: Color::Black,
            title_path: Color::DarkGray,
        }
    }

    pub fn light() -> Self {
        Theme {
            accent: Color::Blue,
            accent_text: Color::White,

            text: Color::Black,
            text_dim: Color::DarkGray,
            text_muted: Color::DarkGray,

            success: Color::Green,
            warning: Color::Rgb(180, 120, 0), // dark yellow/amber
            error: Color::Red,
            info: Color::Magenta,

            edge_dim: Color::Rgb(180, 180, 180),
            box_border: Color::DarkGray,

            border_focused: Color::Blue,
            border_unfocused: Color::DarkGray,

            title_bg: Color::Blue,
            title_fg: Color::White,
            title_path: Color::DarkGray,
        }
    }
}
