# -*- coding: utf-8 -*-
from django.urls import path
from . import views

app_name = 'orders'

urlpatterns = [
    path('', views.order_list, name='order-list'),
    path('create/', views.order_create, name='order-create'),
    path('<int:order_number>/', views.order_detail, name='order-detail'),
    path('<int:order_number>/edit/', views.order_update, name='order-update'),
    path('<int:order_number>/delete/', views.order_delete, name='order-delete'),

    # Transaction Management
    path('<int:order_number>/transactions/payment/add/', views.transaction_add_payment, name='transaction-add-payment'),
    path('<int:order_number>/transactions/refund/add/', views.transaction_add_refund, name='transaction-add-refund'),
    path('<int:order_number>/transactions/<int:transaction_id>/delete/', views.transaction_delete, name='transaction-delete'),

    # AJAX endpoints
    path('api/customer-address-history/', views.get_customer_address_history, name='api-customer-address-history'),
    path('api/customer-recipient-history/', views.get_customer_recipient_history, name='api-customer-recipient-history'),

    # Wallet payment
    path('<int:order_number>/apply-wallet/', views.apply_wallet_payment, name='apply-wallet'),

    # AJAX status update
    path('api/<int:order_number>/set-status/', views.set_order_status, name='api-set-order-status'),

    # Order Status Management URLs
    path('statuses/', views.order_status_list, name='status_list'),
    path('statuses/create/', views.order_status_create, name='status_create'),
    path('statuses/<int:pk>/edit/', views.order_status_update, name='status_edit'),
    path('statuses/<int:pk>/delete/', views.order_status_delete, name='status_delete'),
    
    # Создать отложенный заказ (черновик) из POS [POST]
    path('api/create-from-pos/', views.create_order_from_pos, name='create-from-pos'),
]
