package vip.xiaonuo.coldchain.modular.app.param;

/**
 * @author jackzhou
 * @version 1.0
 * @project jfcloud-coldchain
 * @description
 * @date 2024/11/17 22:56:52
 */

public enum Metric {
    TEMPERATURE("temperature"),
    HUMIDITY("humidity"),
    CO2_LEVEL("co2Level");

    private final String value;

    Metric(String value) {
        this.value = value;
    }

    // 根据字符串获取枚举实例
    public static Metric fromString(String value) {
        for (Metric metric : Metric.values()) {
            if (metric.getValue().equalsIgnoreCase(value)) {
                return metric;
            }
        }
        throw new IllegalArgumentException("Invalid metric value: " + value);
    }

    public String getValue() {
        return value;
    }
}
