"""Custom exceptions for wallet operations."""

# Import hook exceptions from django_package_hooks
from django_package_hooks import HookRejectionError, HookExecutionError


class WalletOperationError(Exception):
    """Base exception for wallet operations."""

    pass


class InsufficientBalanceError(WalletOperationError):
    """Raised when user has insufficient balance for a transaction."""

    def __init__(self, message: str, available: float | None = None, requested: float | None = None):
        super().__init__(message)
        self.available = available
        self.requested = requested


class InvalidPointTypeError(WalletOperationError):
    """Raised when the specified point type does not exist for the user."""

    def __init__(self, message: str, point_type: str | None = None):
        super().__init__(message)
        self.point_type = point_type


class InvalidParamsError(WalletOperationError):
    """Raised when parameters are invalid."""

    def __init__(self, message: str, method: str | None = None):
        super().__init__(message)
        self.method = method


class UserNotFoundError(WalletOperationError):
    """Raised when the specified user does not exist."""

    def __init__(self, message: str, user_id: int | None = None):
        super().__init__(message)
        self.user_id = user_id


# Hook exceptions are imported from django_package_hooks package
# They are re-exported here for backward compatibility
__all__ = [
    "WalletOperationError",
    "InsufficientBalanceError",
    "InvalidPointTypeError",
    "InvalidParamsError",
    "UserNotFoundError",
    "HookRejectionError",
    "HookExecutionError",
]
