2024-04-27 10:13:54 +00:00
|
|
|
import enum
|
|
|
|
from typing import Dict
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from simnet.models.genshin.chronicle.abyss import SpiralAbyss
|
2024-07-29 11:06:00 +00:00
|
|
|
from simnet.models.genshin.chronicle.img_theater import ImgTheaterData
|
2024-05-24 09:40:09 +00:00
|
|
|
from simnet.models.genshin.diary import Diary
|
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-07-29 11:06:00 +00:00
|
|
|
"HistoryDataImgTheater",
|
2024-04-27 10:13:54 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataTypeEnum(int, enum.Enum):
|
|
|
|
ABYSS = 0 # 深境螺旋
|
2024-05-24 09:40:09 +00:00
|
|
|
LEDGER = 2 # 开拓月历
|
2024-07-29 11:06:00 +00:00
|
|
|
ROLE_COMBAT = 3 # 幻想真境剧诗
|
2024-04-27 10:13:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataAbyss(BaseModel):
|
|
|
|
abyss_data: SpiralAbyss
|
|
|
|
character_data: Dict[int, int]
|
|
|
|
|
|
|
|
@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):
|
|
|
|
diary_data: Diary
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataLedger":
|
2024-04-27 10:13:54 +00:00
|
|
|
return cls.parse_obj(data.data)
|
2024-07-29 11:06:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
class HistoryDataImgTheater(BaseModel):
|
|
|
|
abyss_data: ImgTheaterData
|
|
|
|
character_data: Dict[int, int]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_data(cls, data: HistoryData) -> "HistoryDataImgTheater":
|
|
|
|
return cls.parse_obj(data.data)
|