MibooGram/core/services/history_data/models.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
887 B
Python
Raw Permalink Normal View History

2024-04-27 10:13:54 +00:00
import enum
from pydantic import BaseModel
2024-09-25 15:15:46 +00:00
from simnet.models.zzz.diary import ZZZDiary
2024-07-15 08:32:25 +00:00
from simnet.models.zzz.chronicle.challenge import ZZZChallenge
2024-04-27 10:13:54 +00:00
from gram_core.services.history_data.models import HistoryData
__all__ = (
"HistoryData",
"HistoryDataTypeEnum",
"HistoryDataAbyss",
2024-05-24 09:40:09 +00:00
"HistoryDataLedger",
2024-04-27 10:13:54 +00:00
)
class HistoryDataTypeEnum(int, enum.Enum):
2024-07-15 08:32:25 +00:00
ABYSS = 0 # 混沌回忆
CHALLENGE_STORY = 1 # 虚构叙事
2024-05-24 09:40:09 +00:00
LEDGER = 2 # 开拓月历
2024-07-15 08:32:25 +00:00
CHALLENGE_BOSS = 3 # 末日幻影
2024-04-27 10:13:54 +00:00
class HistoryDataAbyss(BaseModel):
2024-07-15 08:32:25 +00:00
abyss_data: ZZZChallenge
2024-04-27 10:13:54 +00:00
@classmethod
2024-05-24 09:40:09 +00:00
def from_data(cls, data: HistoryData) -> "HistoryDataAbyss":
return cls.parse_obj(data.data)
class HistoryDataLedger(BaseModel):
2024-09-25 15:15:46 +00:00
diary_data: ZZZDiary
2024-05-24 09:40:09 +00:00
@classmethod
def from_data(cls, data: HistoryData) -> "HistoryDataLedger":
2024-04-27 10:13:54 +00:00
return cls.parse_obj(data.data)