<?PHP
 /**
  * Lists locales for autotranslations and provides suitable formats.
  *
  * @author Joshua Ramon Enslin <joshua@museum-digital.de>
  */
 declare(strict_types = 1);

enum NodaTimeAutotranslaterLocales {
    case ar;
    case crh;
    case de;
    case en;
    case es;
    case fa;
    case fr;
    case hu;
    case id;
    case it;
    case ja;
    case ka;
    case ko;
    case pl;
    case pt;
    case ro;
    case ru;
    case ta;
    case tl;
    case tr;
    case uk;
    case zh;

    /**
     * Returns an instance of this from a string.
     *
     * @param string $lang Language code to create enum from.
     *
     * @return static
     */
    public static function fromString(string $lang):static {

        return match($lang) {
            'ar' => static::ar,
            'crh' => static::crh,
            'de' => static::de,
            'en' => static::en,
            'es' => static::es,
            'fa' => static::fa,
            'fr' => static::fr,
            'hu' => static::hu,
            'id' => static::id,
            'it' => static::it,
            'ka' => static::ka,
            'ko' => static::ko,
            'pl' => static::pl,
            'pt' => static::pt,
            'ro' => static::ro,
            'ru' => static::ru,
            'ta' => static::ta,
            'tl' => static::tl,
            'tr' => static::tr,
            'ja' => static::ja,
            'uk' => static::uk,
            'zh' => static::zh,
        };

    }

    /**
     * Returns the locale as used by strftime.
     *
     * @return string
     */
    public function localeStrftime():string {

        return match($this) {
            self::ar => 'ar_SY.utf8',
            self::crh => 'uk_UA.utf8',
            self::de => 'de_DE.utf8',
            self::en => 'en_US.utf8',
            self::es => 'es_ES.utf8',
            self::fa => 'fa_IR.UTF-8',
            self::fr => 'fr_FR.utf8',
            self::hu => 'hu_HU.utf8',
            self::id => 'id_ID.utf8',
            self::it => 'it_IT.utf8',
            self::ka => 'ka_GE.UTF-8',
            self::ko => 'ko_KR.UTF-8',
            self::pl => 'pl_PL.utf8',
            self::pt => 'pt_BR.utf8',
            self::ro => 'ro_RO.UTF-8',
            self::ru => 'ru_RU.UTF-8',
            self::ta => 'ta_IN.UTF-8',
            self::tl => 'tl_PH.utf8',
            self::tr => 'tr_TR.utf8',
            self::uk => 'uk_UA.utf8',

            // Languages that don't really need a specific locale
            self::ja => 'en_US.utf8',
            self::zh => 'en_US.utf8',
        };

    }

    /**
     * Returns the locale as used by IntlDateFormatter.
     *
     * @return string
     */
    public function localeIntlDateFormatter():string {

        return match($this) {
            self::ar => 'ar-SY',
            self::crh => 'uk-UA',
            self::de => 'de-DE',
            self::en => 'en-US',
            self::es => 'es-ES',
            self::fa => 'fa-IR',
            self::fr => 'fr-FR',
            self::hu => 'hu-HU',
            self::id => 'id-ID',
            self::it => 'it-IT',
            self::ka => 'ka-GE',
            self::ko => 'ko-KR',
            self::pl => 'pl-PL',
            self::pt => 'pt-BR',
            self::ro => 'ro-RO',
            self::ru => 'ru-RU',
            self::ta => 'ta-IN',
            self::tl => 'tl-PH',
            self::tr => 'tr-TR',
            self::uk => 'uk-UA',

            // Languages that don't really need a specific locale
            self::ja => 'en-US',
            self::zh => 'en-US',
        };

    }

    /**
     * Returns the common era format for a given language.
     *
     * @return string
     */
    public function eraFormatCeForSprintf():string {

        return match($this) {
            self::ar => '%s',
            self::crh => '%s',
            self::de => '%s n. Chr.',
            self::en => '%s CE',
            self::es => '%s d.C.',
            self::fa => '%s',
            self::fr => '%s ap. J.-C.',
            self::hu => '%s',
            self::id => '%s M.',
            self::it => '%s d.C.',
            self::ka => '%s წ',
            self::ko => '%s',
            self::pl => '%s n.e.',
            self::pt => '%s dC',
            self::ro => '%s',
            self::ru => '%s',
            self::ta => '%s பொ.ச.',
            self::tl => '%s AD',
            self::tr => '%s',
            self::uk => '%s',
            self::ja => '西暦%s',
            self::zh => '%s',
        };

    }

