package com.dcs.hnyz.enums;

/**
 * RegisterTypeEnum
 *
 * @author: hmy
 * @date: 2025/5/23 11:52
 */
public enum RegisterTypeEnum {
    /**
     * 寄存器类型
     */
    MASTER_DATA("1", "主数据项"),
    SLAVE_DATA("2", "从数据项"),
    MASTER_SET("3", "主设置项"),
    SLAVE_SET("4", "从设置项"),
    OTHER("5", "其他");

    private final String code;
    private final String label;

    RegisterTypeEnum(String code, String label) {
        this.code = code;
        this.label = label;
    }

    public String getCode() {
        return code;
    }

    public String getLabel() {
        return label;
    }

    public static RegisterTypeEnum fromCode(String code) {
        for (RegisterTypeEnum type : values()) {
            if (type.code == code) return type;
        }
        return null;
    }

}
