"""Text-related style definitions: Colors, Sizes, Fonts, Decors, Weights, Alignments, Titles."""

from typing import Optional, Union

from .core import Style


class Decors:
    italic_text        = Style("font-style: italic;",     "italic_text")
    underline_text     = Style("text-decoration: underline;", "underline_text")
    decor_none_text    = Style("text-decoration: none;",  "decor_none_text")
    strike_text        = Style("text-decoration: line-through;", "strike_text")


class Weights:
    bold_weight        = Style("font-weight: bold;",   "bold_weight")
    light_weight       = Style("font-weight: 300;",    "light_weight")
    normal_weight      = Style("font-weight: normal;", "normal_weight")


class Alignments:
    center_align       = Style("text-align: center;",  "center_align")
    right_align        = Style("text-align: right;",   "right_align")
    left_align         = Style("text-align: left;",    "left_align")
    justify_align      = Style("text-align: justify;", "justify_align")


class Colors:
    reset              = Style("color: initial;",   "reset")
    alexandra          = Style("color: #4285F4;", "alexandra")
    alice_blue         = Style("color: AliceBlue;", "alice_blue")
    antique_white      = Style("color: AntiqueWhite;", "antique_white")
    aqua               = Style("color: Aqua;", "aqua")
    aquamarine         = Style("color: Aquamarine;", "aquamarine")
    azure              = Style("color: Azure;", "azure")
    beige              = Style("color: Beige;", "beige")
    bisque             = Style("color: Bisque;", "bisque")
    black              = Style("color: Black;", "black")
    blanched_almond    = Style("color: BlanchedAlmond;", "blanched_almond")
    blue               = Style("color: Blue;", "blue")
    blue_violet        = Style("color: BlueViolet;", "blue_violet")
    brown              = Style("color: Brown;", "brown")
    burly_wood         = Style("color: BurlyWood;", "burly_wood")
    cadet_blue         = Style("color: CadetBlue;", "cadet_blue")
    chartreuse         = Style("color: Chartreuse;", "chartreuse")
    chocolate          = Style("color: Chocolate;", "chocolate")
    coral              = Style("color: Coral;", "coral")
    cornflower_blue    = Style("color: CornflowerBlue;", "cornflower_blue")
    cornsilk           = Style("color: Cornsilk;", "cornsilk")
    crimson            = Style("color: Crimson;", "crimson")
    cyan               = Style("color: Cyan;", "cyan")
    dark_blue          = Style("color: DarkBlue;", "dark_blue")
    dark_cyan          = Style("color: DarkCyan;", "dark_cyan")
    dark_golden_rod    = Style("color: DarkGoldenRod;", "dark_golden_rod")
    dark_gray          = Style("color: DarkGray;", "dark_gray")
    dark_grey          = Style("color: DarkGrey;", "dark_grey")
    dark_green         = Style("color: DarkGreen;", "dark_green")
    dark_khaki         = Style("color: DarkKhaki;", "dark_khaki")
    dark_magenta       = Style("color: DarkMagenta;", "dark_magenta")
    dark_olive_green   = Style("color: DarkOliveGreen;", "dark_olive_green")
    dark_orange        = Style("color: DarkOrange;", "dark_orange")
    dark_orchid        = Style("color: DarkOrchid;", "dark_orchid")
    dark_red           = Style("color: DarkRed;", "dark_red")
    dark_salmon        = Style("color: DarkSalmon;", "dark_salmon")
    dark_sea_green     = Style("color: DarkSeaGreen;", "dark_sea_green")
    dark_slate_blue    = Style("color: DarkSlateBlue;", "dark_slate_blue")
    dark_slate_gray    = Style("color: DarkSlateGray;", "dark_slate_gray")
    dark_slate_grey    = Style("color: DarkSlateGrey;", "dark_slate_grey")
    dark_turquoise     = Style("color: DarkTurquoise;", "dark_turquoise")
    dark_violet        = Style("color: DarkViolet;", "dark_violet")
    deep_pink          = Style("color: DeepPink;", "deep_pink")
    deep_sky_blue      = Style("color: DeepSkyBlue;", "deep_sky_blue")
    dim_gray           = Style("color: DimGray;", "dim_gray")
    dim_grey           = Style("color: DimGrey;", "dim_grey")
    dodger_blue        = Style("color: DodgerBlue;", "dodger_blue")
    fire_brick         = Style("color: FireBrick;", "fire_brick")
    floral_white       = Style("color: FloralWhite;", "floral_white")
    forest_green       = Style("color: ForestGreen;", "forest_green")
    fuchsia            = Style("color: Fuchsia;", "fuchsia")
    gainsboro          = Style("color: Gainsboro;", "gainsboro")
    ghost_white        = Style("color: GhostWhite;", "ghost_white")
    gold               = Style("color: Gold;", "gold")
    golden_rod         = Style("color: GoldenRod;", "golden_rod")
    gray               = Style("color: Gray;", "gray")
    grey               = Style("color: Grey;", "grey")
    green              = Style("color: Green;", "green")
    green_yellow       = Style("color: GreenYellow;", "green_yellow")
    honey_dew          = Style("color: HoneyDew;", "honey_dew")
    hot_pink           = Style("color: HotPink;", "hot_pink")
    indian_red         = Style("color: IndianRed;", "indian_red")
    indigo             = Style("color: Indigo;", "indigo")
    ivory              = Style("color: Ivory;", "ivory")
    khaki              = Style("color: Khaki;", "khaki")
    lavender           = Style("color: Lavender;", "lavender")
    lavender_blush     = Style("color: LavenderBlush;", "lavender_blush")
    lawn_green         = Style("color: LawnGreen;", "lawn_green")
    lemon_chiffon      = Style("color: LemonChiffon;", "lemon_chiffon")
    light_blue         = Style("color: LightBlue;", "light_blue")
    light_coral        = Style("color: LightCoral;", "light_coral")
    light_cyan         = Style("color: LightCyan;", "light_cyan")
    light_golden_rod_yellow = Style("color: LightGoldenRodYellow;", "light_golden_rod_yellow")
    light_gray         = Style("color: LightGray;", "light_gray")
    light_grey         = Style("color: LightGrey;", "light_grey")
    light_green        = Style("color: LightGreen;", "light_green")
    light_pink         = Style("color: LightPink;", "light_pink")
    light_salmon       = Style("color: LightSalmon;", "light_salmon")
    light_sea_green    = Style("color: LightSeaGreen;", "light_sea_green")
    light_sky_blue     = Style("color: LightSkyBlue;", "light_sky_blue")
    light_slate_gray   = Style("color: LightSlateGray;", "light_slate_gray")
    light_slate_grey   = Style("color: LightSlateGrey;", "light_slate_grey")
    light_steel_blue   = Style("color: LightSteelBlue;", "light_steel_blue")
    light_yellow       = Style("color: LightYellow;", "light_yellow")
    lime               = Style("color: Lime;", "lime")
    lime_green         = Style("color: LimeGreen;", "lime_green")
    linen              = Style("color: Linen;", "linen")
    magenta            = Style("color: Magenta;", "magenta")
    maroon             = Style("color: Maroon;", "maroon")
    medium_aqua_marine = Style("color: MediumAquaMarine;", "medium_aqua_marine")
    medium_blue        = Style("color: MediumBlue;", "medium_blue")
    medium_orchid      = Style("color: MediumOrchid;", "medium_orchid")
    medium_purple      = Style("color: MediumPurple;", "medium_purple")
    medium_sea_green   = Style("color: MediumSeaGreen;", "medium_sea_green")
    medium_slate_blue  = Style("color: MediumSlateBlue;", "medium_slate_blue")
    medium_spring_green= Style("color: MediumSpringGreen;", "medium_spring_green")
    medium_turquoise   = Style("color: MediumTurquoise;", "medium_turquoise")
    medium_violet_red  = Style("color: MediumVioletRed;", "medium_violet_red")
    midnight_blue      = Style("color: MidnightBlue;", "midnight_blue")
    mint_cream         = Style("color: MintCream;", "mint_cream")
    misty_rose         = Style("color: MistyRose;", "misty_rose")
    moccasin           = Style("color: Moccasin;", "moccasin")
    navajo_white       = Style("color: NavajoWhite;", "navajo_white")
    navy               = Style("color: Navy;", "navy")
    old_lace           = Style("color: OldLace;", "old_lace")
    olive              = Style("color: Olive;", "olive")
    olive_drab         = Style("color: OliveDrab;", "olive_drab")
    orange             = Style("color: Orange;", "orange")
    orange_red         = Style("color: OrangeRed;", "orange_red")
    orchid             = Style("color: Orchid;", "orchid")
    pale_golden_rod    = Style("color: PaleGoldenRod;", "pale_golden_rod")
    pale_green         = Style("color: PaleGreen;", "pale_green")
    pale_turquoise     = Style("color: PaleTurquoise;", "pale_turquoise")
    pale_violet_red    = Style("color: PaleVioletRed;", "pale_violet_red")
    papaya_whip        = Style("color: PapayaWhip;", "papaya_whip")
    peach_puff         = Style("color: PeachPuff;", "peach_puff")
    peru               = Style("color: Peru;", "peru")
    pink               = Style("color: Pink;", "pink")
    plum               = Style("color: Plum;", "plum")
    powder_blue        = Style("color: PowderBlue;", "powder_blue")
    purple             = Style("color: Purple;", "purple")
    rebecca_purple     = Style("color: RebeccaPurple;", "rebecca_purple")
    red                = Style("color: Red;", "red")
    retro_green        = Style("color: #34A853;", "retro_green")
    rosy_brown         = Style("color: RosyBrown;", "rosy_brown")
    royal_blue         = Style("color: RoyalBlue;", "royal_blue")
    royal_gold         = Style("color: #FBBC05;", "royal_gold")
    saddle_brown       = Style("color: SaddleBrown;", "saddle_brown")
    salmon             = Style("color: Salmon;", "salmon")
    sandy_brown        = Style("color: SandyBrown;", "sandy_brown")
    sea_green          = Style("color: SeaGreen;", "sea_green")
    sea_shell          = Style("color: SeaShell;", "sea_shell")
    sienna             = Style("color: Sienna;", "sienna")
    silver             = Style("color: Silver;", "silver")
    sky_blue           = Style("color: SkyBlue;", "sky_blue")
    slate_blue         = Style("color: SlateBlue;", "slate_blue")
    slate_gray         = Style("color: SlateGray;", "slate_gray")
    slate_grey         = Style("color: SlateGrey;", "slate_grey")
    snow               = Style("color: Snow;", "snow")
    spring_green       = Style("color: SpringGreen;", "spring_green")
    steel_blue         = Style("color: SteelBlue;", "steel_blue")
    tan                = Style("color: Tan;", "tan")
    teal               = Style("color: Teal;", "teal")
    thistle            = Style("color: Thistle;", "thistle")
    tomato             = Style("color: Tomato;", "tomato")
    turquoise          = Style("color: Turquoise;", "turquoise")
    vermillion         = Style("color: #EA4335;", "vermillion")
    violet             = Style("color: Violet;", "violet")
    wheat              = Style("color: Wheat;", "wheat")
    white              = Style("color: White;", "white")
    white_smoke        = Style("color: WhiteSmoke;", "white_smoke")
    yellow             = Style("color: Yellow;", "yellow")
    yellow_green       = Style("color: YellowGreen;", "yellow_green")


