<?php

namespace App\Domain\HR\Enums;

/** §48 employee statuses. */
enum EmployeeStatus: string
{
    case Active = 'active';
    case Probation = 'probation';
    case OnLeave = 'on_leave';
    case Suspended = 'suspended';
    case Resigned = 'resigned';
    case Terminated = 'terminated';
    case Inactive = 'inactive';

    public function label(): string
    {
        return match ($this) {
            self::Active => 'Active',
            self::Probation => 'Probation',
            self::OnLeave => 'On Leave',
            self::Suspended => 'Suspended',
            self::Resigned => 'Resigned',
            self::Terminated => 'Terminated',
            self::Inactive => 'Inactive',
        };
    }

    /** Statuses that still count as employed for payroll and assignment. */
    public function isEmployed(): bool
    {
        return in_array($this, [self::Active, self::Probation, self::OnLeave], true);
    }

    /** @return array<int, string> */
    public static function values(): array
    {
        return array_column(self::cases(), 'value');
    }
}
