module Init exposing
  ( Init
  , decoder
  )

import Time exposing (..)

import Json.Decode as Json exposing ((:=))

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 : Json.Decoder Init
decoder =
  Json.object5 Init
    ("time" := Json.float)
    ("translations" := translationsDecoder)
    ("conf" := confDecoder)
    ("result" := initResultDecoder)
    ("windowSize" := sizeDecoder)