"""
Payments App URLs
"""
from django.urls import path
from .views import (
    # Config status
    PaymentConfigStatusView,
    # Subscription plans & add-ons
    SubscriptionPlansView,
    CreateCheckoutSessionView,
    SubscriptionsView,
    CancelSubscriptionView,
    ReactivateSubscriptionView,
    # API Keys (Free Tier)
    ApiKeysView,
    ApiKeysValidateView,
    ApiKeysRevalidateView,
    ApiKeysDeleteView,
    # Connect (Paid Tiers)
    ConnectStatusView,
    ConnectOnboardView,
    ConnectRefreshLinkView,
    ConnectAccountSessionView,
    ConnectRefreshStatusView,
    # Transactions
    TransactionListView,
    TransactionSummaryView,
    StripeChargesView,
    StripePayoutsView,
    StripeBalanceView,
    TransactionExportView,
    # Payment operations
    CreatePaymentIntentView,
    TerminalConnectionTokenView,
    RefundPaymentView,
    # Customer billing
    CustomerBillingView,
    CustomerPaymentMethodsView,
    CustomerSetupIntentView,
    CustomerPaymentMethodDeleteView,
    CustomerPaymentMethodDefaultView,
    # Variable pricing / final charge
    SetFinalPriceView,
    EventPricingInfoView,
)

urlpatterns = [
    # Payment configuration status
    path('config/status/', PaymentConfigStatusView.as_view(), name='payment-config-status'),

    # Subscription plans & add-ons
    path('plans/', SubscriptionPlansView.as_view(), name='subscription-plans'),
    path('checkout/', CreateCheckoutSessionView.as_view(), name='create-checkout'),
    path('subscriptions/', SubscriptionsView.as_view(), name='subscriptions'),
    path('subscriptions/cancel/', CancelSubscriptionView.as_view(), name='cancel-subscription'),
    path('subscriptions/reactivate/', ReactivateSubscriptionView.as_view(), name='reactivate-subscription'),

    # API Keys endpoints (free tier)
    path('api-keys/', ApiKeysView.as_view(), name='api-keys'),
    path('api-keys/validate/', ApiKeysValidateView.as_view(), name='api-keys-validate'),
    path('api-keys/revalidate/', ApiKeysRevalidateView.as_view(), name='api-keys-revalidate'),
    path('api-keys/delete/', ApiKeysDeleteView.as_view(), name='api-keys-delete'),

    # Connect endpoints (paid tiers)
    path('connect/status/', ConnectStatusView.as_view(), name='connect-status'),
    path('connect/onboard/', ConnectOnboardView.as_view(), name='connect-onboard'),
    path('connect/refresh-link/', ConnectRefreshLinkView.as_view(), name='connect-refresh-link'),
    path('connect/account-session/', ConnectAccountSessionView.as_view(), name='connect-account-session'),
    path('connect/refresh-status/', ConnectRefreshStatusView.as_view(), name='connect-refresh-status'),

    # Transaction endpoints
    path('transactions/', TransactionListView.as_view(), name='transaction-list'),
    path('transactions/summary/', TransactionSummaryView.as_view(), name='transaction-summary'),
    path('transactions/charges/', StripeChargesView.as_view(), name='stripe-charges'),
    path('transactions/payouts/', StripePayoutsView.as_view(), name='stripe-payouts'),
    path('transactions/balance/', StripeBalanceView.as_view(), name='stripe-balance'),
    path('transactions/export/', TransactionExportView.as_view(), name='transaction-export'),

    # Payment operations (existing)
    path('payment-intents/', CreatePaymentIntentView.as_view(), name='create-payment-intent'),
    path('terminal/connection-token/', TerminalConnectionTokenView.as_view(), name='terminal-connection-token'),  # UNUSED_ENDPOINT: For Stripe Terminal POS hardware
    path('refunds/', RefundPaymentView.as_view(), name='create-refund'),  # UNUSED_ENDPOINT: Refunds done via transactions/{id}/refund

    # Customer billing endpoints (used by customer portal)
    path('customer/billing/', CustomerBillingView.as_view(), name='customer-billing'),
    path('customer/payment-methods/', CustomerPaymentMethodsView.as_view(), name='customer-payment-methods'),
    path('customer/setup-intent/', CustomerSetupIntentView.as_view(), name='customer-setup-intent'),
    path('customer/payment-methods/<str:payment_method_id>/', CustomerPaymentMethodDeleteView.as_view(), name='customer-payment-method-delete'),
    path('customer/payment-methods/<str:payment_method_id>/default/', CustomerPaymentMethodDefaultView.as_view(), name='customer-payment-method-default'),

    # Variable pricing / final charge endpoints
    path('events/<int:event_id>/final-price/', SetFinalPriceView.as_view(), name='set-final-price'),  # UNUSED_ENDPOINT: For setting final price on variable-priced services
    path('events/<int:event_id>/pricing/', EventPricingInfoView.as_view(), name='event-pricing-info'),  # UNUSED_ENDPOINT: Get pricing info for variable-priced events
]
