<?php

namespace App\Modules\HR\Reports\Support;

enum HrReportKey: string
{
    case EMPLOYEE_MASTER = 'employee_master';
    case EMPLOYEE_DIRECTORY = 'employee_directory';
    case EMPLOYEE_HEADCOUNT = 'employee_headcount';
    case EMPLOYEE_TURNOVER = 'employee_turnover';
    case EMPLOYEE_DEMOGRAPHICS = 'employee_demographics';
    case EMPLOYEE_SKILLS_MATRIX = 'employee_skills_matrix';
    case ATTENDANCE_DAILY = 'attendance_daily';
    case ATTENDANCE_MONTHLY = 'attendance_monthly';
    case ATTENDANCE_LATE = 'attendance_late';
    case ATTENDANCE_MISSING = 'attendance_missing';
    case ATTENDANCE_OVERTIME = 'attendance_overtime';
    case LEAVE_BALANCE = 'leave_balance';
    case LEAVE_HISTORY = 'leave_history';
    case LEAVE_LIABILITY = 'leave_liability';
    case PAYROLL_SUMMARY = 'payroll_summary';
    case PAYROLL_REGISTER = 'payroll_register';
    case PAYROLL_SALARY_COMPARISON = 'payroll_salary_comparison';
    case PAYROLL_COST_CENTER = 'payroll_cost_center';
    case PERFORMANCE_KPI_SUMMARY = 'performance_kpi_summary';
    case ASSETS_ASSIGNED = 'assets_assigned';
    case ASSETS_DAMAGED_LOST = 'assets_damaged_lost';

    /** @return array<string, array<int, self>> */
    public static function grouped(): array
    {
        $groups = [];
        foreach (self::cases() as $report) {
            $groups[$report->category()][] = $report;
        }

        return $groups;
    }

    public function category(): string
    {
        return explode('_', $this->value, 2)[0];
    }

    public function label(): string
    {
        return __("hr_reports.reports.{$this->value}");
    }
}
