150 lines
4.9 KiB
Python
150 lines
4.9 KiB
Python
from datetime import date
|
|
from typing import Literal, Optional
|
|
|
|
from pydantic import Field
|
|
|
|
from common.models.gmodel import Req_WebPacketProtocol, Res_WebPacketProtocol, WebPacketProtocol
|
|
|
|
|
|
class Req_Saju(Req_WebPacketProtocol):
|
|
region_code: str = Field(min_length=10, max_length=10)
|
|
birth_date: date = Field(description="양력 생년월일 (1900-01-01 ~ 오늘)")
|
|
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$", description="태어난 시각 HH:MM (모르면 없음)")
|
|
longitude: float = Field(126.98, ge=124, le=132, description="태어난 곳 경도 (시각 보정)")
|
|
gender: Optional[Literal["male", "female"]] = Field(None, description="연애운에서 이성 기운을 볼 때만")
|
|
|
|
|
|
class SajuSavedBirth(WebPacketProtocol):
|
|
birth_date: date
|
|
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$", description="HH:MM (모르면 없음)")
|
|
place: Optional[str] = Field(None, pattern=r"^[a-z]{2,20}$", description="태어난 곳 키 (seoul 등)")
|
|
gender: Optional[Literal["male", "female"]] = None
|
|
|
|
|
|
class Req_SajuBirth(Req_WebPacketProtocol, SajuSavedBirth):
|
|
pass
|
|
|
|
|
|
class Res_SajuBirth(Res_WebPacketProtocol):
|
|
birth: Optional[SajuSavedBirth] = None
|
|
|
|
|
|
class SajuPillar(WebPacketProtocol):
|
|
position: str = Field(description="year·month·day·hour")
|
|
stem: str
|
|
branch: str
|
|
stem_ko: str
|
|
branch_ko: str
|
|
stem_element: str = Field(description="木火土金水")
|
|
branch_element: str
|
|
|
|
|
|
class SajuMe(WebPacketProtocol):
|
|
pillars: list[SajuPillar]
|
|
hour_known: bool
|
|
jeol_warning: bool = Field(description="시각을 모르는데 태어난 날 절이 들어 연·월주가 갈릴 수 있음")
|
|
scene: str = Field(description="내 기운 이름 (예: 봄비 기운)")
|
|
scene_desc: str
|
|
scene_icon: str
|
|
season: Optional[str] = None
|
|
climate: Optional[str] = Field(None, description="따뜻·마름 / 따뜻·촉촉 / 서늘·마름 / 서늘·촉촉")
|
|
need: list[str] = Field([], description="내 기운에 필요한 것 (따뜻함·마른 공기 등)")
|
|
|
|
|
|
class SajuCard(WebPacketProtocol):
|
|
kind: str = Field(description="when·do·avoid·good·wear")
|
|
title: str
|
|
body: str
|
|
sub: Optional[str] = None
|
|
|
|
|
|
class SajuToday(WebPacketProtocol):
|
|
day: date
|
|
pillar: str = Field(description="오늘 간지 한글 (을해)")
|
|
ten_god: str
|
|
title: str
|
|
score: int = Field(description="오늘 점수 = 사주 + 날씨 궁합")
|
|
saju_score: int
|
|
weather_points: Optional[int] = Field(None, description="날씨 궁합이 더하거나 뺀 점수")
|
|
why: list[str] = Field([], description="점수에 크게 작용한 사실")
|
|
cards: list[SajuCard]
|
|
|
|
|
|
class SajuDay(WebPacketProtocol):
|
|
day: date
|
|
weekday: str
|
|
icon: Optional[str] = None
|
|
word: Optional[str] = None
|
|
temp_min: Optional[int] = None
|
|
temp_max: Optional[int] = None
|
|
score: int
|
|
title: str
|
|
best: bool = False
|
|
|
|
|
|
class SajuLoveDay(WebPacketProtocol):
|
|
day: date
|
|
weekday: str
|
|
icon: Optional[str] = None
|
|
word: Optional[str] = None
|
|
temp_max: Optional[int] = None
|
|
body: str
|
|
why: str
|
|
|
|
|
|
class SajuLove(WebPacketProtocol):
|
|
good: Optional[SajuLoveDay] = None
|
|
caution: Optional[SajuLoveDay] = None
|
|
gender_known: bool
|
|
|
|
|
|
class SajuPeriod(WebPacketProtocol):
|
|
label: str = Field(description="이달 · 10/8 한로 ~ 11/7 / 2026년")
|
|
pillar: str
|
|
ten_god: str
|
|
title: str
|
|
body: str
|
|
notes: list[str] = []
|
|
months: list[int] = Field([], description="올해: 잘 맞는 달 (양력 달)")
|
|
|
|
|
|
class SajuLock(WebPacketProtocol):
|
|
key: str
|
|
name: str
|
|
level: int
|
|
unlocked: bool
|
|
|
|
|
|
class Res_Saju(Res_WebPacketProtocol):
|
|
me: Optional[SajuMe] = None
|
|
today: Optional[SajuToday] = None
|
|
week: Optional[list[SajuDay]] = Field(None, description="레벨 2부터")
|
|
money: Optional[list[str]] = Field(None, description="레벨 3부터: 이번 주 돈을 정할 날·피할 날")
|
|
work: Optional[list[str]] = None
|
|
love: Optional[SajuLove] = Field(None, description="레벨 4부터")
|
|
month: Optional[SajuPeriod] = Field(None, description="레벨 6부터")
|
|
year: Optional[SajuPeriod] = Field(None, description="레벨 7부터")
|
|
level: int = 1
|
|
logged_in: bool = False
|
|
locks: list[SajuLock] = []
|
|
|
|
|
|
class SajuBirth(WebPacketProtocol):
|
|
birth_date: date
|
|
birth_time: Optional[str] = Field(None, pattern=r"^([01]\d|2[0-3]):[0-5]\d$")
|
|
longitude: float = Field(126.98, ge=124, le=132)
|
|
|
|
|
|
class Req_SajuMatch(Req_WebPacketProtocol):
|
|
region_code: str = Field(min_length=10, max_length=10)
|
|
me: SajuBirth
|
|
friend: SajuBirth
|
|
|
|
|
|
class Res_SajuMatch(Res_WebPacketProtocol):
|
|
score: Optional[int] = None
|
|
title: Optional[str] = None
|
|
lines: list[str] = []
|
|
friend_scene: Optional[str] = Field(None, description="친구의 기운 이름")
|
|
day: Optional[SajuDay] = Field(None, description="이번 주 둘 다 좋은 날")
|