"""Tarot Pydantic 모델 — agent-office models.py에서 추출."""
from typing import List, Literal, Optional

from pydantic import BaseModel, Field


class TarotCardDraw(BaseModel):
    position: str
    card_id: str
    reversed: bool = False


class TarotInterpretRequest(BaseModel):
    spread_type: Literal["one_card", "three_card"]
    category: Optional[str] = None
    question: Optional[str] = None
    cards: List[TarotCardDraw]
    cards_reference: str = Field(..., min_length=1)
    context_meta: dict = Field(default_factory=dict)


class TarotInterpretResponse(BaseModel):
    interpretation_json: dict
    model: str
    tokens_in: int
    tokens_out: int
    cost_usd: float
    latency_ms: int
    reroll_count: int = 0


class TarotSaveRequest(BaseModel):
    spread_type: Literal["one_card", "three_card"]
    category: Optional[str] = None
    question: Optional[str] = None
    cards: List[TarotCardDraw]
    interpretation_json: dict
    model: str
    tokens_in: int
    tokens_out: int
    cost_usd: float
    confidence: Optional[str] = None


class TarotPatchRequest(BaseModel):
    favorite: Optional[bool] = None
    note: Optional[str] = None
