from pydantic import BaseModel, EmailStr, Field from typing import Optional from datetime import datetime class UserBase(BaseModel): email: EmailStr username: str = Field(..., min_length=3, max_length=50) class UserCreate(UserBase): password: str = Field(..., min_length=8) class UserLogin(BaseModel): email: EmailStr password: str class UserUpdate(BaseModel): email: Optional[EmailStr] = None username: Optional[str] = Field(None, min_length=3, max_length=50) class User(UserBase): id: int is_active: bool created_at: datetime updated_at: Optional[datetime] = None class Config: from_attributes = True class Token(BaseModel): access_token: str token_type: str class TokenData(BaseModel): user_id: Optional[int] = None