package com.njcn.gather.system.dictionary.pojo.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @author caozehui
 * @data 2024-12-12
 */
@Getter
public enum DictDataEnum {

    /**
     * Key cleanup point: only keep registration-related platform capability
     * types that are still referenced by the retained activation flow.
     */
    DIGITAL("数字式", "Digital"),
    SIMULATE("模拟式", "Simulate"),
    CONTRAST("比对式", "Contrast");

    private final String name;
    private final String code;

    DictDataEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public static String getMsgByValue(Integer name) {
        for (DictDataEnum state : DictDataEnum.values()) {
            if (state.getName().equals(name)) {
                return state.getCode();
            }
        }
        return null;
    }

    public static DictDataEnum getDictDataEnumByCode(String code) {
        for (DictDataEnum steadyIndicatorEnum : DictDataEnum.values()) {
            if (StringUtils.equals(code, steadyIndicatorEnum.getCode())) {
                return steadyIndicatorEnum;
            }
        }
        return null;
    }
}