    /**
     * Returns the before common era format for a given language.
     *
     * @return string
     */
    public function eraFormatBceForSprintf():string {

        return match($this) {
            self::ar => '-%s',
            self::crh => '%s рік до нашої ери',
            self::de => '%s v. Chr.',
            self::en => '%s BC',
            self::es => '%s a.C.',
            self::fa => '-%s',
            self::fr => '%s av. J.-C.',
            self::hu => 'Kr. e. %s',
            self::id => '%s SM',
            self::it => '%s a.C.',
            self::ka => 'ძვ. წ. %s წ',
            self::ko => '기원전%s',
            self::pl => '%s pne',
            self::pt => '%s AC',
            self::ro => '%s î.Hr.',
            self::ru => '%s г. до н.э.',
            self::ta => 'கிமு %s',
            self::tl => '%s BC',
            self::tr => 'MÖ %s',
            self::uk => '%s рік до нашої ери',

            // Languges that don't really need a specific locale
            self::ja => '紀元前%s',
            self::zh => '公元前%s',
        };

    }

    /**
     * Returns the appropriate format for a single year in the current language.
     *
     * @return string
     */
    public function formatSingleYearForSprintf():string {

        return match($this) {
            self::ar => '%s',
            self::crh => '%s',
            self::de => '%s',
            self::en => '%s',
            self::es => '%s',
            self::fa => '%s',
            self::fr => '%s',
            self::hu => '%s',
            self::id => '%s',
            self::it => '%s',
            self::ka => '%s',
            self::ko => '%s년',
            self::pl => '%s',
            self::pt => '%s',
            self::ro => '%s',
            self::ru => '%s',
            self::ta => '%s',
            self::tl => '%s',
            self::tr => '%s',
            self::uk => '%s',
            self::ja => '%s年',
            self::zh => '%s年',
        };

    }

    /**
     * Returns the appropriate format for a timespan of several years in the current language.
     *
     * @return string
     */
    public function formatYearspanForSprintf():string {

        return match($this) {
            self::ar => '%s-%s',
            self::crh => '%s-%s',
            self::de => '%s-%s',
            self::en => '%s-%s',
            self::es => '%s-%s',
            self::fa => '%s-%s',
            self::fr => '%s-%s',
            self::hu => '%s-%s',
            self::id => '%s-%s',
            self::it => '%s-%s',
            self::ka => '%s-%s',
            self::ko => '%s년-%s년',
            self::pl => '%s-%s',
            self::pt => '%s-%s',
            self::ro => '%s-%s',
            self::ru => '%s-%s',
            self::ta => '%s-%s',
            self::tl => '%s-%s',
            self::tr => '%s-%s',
            self::uk => '%s-%s',
            self::ja => '%s年から%s年',
            self::zh => '%s年至%s年',
        };

    }

    /**
     * Returns the appropriate format for a timespan since a start year.
     * Expects to be used as a format for sprintf.
     * Example use case: Since 1921.
     *
     * @return string
     */
    public function formatYearsSinceStartForSprintf():string {

        return match($this) {
            self::ar => '%s-',
            self::crh => 'з %s року',
            self::de => 'Seit %s',
            self::en => 'Since %s',
            self::es => 'Desde %s',
            self::fa => '%s-',
            self::fr => 'Depuis %s',
            self::hu => '%s-től',
            self::id => 'Sejak %s',
            self::it => 'Dal %s',
            self::ka => '%s წლიდან',
            self::ko => '%s부터',
            self::pl => 'Od %s r.',
            self::pt => '%s dC',
            self::ro => 'Din %s',
            self::ru => 'С %s г.',
            self::ta => '%s  முதல்',
            self::tl => 'Mula noong %s',
            self::tr => '%s-',
            self::uk => 'з %s року',

            self::ja => '%s以来',
            self::zh => '自%s以來',
        };

    }

