module Config.Style.Colour.Helpers exposing
    ( darkColourTheme
    , getColour
    , getColourScheme
    , getScheme
    , lightColourTheme
    )

import Config.Style.Colour.Types
    exposing
        ( ColourScheme
        , Theme(..)
        )
import Element as E exposing (..)
import Element.Font as F exposing (color)
import Shared


lightColourTheme : ColourScheme
lightColourTheme =
    { -- Core brand colors
      primary = rgb255 92 128 105 -- ll green
    , secondary = rgb255 92 128 105 -- ll green

    -- Surface colorsc
    , background = rgb255 192 228 205 --3lite green--
    , surface = rgb255 239 255 252 -- white green
    , surfaceVariant = rgb255 229 255 242 -- dwhite green

    -- Text colors
    , onPrimary = rgb255 255 255 255
    , onSecondary = rgb255 255 255 255
    , onBackground = rgb255 72 108 85 -- l green
    , onSurface = rgb255 32 68 45 -- m green

    -- Special purpose
    , shadow = rgba 34 139 34 0.15
    , overlay = rgba 27 94 27 0.6
    , border = rgb255 200 230 201
    , focus = rgb255 102 187 106
    , transparent = rgba 0 0 0 0
    }


darkColourTheme : ColourScheme
darkColourTheme =
    { -- Core brand colors
      primary = rgb255 92 128 105 -- ll green (unchanged)
    , secondary = rgb255 32 68 45 -- g green (slightly deeper)

    -- Surface colors
    , background = rgb255 2 38 15 -- darker dk dk green
    , surface = rgb255 18 50 28 -- dk green (slightly lighter than background)
    , surfaceVariant = rgb255 38 78 50 -- mm green (lighter for contrast)

    -- Text colors
    , onPrimary = rgb255 92 128 105 -- ll green (unchanged)
    , onSecondary = rgb255 122 168 145 -- lll green (slightly lighter for contrast)
    , onBackground = rgb255 152 188 165 -- dlite green (brighter for clarity)
    , onSurface = rgb255 102 138 115 -- medium green (brighter than before)

    -- Special purpose
    , shadow = rgba 0 0 0 0.4
    , overlay = rgba 0 0 0 0.7
    , border = rgb255 66 90 66 -- slightly darker than before
    , focus = rgb255 129 199 132 -- unchanged
    , transparent = rgba 0 0 0 0
    }


getColourScheme : Theme -> ColourScheme
getColourScheme theme =
    case theme of
        Light ->
            lightColourTheme

        Dark ->
            darkColourTheme


getColour : Theme -> (ColourScheme -> Color) -> Color
getColour theme colourAccessor =
    colourAccessor (getColourScheme theme)


getScheme : Shared.Model -> ColourScheme
getScheme shared =
    getColourScheme shared.theme
