module Init exposing
  ( Init
  , decoder
  )

import Time exposing (..)

import Json.Decode as Decode exposing (Decoder)

import Model.Translations exposing (..)
import Model.Conf exposing (..)
import Model.InitResult exposing (..)
import Model.Size exposing (..)

type alias Init =
  { time : Time
  , translations : Translations
  , conf : Conf
  , result : InitResult
  , windowSize : Size
  }

decoder : Decoder Init
decoder =
  Decode.map5 Init
    (Decode.field "time" Decode.float)
    (Decode.field "translations" translationsDecoder)
    (Decode.field "conf" confDecoder)
    (Decode.field "result" initResultDecoder)
    (Decode.field "windowSize" sizeDecoder)