    /**
     * Returns the appropriate format for a timespan after a start year.
     * Expects to be used as a format for sprintf.
     * Example use case: After 1921.
     *
     * @return string
     */
    public function formatYearsAfterStartForSprintf():string {

        return match($this) {
            self::ar => '%s-',
            self::crh => 'після %s року',
            self::de => 'Nach %s',
            self::en => 'After %s',
            self::es => 'Despues de %s',
            self::fa => '%s-',
            self::fr => 'Après %s',
            self::hu => '%s után',
            self::id => 'Setelah %s',
            self::it => 'Dopo il %s',
            self::ka => '%s წლის შემდეგ',
            self::ko => '%s 년 이후',
            self::pl => 'Po %s r.',
            self::pt => 'Depois de %s',
            self::ro => 'După %s',
            self::ru => 'после %s г.',
            self::ta => '%s  க்குப் பிறகு',
            self::tl => 'Pagkaraan ng %s',
            self::tr => '%s-',
            self::uk => 'після %s року',
            self::ja => '%s以降',
            self::zh => '%s以后',
        };

    }

    /**
     * Returns the appropriate format for a timespan until an end year.
     * Expects to be used as a format for sprintf.
     * Example use case: Until 1921.
     *
     * @return string
     */
    public function formatYearsUntilStartForSprintf():string {

        return match($this) {
            self::ar => '-%s',
            self::crh => 'до %s року',
            self::de => 'Bis %s',
            self::en => 'Until %s',
            self::es => 'Hasta %s',
            self::fa => '-%s',
            self::fr => 'Jusqu\'en %s',
            self::hu => '%s-ig',
            self::id => 'Sampai %s',
            self::it => 'Fino al %s',
            self::ka => '%s წლამდე',
            self::ko => '%s까지',
            self::pl => 'do %s roku',
            self::pt => 'até %s',
            self::ro => 'până în %s',
            self::ru => 'до %s г.',
            self::ta => '%s வரை',
            self::tl => 'Hanggang %s',
            self::tr => '%s-',
            self::uk => 'до %s року',
            self::ja => '%sまで',
            self::zh => '直到%s',
        };

    }

    /**
     * Returns the appropriate format for a century name.
     * Example use case: 19th century.
     *
     * @return string
     */
    public function formatCenturyForSprintf():string {

        return match($this) {
            self::ar => 'القرن ال %s',
            self::crh => '%s століття',
            self::de => '%s. Jahrhundert',
            self::en => '%s. century',
            self::es => 'Siglo %s',
            self::fa => 'قرن %s',
            self::fr => '%sème siècle',
            self::hu => '%s. század',
            self::id => 'Abad ke-%s',
            self::it => '%sesimo secolo',
            self::ka => 'მე -%s საუკუნე',
            self::ko => '%s 세기',
            self::pl => '%s wiek',
            self::pt => 'Século %s',
            self::ro => 'Secolul al %s-lea',
            self::ru => '%s век',
            self::ta => '%s ஆம் நூற்றாண்டு',
            self::tl => 'Ika-%s na siglo',
            self::tr => '%s. yüzyıl',
            self::uk => '%s століття',
            self::ja => '%s世紀',
            self::zh => '%s世紀',
        };

    }

    /**
     * Returns the appropriate format for a name spanning multiple centuries.
     * Example use case: 19th-20th centuries.
     *
     * @return string
     */
    public function formatCenturiesForSprintf():string {

        return match($this) {
            self::ar => 'القرن ال %s-%s',
            self::crh => '%s-%s століття',
            self::de => '%s.-%s. Jahrhundert',
            self::en => '%s.-%s. century',
            self::es => 'Siglo %s-%s',
            self::fa => 'قرن %s-%s',
            self::fr => '%s-%sème siècle',
            self::hu => '%s.-%s. század',
            self::id => 'Abad ke-%s-%s',
            self::it => '%s-%sesimo secolo',
            self::ka => 'მე -%s-%s საუკუნე',
            self::ko => '%s-%s 세기',
            self::pl => '%s-%s wiek',
            self::pt => 'Século %s-%s',
            self::ro => 'Secolul al %s-%s-lea',
            self::ru => '%s-%s век',
            self::ta => '%s-%s ஆம் நூற்றாண்டு',
            self::tl => 'Ika-%s hanggang ika-%s na siglo',
            self::tr => '%s.-%s. yüzyıl',
            self::uk => '%s-%s століття',
            self::ja => '%s世紀-%s世紀',
            self::zh => '%s-%s世紀',
        };

    }

