package com.bytesw.bytebot.etl.enums;

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

public enum IntentTypeEnum {
    SENSIBLE("1"), NO_SENSIBLE("0");

    private final String name;

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

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

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

    public String getName() {
        return name;
    }

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