from django.urls import path
from . import views

urlpatterns = [
    # ── Auth (public — no token required) ──────────────────────────────────
    path('auth/verify/',                views.verify_pin,                       name='auth-verify'),
    path('auth/change-pin/',            views.change_pin,                       name='auth-change-pin'),
    path('auth/logout/',                views.logout,                           name='auth-logout'),

    # ── Dashboard ───────────────────────────────────────────────────────────
    path('dashboard/',                  views.DashboardView.as_view(),          name='dashboard'),

    # ── Products ────────────────────────────────────────────────────────────
    path('products/',                   views.ProductListCreateView.as_view(),  name='product-list'),
    path('products/<int:pk>/',          views.ProductDetailView.as_view(),      name='product-detail'),
    path('products/<int:pk>/adjust/',   views.adjust_quantity,                  name='product-adjust'),

    # ── Customers ───────────────────────────────────────────────────────────
    path('customers/',                  views.CustomerListCreateView.as_view(), name='customer-list'),
    path('customers/<int:pk>/',         views.CustomerDetailView.as_view(),     name='customer-detail'),

    # ── Sales ───────────────────────────────────────────────────────────────
    path('sales/',                      views.SaleListCreateView.as_view(),     name='sale-list'),
    path('sales/<int:pk>/',             views.SaleDetailView.as_view(),         name='sale-detail'),
    path('sales/<int:pk>/pay/',         views.record_credit_payment,            name='sale-pay'),

    # ── Expenses ────────────────────────────────────────────────────────────
    path('expenses/',                   views.ExpenseListCreateView.as_view(),  name='expense-list'),
    path('expenses/<int:pk>/',          views.ExpenseDetailView.as_view(),      name='expense-detail'),
]