module Edition.Model exposing ( Edition , Kind(..) , newEdition , keyCodeToChar , isEmpty ) import String import Model.Id exposing (..) import Model.Keyboard exposing (KeyCode) import Edition.Model.Name as NameEdition import Edition.Model.Time as TimeEdition type alias Edition = { id : Id , kind : Kind , chars : List Char } type Kind = Name | Time newEdition id kind = { id = id , kind = kind , chars = [] } keyCodeToChar : Kind -> KeyCode -> Maybe Char keyCodeToChar kind = case kind of Name -> NameEdition.keyCodeToChar Time -> TimeEdition.keyCodeToChar isEmpty : Edition -> Bool isEmpty edition = edition.chars |> String.fromList |> String.trim |> String.length |> (==) 0