package com.alexstyl.specialdates.events.namedays;

import android.support.annotation.RawRes;

import com.alexstyl.specialdates.R;
import com.novoda.notils.exception.DeveloperError;

public enum NamedayLocale {
    GREEK("gr", true, R.raw.gr_namedays),
    ROMANIAN("ro", false, R.raw.ro_namedays),
    RUSSIAN("ru", false, R.raw.ru_namedays),
    LATVIAN("lv", false, R.raw.lv_namedays),
    SLOVAK("sk", false, R.raw.sk_namedays),
    CZECH("cs", false, R.raw.cs_namedays);

    private final String shortCode;
    private final boolean soundCompared;
    private final int rawResId;

    NamedayLocale(String shortCode, boolean soundCompared, @RawRes int rawResId) {
        this.shortCode = shortCode;
        this.soundCompared = soundCompared;
        this.rawResId = rawResId;
    }

    public static NamedayLocale from(String displayLanguage) {
        for (NamedayLocale locale : values()) {
            if (locale.getShortCode().equalsIgnoreCase(displayLanguage)) {
                return locale;
            }
        }
        throw new DeveloperError("No NamedayLocale found for [%s]", displayLanguage);
    }

    public int getRawResId() {
        return rawResId;
    }

    public boolean isComparedBySound() {
        return soundCompared;
    }

    public String getShortCode() {
        return shortCode;
    }
}

@@ -422,24 +422,69 @@
 _namedays),%0A
+    ITALIAN(%22it%22, false, R.raw.it_namedays),%0A
     CZECH(%22c

Include italian NamedayLocale