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 BILL_STATUS {

    CREATED("CREATED","已经创建"),
    DISTRIBUTED("DISTRIBUTED","已经下发"),
    PRE_POSITION("PRE_POSITION","正在预占库存"),
    POSITIONED("POSITIONED","预占库存完毕"),
    POSITION_ERROR("POSITION_ERROR","预占库存失败"),
    BATCH_LIMIT("BATCH_LIMIT","超过批号上限"),
    WORKSTAGE_FOUND("WORKSTAGE_FOUND","找到可用的集货区"),
    WORKSTAGE_ERROR("WORKSTAGE_ERROR","找不到可用的集货区"),
    PICKED("PICKED","拣货完成"),
    PACKAGED("PACKAGED","打包完成"),
    INNER_CHECKED("INNER_CHECKED","内复核完成"),
    INNER_CHECK_ERROR("INNER_CHECK_ERROR","内复核失败"),
    OUT_CHECKED("OUT_CHECKED","外复核"),
    OUT_CHECK_ERROR("OUT_CHECK_ERROR","外复核错误"),
    COMPLETED("COMPLETED","已经完成"),
    CANCELED("CANCELED","已经取消"),
    MERGED("MERGED","已经合并"),
    ERP_CANCELED("ERP_CANCELED","上游取消订单");

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

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


    public String getCode() {
        return code;
    }

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

    private String code;
    private String name;

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

}