diff options
Diffstat (limited to 'src/model/priority.py')
-rw-r--r-- | src/model/priority.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/model/priority.py b/src/model/priority.py new file mode 100644 index 0000000..873369d --- /dev/null +++ b/src/model/priority.py @@ -0,0 +1,30 @@ +from enum import IntEnum +from typing import Optional + +class Priority(IntEnum): + LOW = 0 + MEDIUM = 1 + HIGH = 2 + +values = [ + Priority.LOW, + Priority.MEDIUM, + Priority.HIGH] + +def format(priority: Priority) -> str: + if priority == Priority.LOW: + return 'Low' + elif priority == Priority.MEDIUM: + return 'Medium' + elif priority == Priority.HIGH: + return 'High' + +def parse(string: str) -> Optional[Priority]: + if string == 'Low': + return Priority.LOW + elif string == 'Medium': + return Priority.MEDIUM + elif string == 'High': + return Priority.HIGH + else: + return None |