module Config.Helpers.Headers.Helpers exposing (..)

import Config.Helpers.Converters exposing (formatName)
import Config.Helpers.Format
    exposing
        ( headerFontSizeBig
        , headerFontSizeMedium
        , headerFontSizeSmall
        , paragraphFontSize
        , paragraphSpacing
        )
import Config.Helpers.Headers.Types as C exposing (..)
import Config.Helpers.Response exposing (contentContainer)
import Config.Helpers.ServiceFormat exposing (divider)
import Config.Style.Colour.Helpers exposing (colourTheme)
import Config.Style.Glow
    exposing
        ( glowDeepDarkGrey
        , glowDeepDarkOrange
        )
import Config.Style.Icons.Icons exposing (construction)
import Config.Style.Transitions
    exposing
        ( hoverCircleButtonDarkOrange
        , transitionStyleMedium
        , transitionStyleSlow
        )
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html.Attributes as H
import Route.Path as Path exposing (..)
import Shared exposing (..)


headerMaker : Headerable msg -> Element msg
headerMaker headerable =
    let
        headerTitleMaker : String -> Element msg
        headerTitleMaker title =
            el
                [ headerFontSizeBig
                , F.bold
                , width fill
                , F.center
                ]
            <|
                paragraph [] [ text title ]

        headerHelper : String -> List (Element msg) -> Element msg
        headerHelper title body =
            el
                [ width (fill |> minimum 100)
                , width (fill |> maximum 725)
                , padding 10
                , centerX
                ]
            <|
                column
                    [ width fill
                    ]
                    [ headerTitleMaker title
                    , divider
                    , el
                        [ E.height fill
                        , E.width fill
                        , centerX
                        , spacing 8
                        , paddingEach
                            { top = 10
                            , bottom = 0
                            , left = 0
                            , right = 0
                            }
                        ]
                      <|
                        el
                            [ paddingEach
                                { top = 0
                                , bottom = 0
                                , left = 15
                                , right = 15
                                }
                            , spacing 8
                            , width fill
                            ]
                        <|
                            paragraph
                                [ width fill
                                , headerFontSizeSmall
                                , F.center
                                ]
                            <|
                                body
                    ]
    in
    case headerable of
        C.Arguments argument ->
            headerHelper argument.headerTitle argument.headerBody

        C.BlogPage blog ->
            headerHelper blog.headerTitle blog.headerBody

        C.CuckList cuck ->
            headerHelper cuck.headerTitle cuck.headerBody

        C.Debate debate ->
            headerHelper debate.headerTitle debate.headerBody

        C.Donate donate ->
            headerHelper donate.headerTitle donate.headerBody

        C.Gibberish gibberish ->
            headerHelper gibberish.headerTitle gibberish.headerBody

        C.Services service ->
            headerHelper service.headerTitle service.headerBody

        C.Interviews interview ->
            headerHelper interview.headerTitle interview.headerBody

        C.NutriDex nutriDex ->
            headerHelper nutriDex.headerTitle nutriDex.headerBody

        C.Contact contact ->
            headerHelper contact.headerTitle contact.headerBody


cardContentMaker : List (Element msg) -> Element msg
cardContentMaker content =
    column
        [ spacing 8
        , width fill
        ]
        content


cardStuff : Element msg -> Element msg
cardStuff content =
    el
        [ E.height fill
        , E.width fill
        , centerX
        , spacing 8
        ]
    <|
        el
            [ paddingEach
                { top = 0
                , bottom = 0
                , left = 15
                , right = 15
                }
            , spacing 8
            , width fill
            ]
            content
