use std::fmt::Display;

#[cfg(feature = "serde")]
use serde::Deserialize;

/// Named colors as defined by libadwaita. A complete documentation detailing
/// the default values and semantic meaning of these colors can be found in the
/// [libadwaita documentation](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.5/named-colors.html)
#[cfg_attr(feature = "serde", derive(Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ColorName {
    Accent,
    AccentBg,
    AccentFg,

    Destructive,
    DestructiveBg,
    DestructiveFg,

    Success,
    SuccessBg,
    SuccessFg,

    Warning,
    WarningBg,
    WarningFg,

    Error,
    ErrorBg,
    ErrorFg,

    WindowBg,
    WindowFg,

    ViewBg,
    ViewFg,

    HeaderbarBg,
    HeaderbarFg,
    HeaderbarBorder,
    HeaderbarBackdrop,
    HeaderbarShade,
    HeaderbarDarkerShade,

    SidebarBg,
    SidebarFg,
    SidebarBackdrop,
    SidebarBorder,
    SidebarShade,

    SecondarySidebarBg,
    SecondarySidebarFg,
    SecondarySidebarBackdrop,
    SecondarySidebarBorder,
    SecondarySidebarShade,

    CardBg,
    CardFg,
    CardShade,

    ThumbnailBg,
    ThumbnailFg,

    DialogBg,
    DialogFg,

    PopoverBg,
    PopoverFg,
    PopoverShade,

    Shade,
    ScrollbarOutline,
}

impl Display for ColorName {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.write_str(match self {
            ColorName::Accent => "accent_color",
            ColorName::AccentBg => "accent_bg_color",
            ColorName::AccentFg => "accent_fg_color",
            ColorName::Destructive => "destructive_color",
            ColorName::DestructiveBg => "destructive_bg_color",
            ColorName::DestructiveFg => "destructive_fg_color",
            ColorName::Success => "success_color",
            ColorName::SuccessBg => "success_bg_color",
            ColorName::SuccessFg => "success_fg_color",
            ColorName::Warning => "warning_color",
            ColorName::WarningBg => "warning_bg_color",
            ColorName::WarningFg => "warning_fg_color",
            ColorName::Error => "error_color",
            ColorName::ErrorBg => "error_bg_color",
            ColorName::ErrorFg => "error_fg_color",
            ColorName::WindowBg => "window_bg_color",
            ColorName::WindowFg => "window_fg_color",
            ColorName::ViewBg => "view_bg_color",
            ColorName::ViewFg => "view_fg_color",
            ColorName::HeaderbarBg => "headerbar_bg_color",
            ColorName::HeaderbarFg => "headerbar_fg_color",
            ColorName::HeaderbarBorder => "headerbar_border_color",
            ColorName::HeaderbarBackdrop => "headerbar_backdrop_color",
            ColorName::HeaderbarShade => "headerbar_shade_color",
            ColorName::HeaderbarDarkerShade => "headerbar_darker_shade_color",
            ColorName::SidebarBg => "sidebar_bg_color",
            ColorName::SidebarFg => "sidebar_fg_color",
            ColorName::SidebarBackdrop => "sidebar_backdrop_color",
            ColorName::SidebarBorder => "sidebar_border_color",
            ColorName::SidebarShade => "sidebar_shade_color",
            ColorName::SecondarySidebarBg => "secondary_sidebar_bg_color",
            ColorName::SecondarySidebarFg => "secondary_sidebar_fg_color",
            ColorName::SecondarySidebarBackdrop => "secondary_sidebar_backdrop_color",
            ColorName::SecondarySidebarBorder => "secondary_sidebar_border_color",
            ColorName::SecondarySidebarShade => "secondary_sidebar_shade_color",
            ColorName::CardBg => "card_bg_color",
            ColorName::CardFg => "card_fg_color",
            ColorName::CardShade => "card_shade_color",
            ColorName::ThumbnailBg => "thumbnail_bg_color",
            ColorName::ThumbnailFg => "thumbnail_fg_color",
            ColorName::DialogBg => "dialog_bg_color",
            ColorName::DialogFg => "dialog_fg_color",
            ColorName::PopoverBg => "popover_bg_color",
            ColorName::PopoverFg => "popover_fg_color",
            ColorName::PopoverShade => "popover_shade_color",
            ColorName::Shade => "shade_color",
            ColorName::ScrollbarOutline => "scrollbar_outline_color",
        })
    }
}
