from datetime import datetime from pydantic import BaseModel, Field # Shared properties class GenreBase(BaseModel): name: str = Field(..., min_length=1, max_length=50, description="Name of the genre") description: str | None = Field(None, description="Description of the genre") # Properties to receive on genre creation class GenreCreate(GenreBase): pass # Properties to receive on genre update class GenreUpdate(GenreBase): name: str | None = Field(None, min_length=1, max_length=50, description="Name of the genre") # Properties shared by models stored in DB class GenreInDBBase(GenreBase): id: int created_at: datetime updated_at: datetime class Config: orm_mode = True # Properties to return to client class Genre(GenreInDBBase): pass # Properties properties stored in DB class GenreInDB(GenreInDBBase): pass