class Sizes:
    @staticmethod
    def size(size: Union[str, int] = 16, style_id: Optional[str] = None):
        """Creates a text Style with the specified font size."""
        if isinstance(size, int):
            size = f"{size}pt"
        if not style_id:
            style_id = f"size_{size.replace(' ', '').replace(';', '').replace(':','')}"
        return Style(f"font-size: {size};", style_id)

    Giant_em_size   = Style("font-size: 8em;",   "Giant_em_size")
    giant_em_size   = Style("font-size: 7em;",   "giant_em_size")
    Huge_em_size    = Style("font-size: 6em;",   "Huge_em_size")
    huge_em_size    = Style("font-size: 5em;",   "huge_em_size")
    LARGE_em_size   = Style("font-size: 4em;",   "LARGE_em_size")
    Large_em_size   = Style("font-size: 3em;",   "Large_em_size")
    large_em_size   = Style("font-size: 2em;",   "large_em_size")
    big_em_size     = Style("font-size: 1.5em;", "big_em_size")
    medium_em_size  = Style("font-size: 1em;",   "medium_em_size")
    little_em_size  = Style("font-size: 0.75em;","little_em_size")
    small_em_size   = Style("font-size: 0.5em;", "small_em_size")
    tiny_em_size    = Style("font-size: 0.25em;","tiny_em_size")

    Giant_px_size   = Style("font-size: 128px;", "Giant_px_size")
    giant_px_size   = Style("font-size: 112px;", "giant_px_size")
    Huge_px_size    = Style("font-size: 96px;",  "Huge_px_size")
    huge_px_size    = Style("font-size: 80px;",  "huge_px_size")
    LARGE_px_size   = Style("font-size: 64px;",  "LARGE_px_size")
    Large_px_size   = Style("font-size: 48px;",  "Large_px_size")
    large_px_size   = Style("font-size: 32px;",  "large_px_size")
    big_px_size     = Style("font-size: 24px;",  "big_px_size")
    medium_px_size  = Style("font-size: 16px;",  "medium_px_size")
    little_px_size  = Style("font-size: 12px;",  "little_px_size")
    small_px_size   = Style("font-size: 8px;",   "small_px_size")
    tiny_px_size    = Style("font-size: 4px;",   "tiny_px_size")

    GIANT_size      = Style("font-size: var(--stx-GIANT-size, 196pt);", "GIANT_size")
    Giant_size      = Style("font-size: var(--stx-Giant-size, 128pt);", "Giant_size")
    giant_size      = Style("font-size: var(--stx-giant-size, 112pt);", "giant_size")
    Huge_size       = Style("font-size: var(--stx-Huge-size, 96pt);",   "Huge_size")
    huge_size       = Style("font-size: var(--stx-huge-size, 80pt);",   "huge_size")
    LARGE_size      = Style("font-size: var(--stx-LARGE-size, 64pt);",  "LARGE_size")
    Large_size      = Style("font-size: var(--stx-Large-size, 48pt);",  "Large_size")
    large_size      = Style("font-size: var(--stx-large-size, 32pt);",  "large_size")
    big_size        = Style("font-size: var(--stx-big-size, 24pt);",    "big_size")
    medium_size     = Style("font-size: var(--stx-medium-size, 16pt);", "medium_size")
    little_size     = Style("font-size: var(--stx-little-size, 12pt);", "little_size")
    small_size      = Style("font-size: var(--stx-small-size, 8pt);",   "small_size")
    tiny_size       = Style("font-size: var(--stx-tiny-size, 4pt);",    "tiny_size")


