from django.urls import path
from . import views

app_name = 'inventory'

urlpatterns = [
    # Products
    path('', views.product_list, name='product_list'),
    path('create/', views.product_create, name='product_create'),
    path('<int:pk>/', views.product_detail, name='product_detail'),
    path('<int:pk>/edit/', views.product_edit, name='product_edit'),
    path('<int:pk>/adjust/', views.stock_adjust, name='stock_adjust'),

    # Categories
    path('categories/', views.category_list, name='category_list'),
    path('categories/create/', views.category_create, name='category_create'),

    # Suppliers
    path('suppliers/', views.supplier_list, name='supplier_list'),
    path('suppliers/create/', views.supplier_create, name='supplier_create'),
    path('suppliers/<int:pk>/', views.supplier_detail, name='supplier_detail'),
    path('suppliers/<int:pk>/edit/', views.supplier_edit, name='supplier_edit'),

    # Purchase Orders
    path('purchase-orders/', views.po_list, name='po_list'),
    path('purchase-orders/create/', views.po_create, name='po_create'),
    path('purchase-orders/<int:pk>/', views.po_detail, name='po_detail'),
    path('purchase-orders/<int:pk>/receive/', views.po_receive, name='po_receive'),
    path('purchase-orders/<int:pk>/cancel/', views.po_cancel, name='po_cancel'),

    # Purchase Returns
    path('purchase-returns/', views.purchase_return_list, name='purchase_return_list'),
    path('purchase-returns/create/', views.purchase_return_create, name='purchase_return_create'),
    path('purchase-returns/<int:pk>/', views.purchase_return_detail, name='purchase_return_detail'),
    path('purchase-returns/<int:pk>/process/', views.purchase_return_process, name='purchase_return_process'),
    # Branches
    path('branches/', views.branch_list, name='branch_list'),
    path('branches/create/', views.branch_create, name='branch_create'),
    path('branches/<int:pk>/edit/', views.branch_edit, name='branch_edit'),

    # Stock Locations
    path('locations/', views.location_list, name='location_list'),
    path('locations/create/', views.location_create, name='location_create'),

    # Transfers
    path('transfers/', views.transfer_list, name='transfer_list'),
    path('transfers/create/', views.transfer_create, name='transfer_create'),
    path('transfers/<int:pk>/', views.transfer_detail, name='transfer_detail'),
    path('transfers/<int:pk>/approve/', views.transfer_approve, name='transfer_approve'),
    path('transfers/<int:pk>/complete/', views.transfer_complete, name='transfer_complete'),

    # Adjustment Approval Workflow
    path('adjustments/requests/', views.adjustment_request_list, name='adjustment_request_list'),
    path('adjustments/requests/create/', views.adjustment_request_create, name='adjustment_request_create'),
    path('adjustments/requests/<int:pk>/approve/', views.adjustment_request_approve, name='adjustment_request_approve'),

    # Reports
    path('reports/low-stock/', views.low_stock_report, name='low_stock_report'),
    path('reports/expired-stock/', views.expired_stock_report, name='expired_stock_report'),
    path('reports/movements/', views.stock_movement_report, name='stock_movement_report'),

    # Assets
    path('assets/', views.asset_list, name='asset_list'),
    path('assets/create/', views.asset_create, name='asset_create'),
    path('assets/<int:pk>/', views.asset_detail, name='asset_detail'),
    path('assets/<int:pk>/assign/', views.asset_assign, name='asset_assign'),
    path('assets/<int:pk>/maintenance/', views.asset_maintenance, name='asset_maintenance'),

    # CSV
    path('export/products/', views.export_products_csv, name='export_products'),

]
