<?php

namespace App\Traits;

trait ProvidesEnumOptions
{
    public static function options(): array
    {
        return collect(static::cases())
            ->mapWithKeys(fn ($case) => [
                $case->value => $case->label(),
            ])
            ->all();
    }

    public static function selectOptions(): array
    {
        return collect(static::cases())
            ->map(fn ($case) => [
                'value' => $case->value,
                'label' => $case->label(),
            ])
            ->all();
    }

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