    /**
     * Returns the appropriate format for a name spanning a single decade.
     * Example use case: 1920s.
     *
     * @return string
     */
    public function formatDecadeForSprintf():string {

        return match($this) {
            self::ar => '%s-%s',
            self::crh => '%s-ті роки',
            self::de => '%ser Jahre',
            self::en => '%ss',
            self::es => '%s-%s',
            self::fa => 'دهه %s',
            self::fr => 'Années %s',
            self::hu => '%s-as évek',
            self::id => 'Tahun %s-an',
            self::it => '%ss',
            self::ka => '%s-იანი წლები',
            self::ko => '%s 년대',
            self::pl => '%s roku',
            self::pt => 'Década de %s',
            self::ro => 'Anii %s',
            self::ru => '%s-е годы',
            self::ta => '%s கள்',
            self::tl => '%ss',
            self::tr => '%s\'ler',
            self::uk => '%s-ті роки',
            self::ja => '%s年代',
            self::zh => '%s年代',
        };

    }

    /**
     * Returns the appropriate format for a name spanning a some decades.
     * Example use case: 1920s-1930s.
     *
     * @return string
     */
    public function formatDecadesForSprintf():string {

        return match($this) {
            self::ar => '%s-%s',
            self::crh => '%s-%s-ті роки',
            self::de => '%s-%ser Jahre',
            self::en => '%s-%ss',
            self::es => '%s-%s',
            self::fa => 'دهه %s-%s',
            self::fr => 'Années %s-%s',
            self::hu => '%s-%s-as évek',
            self::id => 'Tahun %s-an sampai tahun %s-an',
            self::it => '%s-%ss',
            self::ka => '%s-%s-იანი წლები',
            self::ko => '%s-%s 년대',
            self::pl => '%s-%s roku',
            self::pt => 'Décadas de %s-%s',
            self::ro => 'Anii %s-%s',
            self::ru => '%s-%s-е годы',
            self::ta => '%s-%s கள்',
            self::tl => '%s-%ss',
            self::tr => '%s-%s\'ler',
            self::uk => '%s-%s-ті роки',
            self::ja => '%s年代から%s年代',
            self::zh => '%s年代-%s年代',
        };

    }

    /**
     * Returns the appropriate format for a timespan before an end year.
     * Expects to be used as a format for sprintf.
     * Example use case: Before 1921.
     *
     * @return string
     */
    public function formatYearsBeforeStartForSprintf():string {

        return match($this) {
            self::ar => '-%s',
            self::crh => 'до %s року',
            self::de => 'Vor %s',
            self::en => 'Before %s',
            self::es => 'Antes de %s',
            self::fa => '-%s',
            self::fr => 'Avant %s',
            self::hu => '%s előtt',
            self::id => 'Sebelum %s',
            self::it => 'Prima del %s',
            self::ka => '%s წლამდე',
            self::ko => '%s 년 이전',
            self::pl => 'Przed %s',
            self::pt => 'Antes de %s',
            self::ro => 'înainte de %s',
            self::ru => 'до %s г.',
            self::ta => '%s க்கு முன்',
            self::tl => 'Bago ang %s',
            self::tr => '%s-',
            self::uk => 'до %s року',
            self::ja => '%s以前',
            self::zh => '%s之前',
        };

    }

