package org.wcs.constant.enums.database;

import lombok.Getter;
import lombok.Setter;

/**
 * 堆垛机库位状态枚举
 */
@Getter
public enum StackerLocationStatusEnum {

    UNKNOWN(-1, "未知"),
    EMPTY(0, "空闲"),
    IN_ING(1, "入库中"),
    OUT_ING(2, "出库中"),
    OCCUPY(3, "占用"),
    FORBIDDEN(9, "禁用");

    private final Integer code;
    private final String message;

    StackerLocationStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static StackerLocationStatusEnum getMessageByCode(Integer code) {
        for (StackerLocationStatusEnum value : StackerLocationStatusEnum.values()) {
            if (value.code.equals(code)) {
                return value;
            }
        }
        return StackerLocationStatusEnum.UNKNOWN;
    }
}
