Files
docspell/modules/webapp/src/main/elm/Data/Priority.elm
2021-07-25 14:00:11 +02:00

62 lines
779 B
Elm

{-
Copyright 2020 Docspell Contributors
SPDX-License-Identifier: GPL-3.0-or-later
-}
module Data.Priority exposing
( Priority(..)
, all
, fromString
, next
, toName
)
type Priority
= High
| Low
fromString : String -> Maybe Priority
fromString str =
let
s =
String.toLower str
in
case s of
"low" ->
Just Low
"high" ->
Just High
_ ->
Nothing
toName : Priority -> String
toName lang =
case lang of
Low ->
"Low"
High ->
"High"
next : Priority -> Priority
next prio =
case prio of
High ->
Low
Low ->
High
all : List Priority
all =
[ Low, High ]