<?php

namespace enums;

enum LangEnum: string
{
    case ZH = 'zh';
    case EN = 'en';
    case AR = 'ar';
    case UR = 'ur';
    case SI = 'si';
    case ES = 'es';
    case TR = 'tr';
    case UK = 'uk';
    case SV = 'sv';
    case PT = 'pt';
    case KO = 'ko';
    case IT = 'it';
    case FR = 'fr';
    case JA = 'ja';
    case DE = 'de';
    case RU = 'ru';
    case RO = 'ro';


    public function label(): string
    {
        return match ($this) {
            self::ZH => '中文',
            self::EN => '英语',
            self::AR => '阿拉伯语',
            self::UR => '乌尔都语',
            self::SI => '僧伽罗语',
            self::ES => '西班牙语',
            self::TR => '土耳其语',
            self::UK => '乌克兰语',
            self::SV => '瑞典语',
            self::PT => '葡萄牙语',
            self::KO => '韩语',
            self::IT => '意大利语',
            self::FR => '法语',
            self::JA => '日语',
            self::DE => '德语',
            self::RU => '俄语',
            self::RO => '罗马尼亚语',

        };
    }

    public function lang(): string
    {
        return match ($this) {
            self::ZH => '中文',
            self::EN => 'English',
            self::AR => 'عربي',
            self::UR => 'اردو',
            self::SI => 'සිංහල',
            self::ES => 'Español',
            self::TR => 'Türkçe',
            self::UK => 'українська',
            self::SV => 'Svenska',
            self::PT => 'Português',
            self::KO => '한국인',
            self::IT => 'Italiano',
            self::FR => 'Français',
            self::JA => '日本語',
            self::DE => 'Deutsch',
            self::RU => 'Русский',
            self::RO => 'Română',
        };
    }
    public function is_open(): bool
    {
        return match ($this) {
            self::EN,self::RU,self::AR,self::JA,self::RO,self::ZH,self::ES=> true,
            default => false
        };
    }
    public function getLangList(): array
    {
        return match ($this) {
            self::ZH => ['zh-cn', 'zh-hans-cn', 'zh-hant-cn', 'zh-hk', 'zh-mo', 'zh-tw','cn'],
            self::EN => ['en-us'],
            default => []
        };
    }
    public function extend(): string
    {
        return config_path('lang') . $this->value . '.json';//
    }

}
