package com.bytesw.bytebot.etl.enums;

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

public enum EventTypeEnum {
    USER("user"), BOT("bot"), ACTION("action"), START_SESSION("action_session_start");

    private final String name;

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

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

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

    public String getName() {
        return name;
    }

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