module Model.Model ( Model , initialModel , substractTimersTime ) where import Dict (Dict) import Dict import Time (Time) import Model.Timer (..) import Model.Id (..) import Model.IdGenerator (..) type alias Model = { currentTime : Time , newTimerName : String , timers : Dict Id Timer , timerIdGenerator : IdGenerator } initialModel : Time -> Model initialModel initialTime = let (id, idGenerator) = getId initialIdGenerator in { currentTime = initialTime , newTimerName = "" , timers = Dict.insert id (initialTimer initialTime "Timer") Dict.empty , timerIdGenerator = idGenerator } substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer substractTimersTime t timers = Dict.map (\id timer -> substractTimerTime t timer) timers