    /**
     * Returns the appropriate format for formatting a full date (Y-m-d) in a given language
     * using strftime.
     *
     * @return string
     */
    public function formatFullDateForStrfttime():string {

        return match($this) {
            self::ar => '%d/%m/%Y',
            # self::be => '%d.%B.%Y',
            # self::bg => '%Y-%B-%d',
            # self::ca => '%d/%m/%Y',
            self::crh => '%d.%m.%Y',
            # self::cs => '%d.%B.%Y',
            # self::da => '%d-%m-%Y',
            self::de => '%d.%m.%Y',
            # self::el => '%d/%B/%Y',
            self::en => '%B %d, %Y',
            self::es => '%d/%m/%Y',
            # self::et => '%d.%m.%Y',
            self::fa => '%d/%m/%Y',
            # self::fi => '%d.%B.%Y',
            self::fr => '%d/%m/%Y',
            # self::ga => '%d/%m/%Y',
            # self::hr => '%d.%m.%Y',
            self::hu => '%Y. %B %d.',
            self::id => '%d %B %Y',
            # self::in => '%d/%m/%Y',
            # self::is => '%d.%B.%Y',
            self::it => '%d/%m/%Y',
            # self::iw => '%d/%m/%Y',
            self::ja => '%Y年%m月%d日',
            self::ka => '%d.%m.%Y',
            self::ko => '%Y년 %m월 %d일',
            # self::lt => '%Y.%B.%d',
            # self::lv => '%Y.%d.%B',
            # self::mk => '%d.%B.%Y',
            # self::ms => '%d/%m/%Y',
            # self::mt => '%d/%m/%Y',
            # self::nl => '%d-%B-%Y',
            # self::no => '%d.%m.%Y',
            self::pl => '%d.%m.%Y',
            self::pt => '%d/%m/%Y',
            self::ro => '%d.%m.%Y',
            self::ru => '%d.%m.%Y',
            # self::sk => '%d.%B.%Y',
            # self::sl => '%d.%B.%Y',
            # self::sq => '%Y-%m-%d',
            # self::sr => '%d.%B.%Y.',
            # self::sv => '%Y-%m-%d',
            self::ta => '%d-%m-%Y',
            self::tl => '%Y-%m-%d',
            self::tr => '%d.%m.%Y',
            self::uk => '%d.%m.%Y',
            # self::vi => '%d/%m/%Y',
            self::zh => '%Y年%m月%d日',
        };

    }

    /**
     * Returns the appropriate format for formatting a full date (Y-m-d) in a given language
     * using IntlDateFormatter.
     *
     * @return string
     */
    public function formatFullDateForIntlDateFormatter():string {

        return match($this) {
            self::ar => 'dd/MM/Y',
            # self::be => '%d.%B.%Y',
            # self::bg => '%Y-%B-%d',
            # self::ca => '%d/%m/%Y',
            self::crh => 'dd.MM.Y',
            # self::cs => '%d.%B.%Y',
            # self::da => '%d-%m-%Y',
            self::de => 'dd.MM.Y',
            # self::el => '%d/%B/%Y',
            self::en => 'MMMM d, Y',
            self::es => 'dd/MM/Y',
            # self::et => '%d.%m.%Y',
            self::fa => 'dd/MM/Y',
            # self::fi => '%d.%B.%Y',
            self::fr => 'dd/MM/Y',
            # self::ga => '%d/%m/%Y',
            # self::hr => '%d.%m.%Y',
            self::hu => 'Y. MMMM dd.',
            self::id => 'dd MMMM Y',
            # self::in => '%d/%m/%Y',
            # self::is => '%d.%B.%Y',
            self::it => 'dd/MM/Y',
            # self::iw => '%d/%m/%Y',
            self::ja => 'Y年MM月dd日',
            self::ka => 'dd.MM.Y',
            self::ko => 'Y년 MM월 dd일',
            # self::lt => '%Y.%B.%d',
            # self::lv => '%Y.%d.%B',
            # self::mk => '%d.%B.%Y',
            # self::ms => '%d/%m/%Y',
            # self::mt => '%d/%m/%Y',
            # self::nl => '%d-%B-%Y',
            # self::no => '%d.%m.%Y',
            self::pl => 'dd.MM.Y',
            self::pt => 'dd.MM.Y',
            self::ro => 'dd.MM.Y',
            self::ru => 'dd.MM.Y',
            # self::sk => '%d.%B.%Y',
            # self::sl => '%d.%B.%Y',
            # self::sq => '%Y-%m-%d',
            # self::sr => '%d.%B.%Y.',
            # self::sv => '%Y-%m-%d',
            self::ta => 'dd-MM-Y',
            self::tl => 'Y-MM-dd',
            self::tr => 'dd.MM.Y',
            self::uk => 'dd.MM.Y',
            # self::vi => '%d/%m/%Y',
            self::zh => 'Y年MM月dd日',
        };

    }