class Fonts:
    font_arial         = Style("font-family: Arial; font-style: normal;",         "font_arial")
    font_helvetica     = Style("font-family: Helvetica; font-style: normal;",     "font_helvetica")
    font_verdana       = Style("font-family: Verdana; font-style: normal;",       "font_verdana")
    font_tahoma        = Style("font-family: Tahoma; font-style: normal;",        "font_tahoma")
    font_trebuchet_ms  = Style("font-family: 'Trebuchet MS'; font-style: normal;","font_trebuchet_ms")
    font_gill_sans     = Style("font-family: 'Gill Sans'; font-style: normal;",   "font_gill_sans")
    font_times_new_roman = Style("font-family: 'Times New Roman'; font-style: normal;", "font_times_new_roman")
    font_georgia         = Style("font-family: Georgia; font-style: normal;",           "font_georgia")
    font_garamond        = Style("font-family: Garamond; font-style: normal;",          "font_garamond")
    font_baskerville     = Style("font-family: Baskerville; font-style: normal;",       "font_baskerville")
    font_caslon          = Style("font-family: Caslon; font-style: normal;",            "font_caslon")
    font_book_antiqua    = Style("font-family: 'Book Antiqua'; font-style: normal;",    "font_book_antiqua")
    font_courier_new   = Style("font-family: 'Courier New'; font-style: normal;",  "font_courier_new")
    font_lucida_console= Style("font-family: 'Lucida Console'; font-style: normal;","font_lucida_console")
    font_monaco        = Style("font-family: Monaco; font-style: normal;",         "font_monaco")
    font_consolas      = Style("font-family: Consolas; font-style: normal;",       "font_consolas")
    font_comic_sans_ms   = Style("font-family: 'Comic Sans MS'; font-style: normal;",   "font_comic_sans_ms")
    font_brush_script_mt = Style("font-family: 'Brush Script MT'; font-style: normal;", "font_brush_script_mt")
    font_impact     = Style("font-family: Impact; font-style: normal;",    "font_impact")
    font_luminari   = Style("font-family: Luminari; font-style: normal;",  "font_luminari")
    font_chalkduster= Style("font-family: Chalkduster; font-style: normal;","font_chalkduster")
    font_system_ui   = Style("font-family: system-ui; font-style: normal;",  "font_system_ui")
    font_segoe_ui    = Style("font-family: 'Segoe UI'; font-style: normal;", "font_segoe_ui")
    font_apple_system= Style("font-family: -apple-system; font-style: normal;", "font_apple_system")
    font_sans_serif  = Style("font-family: sans-serif; font-style: normal;", "font_sans_serif")
    font_serif       = Style("font-family: serif; font-style: normal;",     "font_serif")
    font_monospace   = Style("font-family: monospace; font-style: normal;", "font_monospace")


class Wrap:
    wrap = Style("text-wrap: wrap;", "wrap")
    nowrap = Style("text-wrap: nowrap;", "nowrap")


class Titles:
    title = Style.create(
        Weights.bold_weight + Sizes.LARGE_size + Alignments.center_align,
        "title"
    )
    subtitle = Style.create(
        Weights.bold_weight + Sizes.large_size + Alignments.center_align,
        "subtitle"
    )


class Text:
    decors = Decors
    weights = Weights
    alignments = Alignments
    colors = Colors
    bg_colors = None  # Set after BackgroundColors is defined in container module
    sizes = Sizes
    fonts = Fonts
    titles = Titles
    wrap = Wrap
