"""HR Core URL configuration — CBV-based views."""

from __future__ import annotations

from django.urls import path

from simorgh.apps.hr_core.api.v1.employees import (
    DepartmentListView,
    EmployeeBankAccountDetailView,
    EmployeeBankAccountListCreateView,
    EmployeeDetailView,
    EmployeeDirectReportsView,
    EmployeeDocumentDetailView,
    EmployeeDocumentListCreateView,
    EmployeeListCreateView,
    EmployeeMeView,
    EmployeeTerminateView,
    JobTitleDetailView,
    JobTitleListCreateView,
    OrgChartView,
)
from simorgh.apps.hr_core.api.v1.leave import (
    LeaveBalanceAllocateView,
    LeaveBalanceListView,
    LeaveCalendarView,
    LeaveRequestApproveView,
    LeaveRequestCancelView,
    LeaveRequestDetailView,
    LeaveRequestListCreateView,
    LeaveRequestRejectView,
    LeaveRequestSubmitView,
    LeaveTypeDetailView,
    LeaveTypeListCreateView,
    PublicHolidayDetailView,
    PublicHolidayListCreateView,
)
from simorgh.apps.hr_core.api.v1.attendance import (
    AttendanceCheckInView,
    AttendanceCheckOutView,
    AttendanceDetailView,
    AttendanceListCreateView,
    AttendanceMonthlySummaryView,
    EmployeeShiftListCreateView,
    ShiftDetailView,
    ShiftListCreateView,
)

urlpatterns = [
    # ── Job Titles ────────────────────────────────────────────────────────────
    path("job-titles/", JobTitleListCreateView.as_view(), name="hr-job-title-list"),
    path("job-titles/<int:pk>/", JobTitleDetailView.as_view(), name="hr-job-title-detail"),

    # ── Departments proxy ─────────────────────────────────────────────────────
    path("departments/", DepartmentListView.as_view(), name="hr-department-list"),

    # ── Employees ─────────────────────────────────────────────────────────────
    path("employees/", EmployeeListCreateView.as_view(), name="hr-employee-list"),
    path("employees/me/", EmployeeMeView.as_view(), name="hr-employee-me"),
    path("employees/<uuid:public_id>/", EmployeeDetailView.as_view(), name="hr-employee-detail"),
    path("employees/<uuid:public_id>/terminate/", EmployeeTerminateView.as_view(), name="hr-employee-terminate"),
    path("employees/<uuid:public_id>/direct-reports/", EmployeeDirectReportsView.as_view(), name="hr-employee-direct-reports"),

    # ── Employee Documents ────────────────────────────────────────────────────
    path("employees/<uuid:public_id>/documents/", EmployeeDocumentListCreateView.as_view(), name="hr-employee-document-list"),
    path("employees/<uuid:public_id>/documents/<int:doc_id>/", EmployeeDocumentDetailView.as_view(), name="hr-employee-document-detail"),

    # ── Employee Bank Accounts ────────────────────────────────────────────────
    path("employees/<uuid:public_id>/bank-accounts/", EmployeeBankAccountListCreateView.as_view(), name="hr-bank-account-list"),
    path("employees/<uuid:public_id>/bank-accounts/<int:account_id>/", EmployeeBankAccountDetailView.as_view(), name="hr-bank-account-detail"),

    # ── Org Chart ─────────────────────────────────────────────────────────────
    path("org-chart/", OrgChartView.as_view(), name="hr-org-chart"),

    # ── Leave Management ──────────────────────────────────────────────────────
    path("leave-types/", LeaveTypeListCreateView.as_view(), name="hr-leave-type-list"),
    path("leave-types/<int:pk>/", LeaveTypeDetailView.as_view(), name="hr-leave-type-detail"),
    path("public-holidays/", PublicHolidayListCreateView.as_view(), name="hr-public-holiday-list"),
    path("public-holidays/<int:pk>/", PublicHolidayDetailView.as_view(), name="hr-public-holiday-detail"),
    path("leave-requests/", LeaveRequestListCreateView.as_view(), name="hr-leave-request-list"),
    path("leave-requests/<uuid:public_id>/", LeaveRequestDetailView.as_view(), name="hr-leave-request-detail"),
    path("leave-requests/<uuid:public_id>/submit/", LeaveRequestSubmitView.as_view(), name="hr-leave-request-submit"),
    path("leave-requests/<uuid:public_id>/approve/", LeaveRequestApproveView.as_view(), name="hr-leave-request-approve"),
    path("leave-requests/<uuid:public_id>/reject/", LeaveRequestRejectView.as_view(), name="hr-leave-request-reject"),
    path("leave-requests/<uuid:public_id>/cancel/", LeaveRequestCancelView.as_view(), name="hr-leave-request-cancel"),
    path("leave-balances/", LeaveBalanceListView.as_view(), name="hr-leave-balance-list"),
    path("leave-balances/allocate/", LeaveBalanceAllocateView.as_view(), name="hr-leave-balance-allocate"),
    path("leave-calendar/", LeaveCalendarView.as_view(), name="hr-leave-calendar"),

    # ── Time & Attendance ─────────────────────────────────────────────────────
    path("shifts/", ShiftListCreateView.as_view(), name="hr-shift-list"),
    path("shifts/<int:shift_id>/", ShiftDetailView.as_view(), name="hr-shift-detail"),
    path("employee-shifts/", EmployeeShiftListCreateView.as_view(), name="hr-employee-shift-list"),
    path("attendance/check-in/", AttendanceCheckInView.as_view(), name="hr-attendance-check-in"),
    path("attendance/check-out/", AttendanceCheckOutView.as_view(), name="hr-attendance-check-out"),
    path("attendance/summary/", AttendanceMonthlySummaryView.as_view(), name="hr-attendance-summary"),
    path("attendance/", AttendanceListCreateView.as_view(), name="hr-attendance-list"),
    path("attendance/<uuid:public_id>/", AttendanceDetailView.as_view(), name="hr-attendance-detail"),
]
