from pydantic import BaseModel, Field
from typing import Optional, List
from datetime import datetime
from uuid import UUID

class BookBase(BaseModel):
    title: str = Field(..., min_length=1, max_length=500)
    author: Optional[str] = Field(None, max_length=255)
    description: Optional[str] = None
    language: str = Field("ko", max_length=10)
    is_public: bool = False

class CreateBookRequest(BookBase):
    pass

class UpdateBookRequest(BookBase):
    pass

class BookResponse(BookBase):
    id: UUID
    created_at: datetime
    updated_at: Optional[datetime]
    document_count: int = 0 # 문서 개수 추가

    class Config:
        from_attributes = True

class BookSearchResponse(BookResponse):
    pass

class BookSuggestionResponse(BookResponse):
    similarity_score: float = Field(..., ge=0.0, le=1.0)