"""Auth schemas.""" from pydantic import BaseModel, EmailStr, Field from typing import Optional, List, Dict class RegisterRequest(BaseModel): email: EmailStr password: str = Field(..., min_length=6) first_name: str = Field(..., min_length=1, max_length=100) last_name: str = Field(..., min_length=1, max_length=100) class LoginRequest(BaseModel): email: EmailStr password: str class TokenResponse(BaseModel): access_token: str token_type: str = "bearer" expires_in: int user: dict class UserResponse(BaseModel): id: int email: str first_name: str last_name: str is_active: bool is_superadmin: bool roles: List[str] = [] module_roles: Dict[str, List[str]] = {} class Config: from_attributes = True class UserListResponse(BaseModel): users: List[UserResponse] total: int page: int page_size: int total_pages: int class RoleResponse(BaseModel): id: int name: str description: Optional[str] is_system: bool class Config: from_attributes = True class RoleCreate(BaseModel): name: str = Field(..., min_length=1, max_length=100) description: Optional[str] = None class ModuleResponse(BaseModel): id: int name: str slug: str description: Optional[str] url: str icon: str is_active: bool api_key: str class Config: from_attributes = True class ModuleCreate(BaseModel): name: str = Field(..., min_length=1, max_length=100) slug: str = Field(..., min_length=1, max_length=50) description: Optional[str] = None url: str icon: str = "Box" class ModuleRoleResponse(BaseModel): id: int module_id: int role_name: str description: Optional[str] class Config: from_attributes = True