from pydantic import BaseModel, Field from typing import Optional from datetime import datetime import uuid # Base schema for Todo, used for inheritance class TodoBase(BaseModel): title: str = Field(..., description="Title of the todo") description: Optional[str] = Field(None, description="Description of the todo") is_completed: bool = Field(False, description="Whether the todo is completed or not") # Schema for creating a new Todo class TodoCreate(TodoBase): pass # Schema for updating an existing Todo class TodoUpdate(TodoBase): title: Optional[str] = Field(None, description="Title of the todo") description: Optional[str] = Field(None, description="Description of the todo") is_completed: Optional[bool] = Field(None, description="Whether the todo is completed or not") # Schema for representing a Todo in responses class TodoSchema(TodoBase): id: uuid.UUID created_at: datetime updated_at: datetime class Config: orm_mode = True