from datetime import datetime from typing import Optional from pydantic import BaseModel, ConfigDict, Field class LoginRequest(BaseModel): username: str = Field(..., min_length=1, max_length=64) password: str = Field(..., min_length=1) class TokenResponse(BaseModel): access_token: str token_type: str = "bearer" expires_in: int class UserOut(BaseModel): model_config = ConfigDict(from_attributes=True) id: int username: str is_admin: bool is_active: bool created_at: datetime class ChangePasswordRequest(BaseModel): old_password: str = Field(..., min_length=1) new_password: str = Field(..., min_length=8) class MessageResponse(BaseModel): message: str detail: Optional[str] = None