from __future__ import annotations

from dataclasses import asdict, dataclass

from django.contrib.auth.models import AbstractBaseUser


@dataclass(frozen=True)
class PasswordResetContext:
    """
    - email: User's email address
    - domain: Site domain
    - site_name: Name of the site
    - uid: Base64 encoded user ID
    - user: User object
    - front_url: URL from settings
    - token: Password reset token
    - protocol: 'http' or 'https'
    """

    email: str
    domain: str
    site_name: str
    uid: str
    user: AbstractBaseUser
    front_url: str
    token: str
    protocol: str

    def to_dict(self) -> dict[str, str | AbstractBaseUser]:
        """Convert to dictionary for template rendering."""
        return asdict(self)
