from typing import Optional from datetime import datetime from pydantic import BaseModel, Field # Shared properties class TodoBase(BaseModel): title: str = Field(..., min_length=1, max_length=100) description: Optional[str] = Field(None, max_length=500) completed: bool = False # Properties to receive on todo creation class TodoCreate(TodoBase): pass # Properties to receive on todo update class TodoUpdate(BaseModel): title: Optional[str] = Field(None, min_length=1, max_length=100) description: Optional[str] = Field(None, max_length=500) completed: Optional[bool] = None # Properties to return to client class TodoResponse(TodoBase): id: int created_at: datetime updated_at: datetime class Config: from_attributes = True