package com.bytesw.bytebot.model.enums;

import lombok.Getter;

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

@Getter
public enum MetricMessageTypeEnum {
    RECEIVED("received"),
    SENT("sent"),
    SESSION("session");

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

    private String name;

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

    public  String getName() {return name;}

    static {
        for (MetricMessageTypeEnum type : MetricMessageTypeEnum.values()) {
            map.put(type.name, type);
        }
    }
    public static MetricMessageTypeEnum fromString(String name) {
        return map.get(name);
    }
}
