"""Auth domain exceptions."""
from src.core.exceptions import P2HSError, UnauthorizedError


class SignupRequiredError(P2HSError):
    """Raised when a sign-in email does not belong to an active account."""

    def __init__(self, signup_url: str):
        super().__init__("No active P2HS account exists for this email.", "SIGNUP_REQUIRED")
        self.signup_url = signup_url


class InvalidMagicLinkError(UnauthorizedError):
    """Magic link invalid or expired."""

    def __init__(self, message: str = "Invalid or expired magic link"):
        super().__init__(message)


class InvalidRefreshTokenError(UnauthorizedError):
    """Refresh token invalid or revoked."""

    def __init__(self, message: str = "Invalid or expired refresh token"):
        super().__init__(message)
