<?php

namespace app\foreignone;

enum PostLanguage: string
{
    case Russian = 'ru';
    case English = 'en';

    public static function getDefault(): PostLanguage {
        return self::English;
    }

    public function getIndex(): ?int {
        return array_search($this->value, self::cases(), true);
    }

    public static function casesAsStrings(): array {
        return array_map(fn($v) => $v->value, self::cases());
    }
}