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

import Config.Helpers.Response exposing (..)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Home.Background exposing (..)
import Config.Pages.Home.CardMaker.Helpers.Icon exposing (..)
import Config.Pages.Home.CardMaker.Helpers.Image exposing (..)
import Config.Pages.Home.CardMaker.Records exposing (..)
import Config.Pages.Home.CardMaker.Types exposing (..)
import Config.Pages.Home.Helpers exposing (..)
import Config.Style.Colour.Helpers exposing (..)
import Config.Style.Colour.Types exposing (Theme(..))
import Config.Style.Fonts exposing (..)
import Config.Style.Glow exposing (..)
import Config.Style.Icons.Icons exposing (..)
import Config.Style.Transitions exposing (..)
import Effect exposing (Effect)
import Element as E exposing (..)
import Element.Background as B exposing (..)
import Element.Border as D exposing (..)
import Element.Events as V
import Element.Font as F exposing (..)
import Html exposing (Html)
import Html.Attributes as Attr
import Page exposing (Page)
import Ports
import Route exposing (Route)
import Shared exposing (Model)
import Shared.Msg
import Svg.Attributes as SvgAttr exposing (clip)
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
        }



-- INIT


type alias Model =
    {}


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



-- UPDATE


type Msg
    = NoOp
    | ToggleTheme


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

        ToggleTheme ->
            ( model
            , Effect.sendSharedMsg Shared.Msg.ToggleTheme
            )



-- SUBSCRIPTIONS


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



-- VIEW


view : Shared.Model -> Model -> View Msg
view shared model =
    { title = ""
    , attributes = [ F.family [ headerFont ] ]
    , element = homePage shared (createFontSizes shared.fontScale)
    }


paddingHelper : Attribute msg
paddingHelper =
    padding 10


homePage : Shared.Model -> FontSizes Msg -> Element Msg
homePage shared fontSizes =
    E.el [] <| text "Hello world!"
