""" App A Schemas - Pydantic schemas for request/response validation. """ from typing import Optional from datetime import datetime from pydantic import BaseModel, Field, EmailStr class UserCreate(BaseModel): """Schema for creating a new user.""" username: str = Field(..., min_length=3, max_length=50) email: EmailStr password: str = Field(..., min_length=6) full_name: Optional[str] = Field(None, max_length=100) class Config: json_schema_extra = { "example": { "username": "john_doe", "email": "john@example.com", "password": "secret123", "full_name": "John Doe", } } class UserUpdate(BaseModel): """Schema for updating a user.""" email: Optional[EmailStr] = None full_name: Optional[str] = Field(None, max_length=100) is_active: Optional[bool] = None class Config: json_schema_extra = { "example": { "email": "newemail@example.com", "full_name": "John Smith", "is_active": True, } } class UserResponse(BaseModel): """Schema for user response.""" id: int username: str email: str full_name: Optional[str] is_active: bool created_at: datetime updated_at: datetime class Config: from_attributes = True json_schema_extra = { "example": { "id": 1, "username": "john_doe", "email": "john@example.com", "full_name": "John Doe", "is_active": True, "created_at": "2024-01-15T10:30:00Z", "updated_at": "2024-01-15T10:30:00Z", } }