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

urlpatterns = [
    path(
        '',
        views.DashboardHomeView.as_view(),
        name='home'
    ),
    path(
        'config/',
        views.DashboardConfigView.as_view(),
        name='config'
    ),

    path(
        'shipping-methods/new/',
        views.ShippingMethodCreateView.as_view(),
        name='shipmeth-create'
    ),
    path('shipping-methods/<int:pk>/', include([
        path(
            '',
            views.ShippingMethodDetailView.as_view(),
            name='shipmeth-detail'
        ),
    ])),

    path(
        'coupons/',
        views.CouponListView.as_view(),
        name='coupon-list'
    ),
    path(
        'coupons/new/',
        views.CouponCreateView.as_view(),
        name='coupon-create'
    ),
    path('coupons/<int:pk>/', include([
        path(
            '',
            views.CouponDetailView.as_view(),
            name='coupon-detail'
        ),
        path(
            'update/',
            views.CouponUpdateView.as_view(),
            name='coupon-update'
        ),
        path(
            'delete/',
            views.CouponDeleteView.as_view(),
            name='coupon-delete'
        ),
    ])),

    path(
        'orders/',
        views.OrderListView.as_view(),
        name='order-list'
    ),
    path('orders/<int:pk>/', include([
        path(
            '',
            views.OrderDetailView.as_view(),
            name='order-detail'
        ),
        path(
            'fulfill/',
            views.OrderFulfillView.as_view(),
            name='order-fulfill'
        ),
        path(
            'cancel/',
            views.OrderCancelView.as_view(),
            name='order-cancel'
        ),
        path(
            'ship/',
            views.OrderTrackingView.as_view(),
            name='order-ship'
        ),
    ])),

    path(
        'products/',
        views.ProductListView.as_view(),
        name='product-list'
    ),
    path(
        'products/new/',
        views.ProductCreateView.as_view(),
        name='product-create'
    ),
    path('products/<int:pk>/', include([
        path(
            '',
            views.ProductDetailView.as_view(),
            name='product-detail'
        ),
        path(
            'update/',
            views.ProductUpdateView.as_view(),
            name='product-update'
        ),
        path(
            'delete/',
            views.ProductDeleteView.as_view(),
            name='product-delete'
        ),

        path(
            'photos/new/',
            views.ProductPhotoCreateView.as_view(),
            name='prodphoto-create'
        ),
        path('photos/<int:photo_pk>/', include([
            path(
                'delete/',
                views.ProductPhotoDeleteView.as_view(),
                name='prodphoto-delete'
            ),
        ])),
    ])),

    path(
        'customers/',
        views.CustomerListView.as_view(),
        name='customer-list'
    ),
    path('customers/<int:pk>/', include([
        path(
            '',
            views.CustomerDetailView.as_view(),
            name='customer-detail'
        ),
        path(
            'update/',
            views.CustomerUpdateView.as_view(),
            name='customer-update'
        ),
    ])),
]
