"""
Vaultfire x402 Payment Protocol — Python Package

Standalone implementation of the x402 HTTP 402 payment protocol for
internet-native USDC micropayments. Includes:

  - x402_gateway    — Core payment gateway with rule engine + ledger
  - x402_privacy    — Privacy hardening + ghostkey mode
  - x402_hooks      — High-level billing hooks for codex endpoints
  - x402_listener   — Flask blueprint for webhook + dashboard endpoints
  - x402_dashboard  — Ledger introspection + aggregation utilities
  - x402_rails      — Payment rail adapters (EVM, Assemble, NS3)
  - x402_receipts   — HMAC receipt signing + replay protection

Quick start:

    from python.x402_gateway import get_default_gateway, X402Rule

    gw = get_default_gateway()
    gw.register_rule(X402Rule(
        endpoint="myapp.data",
        category="api",
        description="Data API access",
        minimum_charge=0.0001,
        currency="USDC",
    ))

Contract addresses:
  Base USDC:      0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  Avalanche USDC: 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E

Facilitator: https://x402.org/facilitator
Hub:         https://theloopbreaker.com
"""

from .x402_gateway import X402Gateway, X402Rule, X402PaymentRequired, X402GatewayOffline, get_default_gateway
from .x402_privacy import (
    TraceBuffer,
    verify_x402_wallet,
    scrub_identity_metadata,
    contains_identity_metadata,
    is_pre_authorised,
    log_blocked_event,
    codex_redact_x402_trace,
)
from .x402_rails import DEFAULT_RAILS, EvmRail, AssembleRail, Ns3Rail, X402Rail, X402PaymentReceipt
from .x402_receipts import verify_hmac_receipt, get_partner_secret, get_partner_secret_by_id, ReceiptVerificationResult
from .x402_dashboard import load_dashboard_entries, aggregate_totals, count_total_events, export_dashboard
from .x402_hooks import trigger_belief_mirror, run_passive_loop, validate_loyalty_action

__version__ = "1.0.0"
__all__ = [
    # Gateway
    "X402Gateway",
    "X402Rule",
    "X402PaymentRequired",
    "X402GatewayOffline",
    "get_default_gateway",
    # Privacy
    "TraceBuffer",
    "verify_x402_wallet",
    "scrub_identity_metadata",
    "contains_identity_metadata",
    "is_pre_authorised",
    "log_blocked_event",
    "codex_redact_x402_trace",
    # Rails
    "DEFAULT_RAILS",
    "EvmRail",
    "AssembleRail",
    "Ns3Rail",
    "X402Rail",
    "X402PaymentReceipt",
    # Receipts
    "verify_hmac_receipt",
    "get_partner_secret",
    "get_partner_secret_by_id",
    "ReceiptVerificationResult",
    # Dashboard
    "load_dashboard_entries",
    "aggregate_totals",
    "count_total_events",
    "export_dashboard",
    # Hooks
    "trigger_belief_mirror",
    "run_passive_loop",
    "validate_loyalty_action",
]
