""" Pydantic schemas for Author model. """ from typing import Optional from pydantic import BaseModel, EmailStr, Field class AuthorBase(BaseModel): """Base author schema.""" name: str = Field(..., min_length=1, max_length=100) email: EmailStr bio: Optional[str] = Field(None, max_length=1000) class AuthorCreate(AuthorBase): """Schema for creating a new author.""" pass class AuthorUpdate(BaseModel): """Schema for updating an author.""" name: Optional[str] = Field(None, min_length=1, max_length=100) email: Optional[EmailStr] = None bio: Optional[str] = Field(None, max_length=1000) class AuthorResponse(AuthorBase): """Schema for author response.""" id: int class Config: from_attributes = True