package com.prolog.cs.biz.outbound.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import io.swagger.annotations.ApiModel;

@ApiModel
public enum WAVE_STATUS {
    CREATED("CREATED", "已创建"),//已经创建
    DISTRIBUTED("DISTRIBUTED", "已经下发"),//已经下发到库存服务
    POSITIONED("POSITIONED", "库存已经预占"),//库存服务定位完成
    WORK_STAGE("WORK_STAGE", "计算集货区"),//计算集货区
    BATCH_LIMIT("BATCH_LIMIT","超过批号上限"),
    COUNT_CONTAINER("COUNT_CONTAINER", "计算容器任务"),//计算容器任务
    ERROR("ERROR", "错误"),
    CANCEL("CANCEL", "取消"),
    COMPLETED("COMPLETED", "已经完成"),
    AUTO_OUTBOUND_ERROR("AUTO_OUTBOUND_ERROR", "特殊订单自动出库出错");//特殊订单自动出库错误

    private String code;
    private String name;

    @Override
    public String toString() {
        return name;
    }


    @JsonCreator
    public static WAVE_STATUS getWaveStatusEnum(final String codeValue) {
        for (WAVE_STATUS e : values()) {
            if (e.code.equals(codeValue)) {
                return e;
            }
        }

        return null;
    }


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


    @JsonValue
    public String getName() {
        return name;
    }


    public String getCode() {
        return code;
    }

}
