package com.goafanti.order.enums;

import java.util.HashMap;
import java.util.Map;

public enum OrderNewState {
	/** 待签单 **/
	DQD(0,"待签单 "),
	/** 签单待审 **/
	QDDS(1,"签单待审"),
	/** 签单审核通过 **/
	QDSHTG(2,"签单审核通过"),
	/** 签单审核拒绝 **/
	QDSHJJ(3, "签单审核拒绝"),
	/** 已结项 **/
	YJX(4, "已结项"),
	/** 已驳回 **/
	YBH(5, "已驳回"),
	/** 退单中 **/
	TDZ(6, "退单中"),
	/** 已退单 **/
	YTD(7, "已退单");
	
	private OrderNewState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	private static Map<Integer, OrderNewState> status = new HashMap<Integer, OrderNewState>();

	static {
		for (OrderNewState value : OrderNewState.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static OrderNewState getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return DQD;
	}
	
	public static String getValueByCode(Integer code){
        for(OrderNewState orderNewState:OrderNewState.values()){
            if(code.equals(orderNewState.getCode())){
                return orderNewState.getDesc();
            }
        }
        return  null;
    }
	
	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	private Integer	code;
	private String	desc;
	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;
	}
	
	
}
