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) full_name: str = Field(..., min_length=1, max_length=100) class UserCreate(UserBase): password: str = Field(..., min_length=6) class UserUpdate(BaseModel): full_name: Optional[str] = Field(None, min_length=1, max_length=100) bio: Optional[str] = Field(None, max_length=500) avatar_url: Optional[str] = None class UserResponse(UserBase): id: int is_active: bool is_admin: bool avatar_url: Optional[str] bio: Optional[str] attendance_rate: float created_at: datetime class Config: from_attributes = True class UserLogin(BaseModel): email: EmailStr password: str class Token(BaseModel): access_token: str token_type: str = "bearer" user: UserResponse class TokenData(BaseModel): user_id: Optional[int] = None email: Optional[str] = None