package com.multictrl.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum DockMode {
    IDLE(0, "空闲中"),
    FIELD_DEBUG(1, "现场调试"),
    REMOTE_DEBUG(2, "远程调试"),
    FIRMWARE_UPGRADING(3, "固件升级中"),
    WORKING(4, "作业中"),
    PENDING_CALIBRATION(5, "待标定");

    private final Integer code;
    private final String desc;

    // 根据code获取DockMode
    public static DockMode getByCode(Integer code) {
        for (DockMode dockMode : DockMode.values()) {
            if (dockMode.getCode().equals(code)) {
                return dockMode;
            }
        }
        return null;
    }

    //根据code获取desc
    public static String getDescByCode(Integer code) {
        for (DockMode dockMode : DockMode.values()) {
            if (dockMode.getCode().equals(code)) {
                return dockMode.getDesc();
            }
        }
        return null;
    }
}
