from django.contrib import admin
from django.urls import path
from App.views import *
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth.views import LoginView, PasswordChangeView, PasswordChangeDoneView, LogoutView,PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView
from App.forms import LoginForm, PasswordChangeForm, MyPasswordChangeForm, MyPasswordResetForm, MySetPasswordForm

urlpatterns = [
    path("admin/", admin.site.urls),
    path('', home, name='home'),
    path('admin-dashboard', Admin.as_view(), name="admin-dashboard"),
    path("view-user", adminCustomersView.as_view(), name="allUsers"),
    path("adminAddCategory/", adminAddCategory.as_view(), name="adminAddCategory"),
    path("adminUpdateCategory/<int:pk>", adminUpdateCategory.as_view(), name="adminUpdateCategory"),
    path("adminDeleteCategory/<int:pk>", adminDeleteCategory, name="adminDeleteCategory"),
    path("adminAddSubCategory/<slug:category>/", adminAddSubCategory.as_view(), name="adminAddSubCategory"),
    path("adminUpdateSubCategory/<int:pk>", adminUpdateSubCategory.as_view(), name="adminUpdateSubCategory"),
    path("adminDeleteSubCategory/<int:pk>", adminDeleteSubCategory, name="adminDeleteSubCategory"),
    path("adminAddProduct/", adminAddProduct.as_view(), name="adminAddProduct"),
    path("adminProductView", adminProductView.as_view(), name="adminProductView"),
    path('adminUpdateProduct/<int:pk>', adminUpdateProduct.as_view(), name='adminUpdateProduct'),
    path('adminDeleteProduct/<int:pk>', adminDeleteProduct.as_view(), name='adminDeleteProduct'),
    path('adminOrders',adminOrders.as_view(),name='adminOrders'),
    path('adminOrderStatus/<int:pk>',adminOrderStatus.as_view(),name='adminOrderStatus'),
    path('category/<slug:val>', Category.as_view(), name='category'),
    path('product-detail/<int:pk>', ProductDetail.as_view(), name='product-detail'),
    path('profile/', ProfileView.as_view(), name='profile'),
    path('address/', address, name='address'),
    path('updateAddress/<int:pk>', UpdateAddressView.as_view(), name='updateAddress'),
    path('search/', search, name='search'),
    path('orders/', orders, name='orders'),
    path('add-to-cart/', addToCart, name='add-to-cart'),
    path('AuthCart/', AuthCart, name='AuthCart'),
    path('SessionCartView/', SessionCartView, name='SessionCartView'),
    path("increase_quantity/<str:product_id>",increase_quantity,name = "increase_quantity"),
    path("decrease_quantity/<str:product_id>",decrease_quantity,name = "decrease_quantity"),
    path("remove_product/<str:product_id>",remove_product,name = "remove_product"),
    path('SessionCheckout/',SessionCheckout.as_view(),name='SessionCheckout'),
    path('checkout/',Checkout.as_view(),name='check'),
    path('payment/', payment_view, name='payment'),
    path("Wish/", Wish.as_view(), name="Wish"),
    path("WishOrNot/<int:product_id>", WishOrNot, name="WishOrNot"),
    path('plusCart/', PlusCart,name="plusCart" ),
    path('minusCart/', MinusCart,name="minusCart" ),
    path('removeCart/', RemoveCart,name="removeCart" ),
    path('registration/', CustomerRegistrationView.as_view(), name='registration'), 
    path('accounts/login/', LoginView.as_view(template_name='app/login.html', authentication_form=LoginForm, next_page='home'), name='login'),
    path('logout/', LogoutView.as_view(next_page='login'), name='logout'),
    path('password-reset/', PasswordResetView.as_view(template_name='app/password_reset.html', form_class=MyPasswordResetForm), name='password_reset'),
    path('password-reset/done', PasswordResetDoneView.as_view(template_name='app/password_reset_done.html'), name='password_reset_done'),
    path('password-reset-confirm/<uidb64>/<token>/', PasswordResetConfirmView.as_view(template_name='app/password_reset_confirm.html', form_class=MySetPasswordForm), name='password_reset_confirm'),
    path('password-reset-confirm/', PasswordResetConfirmView.as_view(template_name='app/password_reset_complete.html'), name="password_reset_complete"),
    path('password-change/', PasswordChangeView.as_view(template_name='app/changePassword.html', form_class=MyPasswordChangeForm, success_url='/password-change-done'), name='password_change'),
    path('password-change-done/', PasswordChangeDoneView.as_view(template_name='app/PasswordChangeDone.html')),
]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
