package org.wcs.constant.enums.database;

import lombok.Getter;

/**
 * 组合式任务步骤状态枚举
 */
@Getter
public enum StockComposeTaskStepStatusEnum {

    UNKNOWN(-1, "未知"),
    CREATE(0, "新建待执行"),
    RUNNING(1, "执行中"),
    COMPLETE(3, "已完成"),
    CANCEL(4, "已取消"),
    ERROR(5, "任务异常"),
    LEVEL_ORIGIN(6, "离开起点"),
    ARRIVE_DESTINATION(7, "到达终点");

    private final Integer code;
    private final String msg;

    StockComposeTaskStepStatusEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static StockComposeTaskStepStatusEnum getByCode(Integer code) {
        for (StockComposeTaskStepStatusEnum value : StockComposeTaskStepStatusEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return StockComposeTaskStepStatusEnum.UNKNOWN;
    }
}
