module Model.Model ( Model , initialModel , numberOfTimers ) where import Dict (Dict) import Dict import Time (Time) import List import Model.Timer (..) import Model.TimerEdition (..) import Model.Id (..) import Model.IdGenerator (..) type alias Model = { currentTime : Time , timers : Dict Id Timer , timerIdGenerator : IdGenerator , timerEdition : Maybe TimerEdition } initialModel : Time -> Model initialModel initialTime = let (id, idGenerator) = getId initialIdGenerator timerName = "Timer " ++ (toString id) in { currentTime = initialTime , timers = Dict.insert id (initialTimer initialTime timerName) Dict.empty , timerIdGenerator = idGenerator , timerEdition = Nothing } numberOfTimers : Model -> Int numberOfTimers = List.length << Dict.toList << .timers