# ============================================================
# ADDITIVE: URLs for Company/leave_api_views.py
# Mounted from hrnexus/urls.py under /api/leave-hub/
# (Admin / HR - JWT, role-checkbox permissions, company-isolated)
# ============================================================

from django.urls import path
from rest_framework.routers import DefaultRouter

from . import leave_api_views as v

router = DefaultRouter()
router.register(r"wfh-requests", v.WFHRequestViewSet, basename="leavehub-wfh-request")
router.register(r"balance-allocations", v.BalanceAllocationViewSet, basename="leavehub-balance-allocation")
router.register(r"policies", v.LeavePolicyViewSet, basename="leavehub-policy")
router.register(r"workflow-steps", v.WorkflowStepViewSet, basename="leavehub-workflow-step")
router.register(r"hierarchy", v.HierarchyViewSet, basename="leavehub-hierarchy")

urlpatterns = [
    # Leave Dashboard
    path("dashboard/", v.LeaveHubDashboardView.as_view(), name="leavehub_dashboard"),

    # WFH & Remote Policies
    path("wfh-policy/", v.WFHPolicyView.as_view(), name="leavehub_wfh_policy"),

    # Leave Requests (multi-tier pipeline; plain CRUD stays on /api/leaves/)
    path("leave-requests/", v.LeaveRequestPipelineView.as_view(), name="leavehub_leave_requests"),
    path("leave-requests/<int:pk>/", v.LeaveRequestPipelineView.as_view(), name="leavehub_leave_request_detail"),
    path("leave-requests/<int:pk>/approve/", v.LeaveTierActionView.as_view(), name="leavehub_leave_approve"),
    path("leave-requests/<int:pk>/reject/", v.LeaveTierRejectView.as_view(), name="leavehub_leave_reject"),

    # Pending approvals queue
    path("approvals/pending/", v.PendingApprovalsView.as_view(), name="leavehub_pending_approvals"),

    # Leave Calendar
    path("calendar/", v.LeaveCalendarView.as_view(), name="leavehub_calendar"),

    # Leave Balances
    path("balances/", v.LeaveBalancesView.as_view(), name="leavehub_balances"),
    path("balances/initialize/", v.BalanceInitializeView.as_view(), name="leavehub_balances_initialize"),

    # Leave Policies (framework must come BEFORE the router's policies/<pk>/)
    path("policies/framework/", v.PolicyFrameworkView.as_view(), name="leavehub_policy_framework"),

    # Approval Workflow
    path("workflow/", v.WorkflowView.as_view(), name="leavehub_workflow"),
    path("workflow/reset/", v.WorkflowResetView.as_view(), name="leavehub_workflow_reset"),
] + router.urls
 