from django.urls import path

from accounts import views

from .views import (
    AddOrUpdateCartView,
    CheckoutAPIViewBill,
    DiscountDetailView,
    DiscountsListView,
    OrderPaymentStatusAPIView,
    PayUPaymentResultAPIView,
    PayUWebhook,
    RemoveFromCartView,
    GetCartView,
    DeliverySlotSelectionView,
    CustomOrderCheckoutAPIView,
    CouponsListView,
    VerifyDeliveryOTP,
    VerifyPayUPaymentAPIView,
    PastOrdersListAPIView,
    PastOrderDetailAPIView,
    AddressChangeView,
    FlushCartView,
    AdListAPIView,
    Customorder_placing,
    NotificationListView,
    GetSomeOneElseOrderDetail,
    DeleteGetSomeOneElseOrderDetail,
    AddOrUpdateSomeOneElseOrderDetail,
    ExcelWriter,
    DownloadBill,
    DeleteBills,
    BillPaymentAPI,
    VerifyPayBillDesk,delivery_confirm_page,
    delivery_failed,
    delivery_success
)

urlpatterns = [
    path(
        "cart/add-or-update/", AddOrUpdateCartView.as_view(), name="add-or-update-cart"
    ),
    path(
        "cart/remove/<int:cart_item_id>/",
        RemoveFromCartView.as_view(),
        name="remove-from-cart",
    ),
    path("cart/", GetCartView.as_view(), name="get-cart"),
    path(
        "delivery-slots/",
        DeliverySlotSelectionView.as_view(),
        name="delivery_slot_selection",
    ),
    # path("checkout/", CheckoutAPIView.as_view(), name="checkout"),
    path("checkout/",CheckoutAPIViewBill.as_view(), name="checkout"),
    path("verifypayment/", VerifyPayBillDesk.as_view(), name="verify_payment"),
    path("payment_return_url/", BillPaymentAPI.as_view(), name = "return_url"),
    path("custom_order_checkout/", CustomOrderCheckoutAPIView.as_view(), name = "custom-order-checkout"),
    path("coupons/", CouponsListView.as_view(), name="coupons-list"),
    # path("verifypayment/", VerifyPaymentAPIView.as_view(), name="verify_payment"),
    path("past-orders/", PastOrdersListAPIView.as_view(), name="past-orders-list"),
    path(
        "past-orders/<uuid:order_uuid>/",
        PastOrderDetailAPIView.as_view(),
        name="past-order-detail",
    ),
    path(
        "address-change/", AddressChangeView.as_view(), name="address-change"  
    ),
    path('cart/flush/', FlushCartView.as_view(), name='flush_cart'),
    path("ad-list/", AdListAPIView.as_view(), name= "ad_list"),
    path('discounts/', DiscountsListView.as_view(), name='discounts-list'),
    path('discounts/<int:discount_id>/', DiscountDetailView.as_view(), name='discount-detail'),
    path('customorder/<int:id>/', Customorder_placing.as_view(), name='custom_order_create'),
    path('notification_history/', NotificationListView.as_view(), name= 'notification_history'),
    path('get-order-for-someone-else/', GetSomeOneElseOrderDetail.as_view(), name = "order_for_some_else_detail"),
    path('delete-order-for-someone-else-detail/', DeleteGetSomeOneElseOrderDetail.as_view(), name = "delete_order_for_someone_else_detail"),
    path('add-or-update-someone-else-detail/', AddOrUpdateSomeOneElseOrderDetail.as_view(), name = "add_or_update_someone_else_detail"),
    path("create-bill/<str:order_id>/", ExcelWriter.as_view(), name = "create_bill"),
    path("download-bill/<str:order_id>/", DownloadBill.as_view(), name = "download_bill"),
    path("delete-bills/", DeleteBills.as_view(), name="delete_bills"),



    #Addded By Akash
     path('double/verifiy/', VerifyPayUPaymentAPIView.as_view(), name='double_verifiy'), #for verifiying the order after callback
     path("webhooks/payu/<str:event>", PayUWebhook.as_view(), name="payu_webhook"),
     path("payu/return/", PayUPaymentResultAPIView.as_view(), name="payu_return"),
     path("<str:order_id>/status", OrderPaymentStatusAPIView.as_view()),
      path(
        "delivery-confirm/<uuid:order_uuid>/",
        delivery_confirm_page,
        name="delivery-confirm"
    ),

    path(
        "api/verify-delivery-otp/",
        VerifyDeliveryOTP.as_view(),
        name="verify-delivery-otp"
    ),
    path("delivery-success/", delivery_success),
    path("delivery-failed/", delivery_failed),

]
