From f96cd1667ccac073f56a914080f091a58ecce3aa Mon Sep 17 00:00:00 2001 From: Konard Date: Sat, 30 Sep 2023 12:24:40 -0500 Subject: [PATCH] convert statuses to enum --- genshin/models/genshin/chronicle/notes.py | 31 ++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/genshin/models/genshin/chronicle/notes.py b/genshin/models/genshin/chronicle/notes.py index 665f77d6..67aee11a 100644 --- a/genshin/models/genshin/chronicle/notes.py +++ b/genshin/models/genshin/chronicle/notes.py @@ -1,5 +1,6 @@ """Genshin chronicle notes.""" import datetime +import enum import typing if typing.TYPE_CHECKING: @@ -73,24 +74,32 @@ def seconds(self) -> int: return self.timedata[3] +class TaskRewardStatus(str, enum.Enum): + """Task Reward Statuses.""" + + UNFINISHED = "TaskRewardStatusUnfinished" + FINISHED = "TaskRewardStatusFinished" + + class TaskReward(APIModel): """Status of the Commission/Task.""" - status: typing.Literal[ - "TaskRewardStatusTakenAward", - "TaskRewardStatusUnfinished" - ] + status: TaskRewardStatus + + +class AttendanceRewardStatus(str, enum.Enum): + """Attendance Reward Statuses.""" + + AVAILABLE = "AttendanceRewardStatusWaitTaken" + COLLECTED = "AttendanceRewardStatusTakenAward" + FORBIDDEN = "AttendanceRewardStatusForbid" + UNAVAILABLE = "AttendanceRewardStatusUnfinished" class AttendanceReward(APIModel): """Status of the Encounter Point.""" - status: typing.Literal[ - "TaskRewardStatusTakenAward", - "AttendanceRewardStatusTakenAward", - "AttendanceRewardStatusWaitTaken", - "AttendanceRewardStatusUnfinished" - ] + status: AttendanceRewardStatus progress: int @@ -102,9 +111,7 @@ class DailyTasks(APIModel): claimed_commission_reward: bool = Aliased("is_extra_task_reward_received") task_rewards: typing.Sequence[TaskReward] - attendance_rewards: typing.Sequence[AttendanceReward] - attendance_visible: bool