package com.freemud.sdk.api.assortment.order.enums;

/**
 * 老订单状态
 * @author guolm
 */
public enum OldOrderStatus {

    TAKE_ORDER(1, "下单"),
    WAIT_PAY(2, "待支付"),
    RECEIPT(3, "接单"),
    DISTRIBUTION(4, "配送中"),
    COMPLETE(5, "完成"),
    CALCEL(6, "取消"),
    REFUSE(7,"拒单"),
    COMPLETE_MAKE(31, "制作完成");

    private Integer code;
    private String desc;

    OldOrderStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static Integer[] getAllCodes() {
        Integer[] codeArray = new Integer[values().length];
        int i = 0;
        for (OldOrderStatus oldOrderStatus : values()) {
            codeArray[i] = oldOrderStatus.getCode();
            i++;
        }
        return codeArray;
    }

    public static OldOrderStatus getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (OldOrderStatus oldOrderStatus : values()) {
            if (oldOrderStatus.getCode().equals(code)) {
                return oldOrderStatus;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
