module Pages.Services.Nutrition exposing (Model, Msg, page)

import Config.Helpers.Articles.Article exposing (contentList)
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Outer.Types as C
import Config.Helpers.Format exposing (..)
import Config.Helpers.Headers.Helpers exposing (..)
import Config.Helpers.Headers.Types exposing (Header)
import Config.Helpers.Price exposing (buyButton)
import Config.Helpers.Response
    exposing
        ( pageList
        , topLevelContainer
        )
import Config.Helpers.ServiceFormat exposing (..)
import Config.Helpers.ToolTip exposing (..)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Blog.Types exposing (BlogArticle)
import Config.Pages.Services.Records.NutritionScience exposing (servicesNutritionScience)
import Config.Style.Colour.Helpers exposing (colourTheme)
import Config.Style.Transitions
    exposing
        ( hoverFontDarkOrange
        , transitionStyleFast
        , transitionStyleSlow
        )
import Effect exposing (Effect)
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html
import Html.Attributes as H exposing (style)
import Layouts
import Page exposing (Page)
import Route exposing (Route)
import Route.Path as Path
import Shared
import View exposing (View)


page : Shared.Model -> Route () -> Page Model Msg
page shared route =
    Page.new
        { init = init
        , update = update
        , subscriptions = subscriptions
        , view = view shared
        }
        |> Page.withLayout toLayout


toLayout : Model -> Layouts.Layout Msg
toLayout model =
    Layouts.Navbar {}



-- INIT


type alias Model =
    {}


init : () -> ( Model, Effect Msg )
init () =
    ( {}
    , Effect.map
        (\_ -> NoOp)
        (Effect.sendCmd resetViewport)
    )



-- UPDATE


type Msg
    = NoOp


update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
    case msg of
        NoOp ->
            ( model
            , Effect.none
            )



-- SUBSCRIPTIONS


subscriptions : Model -> Sub Msg
subscriptions model =
    Sub.none



-- VIEW


view : Shared.Model -> Model -> View Msg
view shared model =
    { title = "services (nutritionChat)"
    , attributes = []
    , element = nutritionContainer shared.device
    }


nutritionContainer : Device -> Element msg
nutritionContainer device =
    topLevelContainer (nutritionList device)


nutritionList : Device -> Element msg
nutritionList device =
    column
        (case ( device.class, device.orientation ) of
            _ ->
                pageList device
        )
    <|
        List.concat
            [ List.map
                (\service ->
                    cardMaker device
                        (C.BlogArticle service)
                        (contentList service
                            [ el
                                [ paddingXY 0 10
                                , centerX
                                ]
                              <|
                                buyButton "Book!" "https://buy.stripe.com/5kA5lz77pdJq6J28wz"
                            ]
                        )
                )
                [ nutritionQA ]
            ]


nutritionQA : BlogArticle
nutritionQA =
    { articleName = String.toUpper "Nutrition Q&A"
    , articleLink = ""
    , articleAuthor = ""
    , isNewTabLink = False
    , hasReferences = False
    , hasTableOfContents = False
    , articleImage = ""
    , articlePublished = ""
    , articleBody = """
This service is designed to help those interested in honing their nutrition science knowledge and boosting their intuition when reading nutrition science literature. Whether the client's goals are to achieve their academic ambitions, satisfy their personal curiosity, or improve their empirical debate chops. The client is free to guide the session in any direction they choose, so long as it is relevant to nutrition science.

# BENEFITS

1. One hour to ask me anything about nutrition science.

2. Access to nutrition science evaluation cheat sheets.

3. Sharper nutrition science critical appraisal skills.

# REQUIREMENTS

• A list of five clear questions related to nutrition science.

"""
    , articleReferences =
        [ { author = ""
          , title = ""
          , journal = ""
          , year = ""
          , link = ""
          }
        ]
    }
