"""
Communication Credits URL Configuration
"""
from django.urls import path

from .views import (
    get_credits_view,
    update_settings_view,
    add_credits_view,
    create_payment_intent_view,
    confirm_payment_view,
    setup_payment_method_view,
    save_payment_method_view,
    get_transactions_view,
    get_usage_stats_view,
    # Phone number management
    search_available_numbers_view,
    purchase_phone_number_view,
    list_phone_numbers_view,
    release_phone_number_view,
    change_phone_number_view,
)

app_name = 'comms_credits'

urlpatterns = [
    # Get current credits and settings
    path('', get_credits_view, name='get_credits'),

    # Update settings
    path('settings/', update_settings_view, name='update_settings'),

    # Add credits (direct payment)
    path('add/', add_credits_view, name='add_credits'),

    # Stripe Elements payment flow
    path('create-payment-intent/', create_payment_intent_view, name='create_payment_intent'),
    path('confirm-payment/', confirm_payment_view, name='confirm_payment'),

    # Setup payment method for auto-reload
    path('setup-payment-method/', setup_payment_method_view, name='setup_payment_method'),
    path('save-payment-method/', save_payment_method_view, name='save_payment_method'),

    # Transaction history
    path('transactions/', get_transactions_view, name='transactions'),

    # Usage stats
    path('usage-stats/', get_usage_stats_view, name='usage_stats'),

    # Phone number management
    path('phone-numbers/', list_phone_numbers_view, name='list_phone_numbers'),
    path('phone-numbers/search/', search_available_numbers_view, name='search_available_numbers'),
    path('phone-numbers/purchase/', purchase_phone_number_view, name='purchase_phone_number'),
    path('phone-numbers/<int:number_id>/', release_phone_number_view, name='release_phone_number'),
    path('phone-numbers/<int:number_id>/change/', change_phone_number_view, name='change_phone_number'),
]
