from django.urls import path, include
from . import views

urlpatterns = [
    path('about/', views.AboutView.as_view(), name='about'),
    path('fair-trade/', views.FairTradeView.as_view(), name='fair-trade'),
    path('reviews/', views.ReviewListView.as_view(), name='reviews'),
    path('contact/', views.ContactFormView.as_view(), name='contact'),
    path('subscriptions/', views.SubscriptionCreateView.as_view(), name='subscriptions'),

    path('', views.ProductListView.as_view(), name='product-list'),
    path('products/<int:pk>/', include([
        path('', views.ProductDetailView.as_view(), name='product-detail'),
    ])),

    path('cart/', views.CartView.as_view(), name='cart-detail'),
    path(
        'cart/<int:pk>/add/',
        views.CartAddProductView.as_view(),
        name='cart-add'
    ),
    path(
        'cart/<int:pk>/update/<slug:grind>/',
        views.CartUpdateProductView.as_view(),
        name='cart-update',
    ),
    path(
        'cart/<int:pk>/remove/<slug:grind>/',
        views.cart_remove_product_view,
        name='cart-remove',
    ),
    path(
        'coupon/apply/',
        views.CouponApplyView.as_view(),
        name='coupon-apply'
    ),
    path(
        'paypal/order/<slug:transaction_id>/capture/',
        views.paypal_order_transaction_capture,
        name='paypal-capture',
    ),
    path(
        'paypal/webhooks/',
        views.paypal_webhook_endpoint,
        name='paypal-webhook'
    ),
    path(
        'checkout/address/',
        views.CheckoutAddressView.as_view(),
        name='checkout-address',
    ),
    path(
        'checkout/shipping/',
        views.CheckoutShippingView.as_view(),
        name='checkout-shipping',
    ),
    path(
        'checkout/',
        views.OrderCreateView.as_view(),
        name='order-create'
    ),
    path(
        'done/',
        views.PaymentDoneView.as_view(),
        name='payment-done'
    ),
    path(
        'canceled/',
        views.PaymentCanceledView.as_view(),
        name='payment-canceled'
    ),
    path('customers/<int:pk>/', include([
        path(
            '',
            views.CustomerDetailView.as_view(),
            name='customer-detail'
        ),
        path(
            'update/',
            views.CustomerUpdateView.as_view(),
            name='customer-update',
        ),
        # path(
        #     'delete/',
        #     views.CustomerDeleteView.as_view(),
        #     name='customer-delete'
        # ),
        path(
            'orders/<int:order_pk>/',
            views.OrderDetailView.as_view(),
            name='order-detail',
        ),
        path(
            'addresses/new/',
            views.CustomerAddressCreateView.as_view(),
            name='customer-address-create',
        ),
        path(
            'addresses/<int:address_pk>/update/',
            views.CustomerAddressUpdateView.as_view(),
            name='address-update',
        )
    ])),
]
