"""
budget/urls.py
==============
URL configuration for Budget Management (Module 1 of EFMS).

Routes follow the Horilla CBV convention used across the codebase:

  …/<entity>/            → ViewPage  (full page extending index.html)
  …/<entity>/nav/        → NavView   (topbar with search/filter/create)
  …/<entity>/list/       → ListView  (table body, swapped into #listContainer)
  …/<entity>/create/     → FormView  (create modal)
  …/<entity>/update/<pk>/→ FormView  (edit modal)
  …/<entity>/delete/<pk>/→ FBV       (HTMX delete endpoint)
"""

from django.urls import path

from budget.cbv import allocation, head, item, sub_head

from . import views

urlpatterns = [
    # ---------------------------------------------------------------
    # Dashboard, settings & bulk upload
    # ---------------------------------------------------------------
    path("budget/", views.budget_dashboard, name="budget-dashboard"),
    path("budget/settings/", views.budget_settings, name="budget-settings"),
    path(
        "budget/bulk-upload/",
        views.budget_bulk_upload,
        name="budget-bulk-upload",
    ),

    # ---------------------------------------------------------------
    # Budget Head
    # ---------------------------------------------------------------
    path(
        "budget/head/",
        head.BudgetHeadViewPage.as_view(),
        name="budget-head-view",
    ),
    path(
        "budget/head/nav/",
        head.BudgetHeadNavView.as_view(),
        name="budget-head-nav",
    ),
    path(
        "budget/head/list/",
        head.BudgetHeadListView.as_view(),
        name="budget-head-list",
    ),
    path(
        "budget/head/create/",
        head.BudgetHeadFormView.as_view(),
        name="budget-head-create",
    ),
    path(
        "budget/head/update/<int:pk>/",
        head.BudgetHeadFormView.as_view(),
        name="budget-head-update",
    ),
    path(
        "budget/head/delete/<int:pk>/",
        views.delete_budget_head,
        name="budget-head-delete",
    ),

    # ---------------------------------------------------------------
    # Budget Sub-Head
    # ---------------------------------------------------------------
    path(
        "budget/sub-head/",
        sub_head.BudgetSubHeadViewPage.as_view(),
        name="budget-sub-head-view",
    ),
    path(
        "budget/sub-head/nav/",
        sub_head.BudgetSubHeadNavView.as_view(),
        name="budget-sub-head-nav",
    ),
    path(
        "budget/sub-head/list/",
        sub_head.BudgetSubHeadListView.as_view(),
        name="budget-sub-head-list",
    ),
    path(
        "budget/sub-head/create/",
        sub_head.BudgetSubHeadFormView.as_view(),
        name="budget-sub-head-create",
    ),
    path(
        "budget/sub-head/update/<int:pk>/",
        sub_head.BudgetSubHeadFormView.as_view(),
        name="budget-sub-head-update",
    ),
    path(
        "budget/sub-head/delete/<int:pk>/",
        views.delete_budget_sub_head,
        name="budget-sub-head-delete",
    ),

    # ---------------------------------------------------------------
    # Budget Item
    # ---------------------------------------------------------------
    path(
        "budget/item/",
        item.BudgetItemViewPage.as_view(),
        name="budget-item-view",
    ),
    path(
        "budget/item/nav/",
        item.BudgetItemNavView.as_view(),
        name="budget-item-nav",
    ),
    path(
        "budget/item/list/",
        item.BudgetItemListView.as_view(),
        name="budget-item-list",
    ),
    path(
        "budget/item/create/",
        item.BudgetItemFormView.as_view(),
        name="budget-item-create",
    ),
    path(
        "budget/item/update/<int:pk>/",
        item.BudgetItemFormView.as_view(),
        name="budget-item-update",
    ),
    path(
        "budget/item/delete/<int:pk>/",
        views.delete_budget_item,
        name="budget-item-delete",
    ),

    # ---------------------------------------------------------------
    # Budget Allocation
    # ---------------------------------------------------------------
    path(
        "budget/allocation/",
        allocation.BudgetAllocationViewPage.as_view(),
        name="budget-allocation-view",
    ),
    path(
        "budget/allocation/nav/",
        allocation.BudgetAllocationNavView.as_view(),
        name="budget-allocation-nav",
    ),
    path(
        "budget/allocation/list/",
        allocation.BudgetAllocationListView.as_view(),
        name="budget-allocation-list",
    ),
    path(
        "budget/allocation/create/",
        allocation.BudgetAllocationFormView.as_view(),
        name="budget-allocation-create",
    ),
    path(
        "budget/allocation/update/<int:pk>/",
        allocation.BudgetAllocationFormView.as_view(),
        name="budget-allocation-update",
    ),
    path(
        "budget/allocation/delete/<int:pk>/",
        views.delete_budget_allocation,
        name="budget-allocation-delete",
    ),
]
