aboutsummaryrefslogtreecommitdiff
path: root/todo/model/status.py
blob: 6881e0a1305820f709c692091805b3988a0aae41 (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 Status(IntEnum):
    READY = 0
    WAITING = 1
    MAYBE = 2

values = [
    Status.READY,
    Status.WAITING,
    Status.MAYBE]

def format(status: Status) -> str:
    if status == Status.READY:
        return "Ready"
    elif status == Status.WAITING:
        return "Waiting"
    elif status == Status.MAYBE:
        return "Maybe"

def parse(string: str) -> Optional[Status]:
    if string == "Ready":
        return Status.READY
    elif string == "Waiting":
        return Status.WAITING
    elif string == "Maybe":
        return Status.MAYBE
    else:
        return None