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

import Config.Helpers.Articles.Article exposing (contentList)
import Config.Helpers.Articles.Markdown as Markdown
import Config.Helpers.Cards.Inner.BuyButton exposing (buyButton)
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Outer.Types as C exposing (Cardable(..))
import Config.Helpers.Headers.Types exposing (Header)
import Config.Helpers.Response
    exposing
        ( pageList
        , topLevelContainer
        )
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Blogs.Types exposing (BlogArticle)
import Config.Pages.Services.Records.DebateAnalysis exposing (servicesDebateAnalysis)
import Config.Style.Colour.Helpers exposing (colourTheme)
import Effect exposing (Effect)
import Element as E
    exposing
        ( Device
        , DeviceClass(..)
        , Element
        , Orientation(..)
        , centerX
        , column
        , el
        , paddingXY
        )
import Layouts
import Page exposing (Page)
import Ports
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
    | MarkdownMsg Markdown.Msg


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

        MarkdownMsg (Markdown.ScrollToElement elementId) ->
            ( model
            , Effect.sendCmd (Ports.scrollToElement elementId)
            )



-- SUBSCRIPTIONS


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



-- VIEW


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


analysisContainer : Device -> Element Msg
analysisContainer device =
    topLevelContainer (analysisList device)


analysisList : Device -> Element Msg
analysisList 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/14k3dr4Zh8p6c3mbIJ"
                            ]
                            MarkdownMsg
                        )
                )
                [ debateAnalysis ]
            ]


debateAnalysis : BlogArticle
debateAnalysis =
    { articleName = String.toUpper "Debate Analysis"
    , articleLink = ""
    , articleAuthor = ""
    , isNewTabLink = False
    , hasReferences = False
    , hasTableOfContents = False
    , articleImage = ""
    , articlePublished = ""
    , articleBody = """
The Debate Analysis services offers personalized feedback to help you improve your debate skills. I work with clients by reviewing their pre-recorded debates, providing detailed critiques, and offering practical advice tailored to their style. Through this process, you'll gain valuable insights into areas of improvement, from your argument structure to your delivery and confidence.

# BENEFITS

1. Have your own debates analyzed for constructive feedback. This allows you to receive targeted guidance on how to improve your debating technique and strategy.

2. Receive advice to improve as a debater. This service provides personalized recommendations to help you develop and refine your debating abilities.

3. Gain comfort with debate and verbal confrontation. The service aims to help you become more confident and adept at handling the challenges of public debate.

# REQUIREMENTS

• Your debate recording must be submitted at least three days prior to the session.

• Your debate recording must not exceed one hour in length unless otherwise agreed to.

• Your debate recording must be in either video or audio format, as text debates are ineligible.

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