from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from .views import *

urlpatterns = [
    path('all', OrderlistView.as_view(), name='order-list'),
    path('cart', CartView.as_view()),
    path('cart/set-address', SetAddressForCartView.as_view()),
    path('cart/discount', ApplyDiscountView.as_view()),
    path('cart/special-discount', ApplySpecialDiscountView.as_view()),
    path('cart/all', CartItemClear.as_view()),
    path('cart/item/<int:pk>', CartItemViews.as_view(), name='change-item-cart'),
    path('cart/payment', PaymentView.as_view(), name='payment'),
    path('transaction/<int:tracking_code>',
         CallbackView.as_view(), name='callback-gateway'),
    path('<int:pk>', OrderGetView.as_view(), name='order-get'),
    
    # User invoice download endpoint (DRF APIView)
    path('invoice/<int:order_id>', UserOrderInvoiceView.as_view(), name='user-order-invoice'),
    
    # Admin invoice download endpoints
    path('invoice/order/<int:order_id>/download', download_order_invoice, name='download-order-invoice'),
    path('invoice/shop-order/<int:shop_order_id>/download', download_shop_order_invoice, name='download-shop-order-invoice'),
]
