module Config.Helpers.ServiceFormat exposing (..)

import Config.Data.Identity exposing (pageNames)
import Config.Helpers.Cards.Inner.Helpers exposing (detailSpacing)
import Config.Helpers.Format
    exposing
        ( headerFontSizeBig
        , headerFontSizeMedium
        , headerFontSizeSmall
        , paragraphFontSize
        , paragraphSpacing
        )
import Config.Style.Colour.Helpers exposing (colourTheme)
import Config.Style.Transitions
    exposing
        ( hoverFontDarkOrange
        , transitionStyleFast
        , transitionStyleSlow
        )
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
import Element.Font as F


bodyFormat : List (Attribute msg)
bodyFormat =
    [ spacing 10
    , paddingEach
        { top = 10
        , bottom = 0
        , left = 0
        , right = 0
        }
    ]


chunkMaker : List (Element msg) -> Element msg
chunkMaker elements =
    paragraph
        [ F.color colourTheme.textLightGrey
        , detailSpacing
        , paragraphFontSize
        , F.alignLeft
        , width fill
        ]
        elements


titleMaker : String -> Element msg
titleMaker title =
    el
        [ paragraphSpacing
        , headerFontSizeMedium
        , F.bold
        , F.center
        , width fill
        , F.color colourTheme.textLightOrange
        , paddingEach
            { top = 20
            , bottom = 10
            , left = 0
            , right = 0
            }
        ]
    <|
        text title


subTitleMaker : String -> Element msg
subTitleMaker item =
    el
        [ alignTop
        , F.color colourTheme.textLightOrange
        , paragraphSpacing
        , F.bold
        , headerFontSizeSmall
        , E.width fill
        ]
    <|
        E.text item


highlightedBlockMaker : String -> List String -> Element msg
highlightedBlockMaker title items =
    column
        [ paddingEach
            { top = 15
            , bottom = 15
            , left = 20
            , right = 20
            }
        , B.color colourTheme.backgroundLightGrey
        , D.rounded 10
        , width fill
        , spacing 8
        ]
        [ paragraph
            [ F.bold
            , headerFontSizeSmall
            ]
            [ text title ]
        , column
            []
          <|
            List.indexedMap
                (\index item ->
                    row
                        [ spacing 10
                        , width fill
                        ]
                        [ column
                            [ width <| px 30
                            , alignTop
                            ]
                            [ el
                                [ alignRight
                                , headerFontSizeSmall
                                ]
                              <|
                                text "• "
                            ]
                        , column
                            [ spacing 10
                            , width fill
                            , alignRight
                            ]
                            [ paragraph
                                [ width fill
                                , paragraphFontSize
                                , F.alignLeft
                                ]
                                [ row
                                    [ alignLeft ]
                                    [ paragraph [ alignLeft ]
                                        [ text item
                                        ]
                                    ]
                                ]
                            ]
                        ]
                )
                items
        ]


textEntry : String -> Element msg
textEntry item =
    el
        [ alignLeft ]
    <|
        paragraph [] [ text item ]


bulletPointMaker : List String -> Element msg
bulletPointMaker items =
    column [ spacing 10 ] <|
        List.indexedMap
            (\index item ->
                row
                    [ spacing 10
                    , width fill
                    ]
                    [ column
                        [ width <| px 30
                        , alignTop
                        ]
                        [ el
                            [ alignRight
                            , headerFontSizeSmall
                            ]
                          <|
                            text "• "
                        ]
                    , column
                        [ spacing 10
                        , width fill
                        , alignRight
                        ]
                        [ paragraph
                            [ width fill
                            , paragraphFontSize
                            , F.alignLeft
                            ]
                            [ el
                                [ alignLeft ]
                              <|
                                paragraph [ alignLeft ]
                                    [ text item
                                    ]
                            ]
                        ]
                    ]
            )
            items


numberMaker : List String -> Element msg
numberMaker items =
    column [ spacing 10 ] <|
        List.indexedMap
            (\index item ->
                row
                    [ spacing 10
                    , width fill
                    ]
                    [ column
                        [ width <| px 30
                        , alignTop
                        ]
                        [ el
                            [ alignRight ]
                          <|
                            text (String.fromInt (index + 1) ++ ". ")
                        ]
                    , column
                        [ spacing 10
                        , width fill
                        , alignRight
                        ]
                        [ paragraph
                            [ width fill
                            , paragraphFontSize
                            , F.alignLeft
                            ]
                            [ el
                                [ alignLeft ]
                              <|
                                paragraph [ alignLeft ]
                                    [ text item
                                    ]
                            ]
                        ]
                    ]
            )
            items


divider : Element msg
divider =
    el
        [ width fill
        , height fill
        , centerX
        , width (fill |> maximum 600)
        , D.widthEach
            { bottom = 1
            , top = 0
            , left = 0
            , right = 0
            }
        , D.color colourTheme.textLightOrange
        , paddingEach
            { top = 10
            , bottom = 0
            , left = 0
            , right = 0
            }
        ]
    <|
        none
