package com.goafanti.order.enums;

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

public enum OrderDunSubject {
	/** 订单审核通过 **/
	DDSHTG(12,"订单审核通过"),
	/** 项目待提交 **/
	XMDTJ(20,"项目待提交"),
	/** 项目已提交 **/
	XMYTJ(21,"项目已提交"),
	/** 项目评审 **/
	XMPS(22,"项目评审"),
	/** 项目立项 **/
	XMLS(23,"项目立项"),
	/** 项目公示 **/
	XMGS(24,"项目公示"),
	/** 项目抽查 **/
	XMCC(25,"项目抽查"),
	/** 项目备案 **/
	XMBA(26,"项目备案"),
	/** 项目下证 **/
	XMXZ(27,"项目下证"),
	/** 项目验收 **/
	XMYS(28,"项目验收"),
	/** 项目拨款 **/
	XMBK(29,"项目拨款"),
	/** 无效 **/
	INVALID(10, "INVALID");
	
	private OrderDunSubject(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

	static {
		for (OrderDunSubject value : OrderDunSubject.values()) {
			status.put(value.getCode(), value);
		}
	}
	
	public static String getValueByCode(Integer code){
        for(OrderDunSubject orderDunSubject:OrderDunSubject.values()){
            if(code.equals(orderDunSubject.getCode())){
                return orderDunSubject.getDesc();
            }
        }
        return  null;
    }
	public static OrderDunSubject getStatus(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return INVALID;
	}
	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;
	}
}
