mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 10:58:26 +00:00
62 lines
779 B
Elm
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 ]
|