from django.urls import include, path
from rest_framework.routers import DefaultRouter

from apps.party_hub.ar_views import (
    ARAdvancesView,
    ARAgingAndDSOView,
    ARAuditListView,
    ARAllocationReversalView,
    ARCollectionCommitmentViewSet,
    ARControlPolicyView,
    ARControlReconciliationView,
    ARCustomerViewSet,
    ARDashboardView,
    ARDisputeViewSet,
    ARReportsView,
    ARRetentionReleaseView,
    ARRetentionView,
    ARStatementAndReconciliationView,
    ARTransactionInspectView,
    ContractBOQBillingView,
    CustomerReceiptViewSet,
    RABillViewSet,
    SalesInvoiceViewSet,
)

router = DefaultRouter()
router.register("customers", ARCustomerViewSet, basename="ar-customers")
router.register("invoices", SalesInvoiceViewSet, basename="ar-invoices")
router.register("ra-bills", RABillViewSet, basename="ar-ra-bills")
router.register("receipts", CustomerReceiptViewSet, basename="ar-receipts")
router.register("commitments", ARCollectionCommitmentViewSet, basename="ar-commitments")
router.register("disputes", ARDisputeViewSet, basename="ar-disputes")

urlpatterns = [
    path("", include(router.urls)),
    path("dashboard/", ARDashboardView.as_view()),
    path("control-reconciliation/", ARControlReconciliationView.as_view()),
    path("policies/", ARControlPolicyView.as_view()),
    path("contracts/<uuid:contract_id>/boq-billing/", ContractBOQBillingView.as_view()),
    path("allocations/<uuid:allocation_id>/reverse/", ARAllocationReversalView.as_view()),
    path("advances/", ARAdvancesView.as_view()),
    path("retention/", ARRetentionView.as_view()),
    path("retention/release-eligible/", ARRetentionView.as_view()),
    path("retention/<uuid:pk>/release/", ARRetentionReleaseView.as_view()),
    path("aging/", ARAgingAndDSOView.as_view(), {"kind": "aging"}),
    path("dso/", ARAgingAndDSOView.as_view(), {"kind": "dso"}),
    path("statements/", ARStatementAndReconciliationView.as_view(), {"kind": "statements"}),
    path("statements/generate/", ARStatementAndReconciliationView.as_view(), {"kind": "generate_statement"}),
    path("reconciliation/", ARStatementAndReconciliationView.as_view(), {"kind": "reconciliation"}),
    path("reconciliation/import/", ARStatementAndReconciliationView.as_view(), {"kind": "import_recon"}),
    path("reports/", ARReportsView.as_view()),
    path("audit/", ARAuditListView.as_view()),
    path("inspect/", ARTransactionInspectView.as_view()),
]

