package com.bytesw.bytebot.model.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

public enum LanguageEnum {
    SPANISH("ES");

    private final String name;

    private static final Map<String, LanguageEnum> map = new HashMap<>();

    static {
        for (LanguageEnum type : LanguageEnum.values()) {
            map.put(type.name, type);
        }
    }

    LanguageEnum(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static LanguageEnum fromString(String name) {
        if (map.containsKey(name)) {
            return map.get(name);
        }
        throw new NoSuchElementException(name + " not found");
    }
}
