from datetime import datetime from typing import Optional from pydantic import BaseModel class TodoBase(BaseModel): """Base schema for Todo items""" title: str description: Optional[str] = None completed: bool = False class TodoCreate(TodoBase): """Schema for creating a new Todo item""" # No need to include owner_id here as it will be set from the current user class TodoUpdate(BaseModel): """Schema for updating a Todo item""" title: Optional[str] = None description: Optional[str] = None completed: Optional[bool] = None class TodoInDBBase(TodoBase): """Base schema for Todo items from the database""" id: int owner_id: int created_at: datetime updated_at: datetime class Config: from_attributes = True class Todo(TodoInDBBase): """Schema for Todo items returned from the API""" pass