from pydantic import BaseModel, Field from datetime import date class TaskCreate(BaseModel): title: str = Field(..., min_length=1, max_length=255) description: str = Field(None, min_length=0, max_length=1000) due_date: date = Field(None) status: str = Field('pending', regex='^(pending|completed)$') class TaskResponse(BaseModel): id: int title: str description: str due_date: date status: str class Config: from_attributes = True