"""
Wallet point transaction utilities (Python port of WalletPoint).

Install (from your Django backend folder):
    pip install -e ../packages/wallet_utils

Usage:
    from wallet_utils import WalletService, WalletRepository
    from wallet_utils.exceptions import (
        InsufficientBalanceError,
        InvalidPointTypeError,
        InvalidParamsError,
        WalletOperationError,
    )
    from your_app.models import User
    
    # Define point types and their decimal places
    point_types = {
        "credit_balance": 2,
        "reward_points": 0,
    }
    
    # Create repository (only needs point types definition)
    repo = WalletRepository(
        user_model=User,
        point_types=point_types,
    )
    
    # Use the service
    service = WalletService(repo)
    transaction_id = service.add_point(
        user_id=123,
        point_type="credit_balance",
        amount=Decimal("100.00"),
        remarks="Deposit",
    )
"""

from .exceptions import (
    HookExecutionError,
    HookRejectionError,
    InsufficientBalanceError,
    InvalidParamsError,
    InvalidPointTypeError,
    UserNotFoundError,
    WalletOperationError,
)
from .hooks import (
    HookContext,
    HookManager,
    HookRegistry,
    HookType,
    PostHookError,
    clear_hooks,
    get_global_registry,
    register_hook,
    unregister_hook,
)
from .repository import WalletRepository, WalletRepositoryProtocol
from .service import TransactionRecord, TransactionResult, WalletService
from .signals import transfer_completed
from .transaction_types import (
    CUSTOM_TRANSACTION_TYPE_RANGE_END,
    CUSTOM_TRANSACTION_TYPE_RANGE_START,
    TRANSACTION_TYPES,
    TRANSACTION_TYPE_NAMES,
    get_custom_transaction_types,
    get_transaction_type,
    get_transaction_type_name,
    register_custom_transaction_type,
    unregister_custom_transaction_type,
    # Wallet Operations
    WALLET_DEPOSIT,
    WALLET_DEPOSIT_CANCEL,
    WALLET_TRANSFER,
    WALLET_WITHDRAW,
    WALLET_WITHDRAW_REFUND,
    WALLET_ADJUST,
    WALLET_TOPUP,
    WALLET_DEDUCT,
    # Package Operations
    PACKAGE_ACTIVATION,
    PACKAGE_ACTIVATION_CANCEL,
    PACKAGE_UPGRADE,
    PACKAGE_UPGRADE_CANCEL,
    PACKAGE_RENEWAL,
    PACKAGE_RENEWAL_CANCEL,
    PACKAGE_EXPIRY_REFUND,
    # Commission & Rewards
    COMMISSION_DISTRIBUTION,
    COMMISSION_DISTRIBUTION_REVERSE,
    ROI_DISTRIBUTION,
    ROI_DISTRIBUTION_REVERSE,
    # Product Operations
    PRODUCT_ORDER,
    PRODUCT_ORDER_CANCEL,
    PRODUCT_ORDER_REFUND,
    PRODUCT_ORDER_PARTIAL_REFUND,
    PRODUCT_REDEMPTION,
    PRODUCT_REDEMPTION_CANCEL,
    # System Operations
    SYSTEM_ADJUSTMENT,
    SYSTEM_REWARD,
    SYSTEM_PENALTY,
    SYSTEM_REVERSAL,
    SYSTEM_MIGRATION,
)

__all__ = [
    "CUSTOM_TRANSACTION_TYPE_RANGE_END",
    "CUSTOM_TRANSACTION_TYPE_RANGE_START",
    "HookContext",
    "HookExecutionError",
    "HookManager",
    "HookRegistry",
    "HookRejectionError",
    "HookType",
    "InsufficientBalanceError",
    "InvalidParamsError",
    "InvalidPointTypeError",
    "PostHookError",
    "TransactionRecord",
    "TransactionResult",
    "TRANSACTION_TYPES",
    "TRANSACTION_TYPE_NAMES",
    "UserNotFoundError",
    "clear_hooks",
    "get_custom_transaction_types",
    "get_global_registry",
    "get_transaction_type",
    "get_transaction_type_name",
    "register_custom_transaction_type",
    "register_hook",
    "transfer_completed",
    "unregister_custom_transaction_type",
    "unregister_hook",
    # Wallet Operations
    "WALLET_DEPOSIT",
    "WALLET_DEPOSIT_CANCEL",
    "WALLET_TRANSFER",
    "WALLET_WITHDRAW",
    "WALLET_WITHDRAW_REFUND",
    "WALLET_ADJUST",
    "WALLET_TOPUP",
    "WALLET_DEDUCT",
    # Package Operations
    "PACKAGE_ACTIVATION",
    "PACKAGE_ACTIVATION_CANCEL",
    "PACKAGE_UPGRADE",
    "PACKAGE_UPGRADE_CANCEL",
    "PACKAGE_RENEWAL",
    "PACKAGE_RENEWAL_CANCEL",
    "PACKAGE_EXPIRY_REFUND",
    # Commission & Rewards
    "COMMISSION_DISTRIBUTION",
    "COMMISSION_DISTRIBUTION_REVERSE",
    "ROI_DISTRIBUTION",
    "ROI_DISTRIBUTION_REVERSE",
    # Product Operations
    "PRODUCT_ORDER",
    "PRODUCT_ORDER_CANCEL",
    "PRODUCT_ORDER_REFUND",
    "PRODUCT_ORDER_PARTIAL_REFUND",
    "PRODUCT_REDEMPTION",
    "PRODUCT_REDEMPTION_CANCEL",
    # System Operations
    "SYSTEM_ADJUSTMENT",
    "SYSTEM_REWARD",
    "SYSTEM_PENALTY",
    "SYSTEM_REVERSAL",
    "SYSTEM_MIGRATION",
    "WalletOperationError",
    "WalletRepository",
    "WalletRepositoryProtocol",
    "WalletService",
]