    /**
     * Returns the appropriate format for formatting a year and month (Y-m-d) in a given language
     * using strftime.
     *
     * @return string
     */
    public function formatYearMonthForStrfttime():string {

        return match($this) {
            self::ar => '%m/%Y',
            # self::be => '%B %Y',
            # self::bg => '%Y-%B',
            # self::ca => '%m/%Y',
            # self::cs => '%B.%Y',
            self::crh => '%m %Y',
            # self::da => '%m-%Y',
            self::de => '%B %Y',
            # self::el => '%B %Y',
            self::en => '%B %Y',
            self::es => '%B %Y',
            self::fa => '%B %Y',
            self::fr => '%B %Y',
            self::hu => '%Y. %B',
            # self::in => '%m/%Y',
            # self::is => '%B %Y',
            self::id => '%B %Y',
            self::it => '%B %Y',
            # self::iw => '%m %Y',
            self::ja => '%Y年%m月',
            self::ka => '%B %Y',
            self::ko => '%Y년 %m월',
            # self::lt => '%Y. %B.',
            # self::lv => '%Y. %B',
            # self::mk => '%B %Y',
            # self::ms => '%m %Y',
            # self::mt => '%m %Y',
            # self::nl => '%B %Y',
            # self::no => '%B %Y',
            self::pl => '%B %Y',
            self::pt => '%B %Y',
            self::ro => '%B %Y',
            self::ru => '%B %Y',
            # self::sk => '%B %Y',
            # self::sl => '%B %Y',
            # self::sq => '%B %Y',
            # self::sr => '%B %Y',
            # self::sv => '%Y-%m',
            self::ta => '%B %Y',
            self::tr => '%B %Y',
            self::tl => '%B %Y',
            self::uk => '%m %Y',
            # self::vi => '%m %Y',
            self::zh => '%Y年%m月',
        };

    }

    /**
     * Returns the appropriate format for formatting a year and month (Y-m-d) in a given language
     * using IntlDateFormatter.
     *
     * @return string
     */
    public function formatYearMonthForIntlDateFormatter():string {

        return match($this) {
            self::ar => 'MM/Y',
            # self::be => 'MMMM Y',
            # self::bg => 'Y-MMMM',
            # self::ca => 'MM/Y',
            # self::cs => 'MMMM.Y',
            self::crh => 'MMMM Y',
            # self::da => 'MM-Y',
            self::de => 'MMMM Y',
            # self::el => 'MMMM Y',
            self::en => 'MMMM Y',
            self::es => 'MMMM Y',
            self::fa => 'MMMM Y',
            self::fr => 'MMMM Y',
            self::hu => 'Y. MMMM',
            # self::in => 'MM/Y',
            # self::is => 'MMMM Y',
            self::id => 'MMMM Y',
            self::it => 'MMMM Y',
            # self::iw => 'MM Y',
            self::ja => 'Y年MM月',
            self::ka => 'MMMM Y',
            self::ko => 'Y년 MM월',
            # self::lt => 'Y. MMMM.',
            # self::lv => 'Y. MMMM',
            # self::mk => 'MMMM Y',
            # self::ms => 'MM Y',
            # self::mt => 'MM Y',
            # self::nl => 'MMMM Y',
            # self::no => 'MMMM Y',
            self::pl => 'MMMM Y',
            self::pt => 'MMMM Y',
            self::ro => 'MMMM Y',
            self::ru => 'MMMM Y',
            # self::sk => 'MMMM Y',
            # self::sl => 'MMMM Y',
            # self::sq => 'MMMM Y',
            # self::sr => 'MMMM Y',
            # self::sv => 'Y-MM',
            self::ta => 'MMMM Y',
            self::tr => 'MMMM Y',
            self::tl => 'MMMM Y',
            self::uk => 'MMMM Y',
            # self::vi => 'MM Y',
            self::zh => 'Y年MM月',
        };

    }
}
