<?php

namespace App\Enums\Concerns;

use Illuminate\Support\Collection;

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

    /**
     * @return Collection<int, array{value: string, label: string}>
     */
    public static function toSelect(): Collection
    {
        return collect(self::cases())->map(fn ($case) => [
            'value' => $case->value,
            'label' => $case->label(),
        ])->values();
    }
}
