<?php

namespace App\Enums;

enum MemberTypeEnum: int
{

    case ALL_INCLUSIVE = 1;
    case ACADEMIC = 2;

    public static function labels(): array
    {
        return [
            self::ALL_INCLUSIVE->value => __('All Inclusive'),
            self::ACADEMIC->value => __('Academic'),
        ];
    }

    public static function label(self|int|null $value): string
    {
        $key = $value instanceof self ? $value->value : $value;
        return self::labels()[$key] ?? '';
    }

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

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