module Pages.Interviews exposing (Model, Msg, page)

import Config.Colour as T exposing (..)
import Config.Format as O exposing (..)
import Config.Identity as I exposing (..)
import Config.Response exposing (..)
import Config.Viewport exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Border as D
import Element.Font as F
import Headers.Helpers exposing (headerMaker)
import Headers.Pages.Interviews exposing (interviewHeader)
import Html
import Html.Attributes as H exposing (style)
import Interviews.Episodes.DrShawnBakerPodcast exposing (drShawnBakerPodcast)
import Interviews.Episodes.FitAndFurious exposing (fitAndFurious)
import Interviews.Episodes.FoolproofMastery exposing (foolproofMastery)
import Interviews.Episodes.KetogeeksPodcast exposing (ketoGeeksPodcast)
import Interviews.Episodes.LegendaryLifePodcast exposing (legendaryLifePodcast)
import Interviews.Episodes.MarkBellsPowerProject exposing (markBellsPowerProject)
import Interviews.Episodes.MuscleMemoirsPodcast exposing (muscleMemoirsPodcast)
import Interviews.Episodes.SigmaNutritionRadio exposing (sigmaNutritionRadio)
import Interviews.Episodes.StrenuousLifePodcast exposing (strenuousLifePodcast)
import Interviews.Helpers exposing (..)
import Layouts
import List exposing (head)
import Page exposing (Page)
import Route exposing (Route)
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 = pageNames.pageInterviews ++ " ( )"
    , attributes = []
    , element = interviewContainer shared.device
    }


interviewContainer : Device -> Element msg
interviewContainer device =
    topLevelContainer (interviewList device)


interviewList : Device -> Element msg
interviewList device =
    column
        (case ( device.class, device.orientation ) of
            _ ->
                pageListDesktop
        )
    <|
        List.concat
            [ List.map headerMaker
                [ interviewHeader ]
            , (case ( device.class, device.orientation ) of
                ( Phone, Portrait ) ->
                    List.map interviewMakerMobile

                ( Tablet, Portrait ) ->
                    List.map interviewMakerMobile

                _ ->
                    List.map interviewMaker
              )
                [ sigmaNutritionRadio
                , markBellsPowerProject
                , foolproofMastery
                , ketoGeeksPodcast
                , legendaryLifePodcast
                , muscleMemoirsPodcast
                , fitAndFurious
                , strenuousLifePodcast
                , drShawnBakerPodcast
                ]
            ]
