# ----------------------------------------------------------------------
# © 2025 KR-Labs. All rights reserved.
# KR-Labs™ is a trademark of Quipu Research Labs, LLC,
# a subsidiary of Sudiata Giddasira, Inc.
# ----------------------------------------------------------------------
# SPDX-License-Identifier: Apache-2.0

"""
Core licensing, validation, and rate limiting infrastructure for KRL Data Connectors.
"""

from .connector_registry import ConnectorRegistry, DataTier
from .license_validator import ConnectorLicenseValidator, LicenseError, RateLimitError
from .rate_limiter import (
    Agency,
    AgencyConfig,
    API_LIMITS_SPEC,
    DailyQuotaExhausted,
    DailyQuotaTracker,
    ErrorThresholdExceeded,
    ErrorTracker,
    ExponentialBackoff,
    RateLimiter,
    RateLimiterRegistry,
    RateLimitExceeded,
    SlidingWindowCounter,
    TokenBucket,
    get_rate_limiter,
    rate_limited,
)

# Billing Module (Week 21)
from .billing import (
    BillingTier,
    UsageMetricType,
    PricingStrategy,
    UpsellTriggerType,
    RevenueEventType,
    RiskPricingFactor,
    UsageRecord,
    TierPricing,
    UpsellTrigger,
    UpsellEvent,
    RiskPricingProfile,
    BillingPeriod,
    UsageMeter,
    RiskPricingEngine,
    UpsellEngine,
    AdaptiveBillingController,
    BillingBridge,
    BillingBridgeConfig,
    create_billing_controller,
    create_billing_bridge,
    create_full_billing_stack,
    # Week 21B: Economic Layer
    PricingIntent,
    IntentConfidence,
    IntentResult,
    PricingIntentsEngine,
    create_intents_engine,
    UnitType,
    UnitCategory,
    NormalizedUnit,
    UnitNormalizer,
    create_unit_normalizer,
    PolicyDecision,
    PolicyResult,
    BillingPolicyTree,
    create_policy_tree,
    create_policy_context,
    # Week 22: Revenue Optimization
    ForecastModel,
    ForecastResult,
    RevenueForecaster,
    create_revenue_forecaster,
    CohortType,
    CohortAnalytics,
    create_cohort_analytics,
    PricingOptimizer,
    create_pricing_optimizer,
    AlertSeverity,
    AlertCategory,
    Alert,
    RevenueAlertSystem,
    create_revenue_alert_system,
    # Week 23: Payment Gateway Adapters
    PaymentsAdapter,
    AdapterResult,
    CustomerData,
    SubscriptionData,
    StripeAdapter,
    LagoAdapter,
    WebhookDispatcher,
    create_webhook_dispatcher,
    PaymentProvider,
    BillingIntegrationManager,
    create_billing_integration,
    # Week 24: Revenue Reporting & Analytics
    ReportPeriod,
    RevenueReport,
    RevenueReportingEngine,
    create_revenue_reporting_engine,
    BillingDashboardManager,
    create_billing_dashboard_manager,
    ChurnRisk,
    CustomerHealthScore,
    SubscriptionAnalytics,
    create_subscription_analytics,
    ExportFormat,
    BillingExportEngine,
    create_billing_export_engine,
)

__all__ = [
    # Registry & Tiers
    "ConnectorRegistry",
    "DataTier",
    # License Validation
    "ConnectorLicenseValidator",
    "LicenseError",
    "RateLimitError",
    # Rate Limiting - Exceptions
    "RateLimitExceeded",
    "DailyQuotaExhausted",
    "ErrorThresholdExceeded",
    # Rate Limiting - Configuration
    "Agency",
    "AgencyConfig",
    "API_LIMITS_SPEC",
    # Rate Limiting - Core Algorithms
    "TokenBucket",
    "SlidingWindowCounter",
    "DailyQuotaTracker",
    "ErrorTracker",
    "ExponentialBackoff",
    # Rate Limiting - Main Class
    "RateLimiter",
    "RateLimiterRegistry",
    "get_rate_limiter",
    "rate_limited",
    # Billing (Week 21)
    "BillingTier",
    "UsageMetricType",
    "PricingStrategy",
    "UpsellTriggerType",
    "RevenueEventType",
    "RiskPricingFactor",
    "UsageRecord",
    "TierPricing",
    "UpsellTrigger",
    "UpsellEvent",
    "RiskPricingProfile",
    "BillingPeriod",
    "UsageMeter",
    "RiskPricingEngine",
    "UpsellEngine",
    "AdaptiveBillingController",
    "BillingBridge",
    "BillingBridgeConfig",
    "create_billing_controller",
    "create_billing_bridge",
    "create_full_billing_stack",
    # Billing (Week 21B) - Economic Layer
    "PricingIntent",
    "IntentConfidence",
    "IntentResult",
    "PricingIntentsEngine",
    "create_intents_engine",
    "UnitType",
    "UnitCategory",
    "NormalizedUnit",
    "UnitNormalizer",
    "create_unit_normalizer",
    "PolicyDecision",
    "PolicyResult",
    "BillingPolicyTree",
    "create_policy_tree",
    "create_policy_context",
    # Billing (Week 22) - Revenue Optimization
    "ForecastModel",
    "ForecastResult",
    "RevenueForecaster",
    "create_revenue_forecaster",
    "CohortType",
    "CohortAnalytics",
    "create_cohort_analytics",
    "PricingOptimizer",
    "create_pricing_optimizer",
    "AlertSeverity",
    "AlertCategory",
    "Alert",
    "RevenueAlertSystem",
    "create_revenue_alert_system",
    # Billing (Week 23) - Payment Gateway Adapters
    "PaymentsAdapter",
    "AdapterResult",
    "CustomerData",
    "SubscriptionData",
    "StripeAdapter",
    "LagoAdapter",
    "WebhookDispatcher",
    "create_webhook_dispatcher",
    "PaymentProvider",
    "BillingIntegrationManager",
    "create_billing_integration",
    # Billing (Week 24) - Revenue Reporting & Analytics
    "ReportPeriod",
    "RevenueReport",
    "RevenueReportingEngine",
    "create_revenue_reporting_engine",
    "BillingDashboardManager",
    "create_billing_dashboard_manager",
    "ChurnRisk",
    "CustomerHealthScore",
    "SubscriptionAnalytics",
    "create_subscription_analytics",
    "ExportFormat",
    "BillingExportEngine",
    "create_billing_export_engine",
]
