<?php

namespace App\Enums;

enum TaskAccess: string
{
    case ORGANIZATION = 'organization';
    case ASSIGNED = 'assigned';

    public function label(): string
    {
        return match ($this) {
            self::ORGANIZATION => 'Tất cả nhân viên',
            self::ASSIGNED => 'Người iên quan',
        };
    }

    public static function values(): array
    {
        return array_column(self::cases(), 'value');
    }

    public static function default(): self
    {
        return self::ORGANIZATION;
    }

    public static function options(): array
    {
        return array_map(fn($case) => [
            'value' => $case->value,
            'label' => $case->label(),
        ], self::cases());
    }
}
