from django.urls import path, include
from django.contrib.auth import views as auth_views
from .views import (
    home, product_detail, shop_list, shop_detail,
    dashboard, shop_add, shop_edit,
    product_add, product_edit, product_delete
)

urlpatterns = [
    path("", home, name="home"),
    path("shops/", shop_list, name="shop_list"),
    path("shop/<slug:slug>/", shop_detail, name="shop_detail"),
    path("product/<slug:slug>/", product_detail, name="product_detail"),
    
    # Dashboard
    path("dashboard/", dashboard, name="dashboard"),
    path("dashboard/shop/add/", shop_add, name="shop_add"),
    path("dashboard/shop/edit/<int:pk>/", shop_edit, name="shop_edit"),
    path("dashboard/product/add/", product_add, name="product_add"),
    path("dashboard/product/edit/<int:pk>/", product_edit, name="product_edit"),
    path("dashboard/product/delete/<int:pk>/", product_delete, name="product_delete"),
    
    # Auth
    path("login/", auth_views.LoginView.as_view(template_name="core/auth/login.html"), name="login"),
    path("logout/", auth_views.LogoutView.as_view(next_page="home"), name="logout"),
]
