2024-04-27 11:46:18 +00:00
|
|
|
import enum
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from simnet.models.starrail.chronicle.challenge import StarRailChallenge
|
2024-06-19 15:23:45 +00:00
|
|
|
from simnet.models.starrail.chronicle.challenge_boss import StarRailChallengeBoss, StarRailChallengeBossGroup
|
2024-04-27 11:46:18 +00:00
|
|
|
from simnet.models.starrail.chronicle.challenge_story import StarRailChallengeStory, StarRailChallengeStoryGroup
|
2024-05-24 12:31:53 +00:00
|
|
|
from simnet.models.starrail.diary import StarRailDiary
|
2024-04-27 11:46:18 +00:00
|
|
|
|
|
|
|
from gram_core.services.history_data.models import HistoryData
|
|
|
|
|
|
|
|
__all__ = (
|
|
|
|
"HistoryData",
|
|
|
|
"HistoryDataTypeEnum",
|
|
|
|
"HistoryDataAbyss",
|
|
|
|
"HistoryDataChallengeStory",
|
2024-06-19 15:23:45 +00:00
|
|
|
"HistoryDataChallengeBoss",
|
2024-05-24 12:31:53 +00:00
|
|
|
"HistoryDataLedger",
|
2024-04-27 11:46:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataTypeEnum(int, enum.Enum):
|
|
|
|
ABYSS = 0 # 混沌回忆
|
|
|
|
CHALLENGE_STORY = 1 # 虚构叙事
|
2024-05-24 12:31:53 +00:00
|
|
|
LEDGER = 2 # 开拓月历
|
2024-06-19 15:23:45 +00:00
|
|
|
CHALLENGE_BOSS = 3 # 末日幻影
|
2024-04-27 11:46:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataAbyss(BaseModel):
|
|
|
|
abyss_data: StarRailChallenge
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataAbyss":
|
|
|
|
return cls.parse_obj(data.data)
|
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataChallengeStory(BaseModel):
|
|
|
|
story_data: StarRailChallengeStory
|
|
|
|
group: StarRailChallengeStoryGroup
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataChallengeStory":
|
|
|
|
return cls.parse_obj(data.data)
|
2024-05-24 12:31:53 +00:00
|
|
|
|
|
|
|
|
2024-06-19 15:23:45 +00:00
|
|
|
class HistoryDataChallengeBoss(BaseModel):
|
|
|
|
boss_data: StarRailChallengeBoss
|
|
|
|
group: StarRailChallengeBossGroup
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataChallengeBoss":
|
|
|
|
return cls.parse_obj(data.data)
|
|
|
|
|
|
|
|
|
2024-05-24 12:31:53 +00:00
|
|
|
class HistoryDataLedger(BaseModel):
|
|
|
|
diary_data: StarRailDiary
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataLedger":
|
|
|
|
return cls.parse_obj(data.data)
|