"""
Realm-related models for Solar Network Python SDK.

This module contains data classes for realms and realm members.
"""

from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime
from typing import List, Optional, Dict, Any, TYPE_CHECKING

if TYPE_CHECKING:
    from .accounts import Account, AccountStatus, VerificationMark
    from .drive import CloudFile


@dataclass
class RealmLabel:
    """Realm label information."""
    id: str = ""
    realm_id: str = ""
    name: str = ""
    description: str = ""
    color: Optional[str] = None
    icon: Optional[str] = None
    created_by_account_id: str = ""
    created_at: datetime = field(default_factory=datetime.now)
    updated_at: datetime = field(default_factory=datetime.now)
    deleted_at: Optional[Any] = None


@dataclass
class Realm:
    """Realm information."""
    id: str
    slug: str
    name: str = ""
    description: str = ""
    verified_as: Optional[str] = None
    verified_at: Optional[datetime] = None
    is_community: bool = False
    is_public: bool = False
    picture: Optional['CloudFile'] = None
    background: Optional['CloudFile'] = None
    account_id: str = ""
    created_at: datetime = field(default_factory=datetime.now)
    updated_at: datetime = field(default_factory=datetime.now)
    deleted_at: Optional[datetime] = None
    boost_points: int = 0
    boost_level: int = 0


@dataclass
class RealmMember:
    """Realm member information."""
    realm_id: str = ""
    realm: Optional['Realm'] = None
    account_id: str = ""
    account: Optional['Account'] = None
    role: int = 0
    joined_at: Optional[datetime] = None
    created_at: datetime = field(default_factory=datetime.now)
    updated_at: datetime = field(default_factory=datetime.now)
    deleted_at: Optional[datetime] = None
    status: Optional['AccountStatus'] = None
    nick: Optional[str] = None
    bio: Optional[str] = None
    label_id: Optional[str] = None
    label: Optional[RealmLabel] = None
    experience: int = 0
    level: int = 0
    leveling_progress: float = 0.0