2024-11-30 11:27:32 +00:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
|
|
|
|
class AlertCategory(Enum):
|
|
|
|
HIGH = 1
|
|
|
|
LOW = 2
|
|
|
|
CUSTOM = 3
|
|
|
|
|
|
|
|
@staticmethod
|
2024-12-09 01:07:26 +00:00
|
|
|
def from_str(
|
|
|
|
category: str,
|
|
|
|
): # It gets mad when I use the Type[AlertCategory] as a type hint
|
2024-11-30 11:27:32 +00:00
|
|
|
match category:
|
|
|
|
case "high_alert_button":
|
|
|
|
return AlertCategory.HIGH
|
|
|
|
case "low_alert_button":
|
|
|
|
return AlertCategory.LOW
|
|
|
|
case "sp_add_button":
|
|
|
|
return AlertCategory.CUSTOM
|
|
|
|
case _:
|
2024-12-09 01:07:26 +00:00
|
|
|
return AlertCategory[category.upper()]
|