from datetime import datetime
from pydantic import BaseModel

class FlashcardDeckCreate(BaseModel):
    model_config = {"protected_namespaces": ()}

    section_id: int
    title: str
    model_id: str | None = None

class FlashcardResponse(BaseModel):
    id: int
    front: str
    back: str
    page_reference: int | None = None
    image_path: str | None = None
    class Config:
        from_attributes = True

class FlashcardDeckResponse(BaseModel):
    id: int
    title: str
    section_id: int | None = None
    user_id: int
    card_count: int
    created_at: datetime
    class Config:
        from_attributes = True

class FlashcardDeckDetail(FlashcardDeckResponse):
    cards: list[FlashcardResponse] = []
