import uuid from decimal import Decimal from typing import Optional, Dict, Any from pydantic import BaseModel, ConfigDict, field_validator class AdminMeResponse(BaseModel): id: uuid.UUID name: str owner_email: Optional[str] = None backup_email: Optional[str] = None website_url: Optional[str] = None is_active: bool billing_mode: str balance_usd: Decimal customization: Optional[Dict[str, Any]] = None # B15: lets the Settings 2FA card show the correct state on a cold load. totp_enabled: bool = False @field_validator("totp_enabled", mode="before") @classmethod def _coerce_totp_enabled(cls, v: Any) -> bool: # The Tenant column is nullable; surface NULL as False so the client # always receives a real boolean, never null. return bool(v) model_config = ConfigDict(from_attributes=True) class AttentionResponse(BaseModel): kb_has_unindexed: bool