<?php

namespace App\Modules\HR\Dashboard\Services;

use App\Modules\HR\Attendance\Repositories\AttendanceDashboardRepository;
use App\Modules\HR\Dashboard\Repositories\HrDashboardRepository;

class HrDashboardService
{
    public function __construct(
        private readonly HrDashboardRepository $hr,
        private readonly AttendanceDashboardRepository $attendance,
    ) {}

    /**
     * @return array<string, int>
     */
    public function kpis(int $tenantId): array
    {
        return [
            'total_employees' => $this->hr->totalEmployees($tenantId),
            'active_employees' => $this->hr->activeEmployees($tenantId),
            'absent_today' => $this->attendance->absentTodayCount($tenantId),
            'late_today' => $this->attendance->lateTodayCount($tenantId),
            'pending_leave' => $this->attendance->pendingLeaveRequestsCount($tenantId),
            'on_leave_today' => $this->attendance->onLeaveTodayCount($tenantId),
            'expiring_docs' => $this->hr->expiringDocumentsCount($tenantId),
            'on_probation' => $this->hr->onProbationCount($tenantId),
        ];
    }
}
