aboutsummaryrefslogtreecommitdiff
path: root/src/model/priority.py
blob: 76cfd62c2d99da6b4f7d568a8e3439d8df1a7f25 (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
from enum import IntEnum
from typing import Optional

class Priority(IntEnum):
    LOW = 0
    MIDDLE = 1
    HIGH = 2

values = [
    Priority.LOW,
    Priority.MIDDLE,
    Priority.HIGH]

def format(priority: Priority) -> str:
    if priority == Priority.LOW:
        return 'Low'
    elif priority == Priority.MIDDLE:
        return 'Middle'
    elif priority == Priority.HIGH:
        return 'High'

def parse(string: str) -> Optional[Priority]:
    if string == 'Low':
        return Priority.LOW
    elif string == 'Middle':
        return Priority.MIDDLE
    elif string == 'High':
        return Priority.HIGH
    else:
        return None