aboutsummaryrefslogtreecommitdiff
path: root/src/Model/Model.elm
blob: fa97d7bf1d23b6ce9e7064481cc4b91f57b66eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 =
  { currentTime = initialTime
  , newTimerName = ""
  , timers = Dict.empty
  , timerIdGenerator = initialIdGenerator
  }

substractTimersTime : Time -> Dict Id Timer -> Dict Id Timer
substractTimersTime t timers =
  Dict.map (\id timer -> substractTimerTime t timer) timers