package com.goafanti.order.enums;

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

public enum NewOrderDunType {
	CGZH_ZDY(10,"成果转化-"),
	CGZH_SQ(11,"成果转化-首期"),
	CGZH_WC(12,"成果转化-完成"),
	COMMON_ZDY(20,"通用-"),
	COMMON_SQ(21,"通用-首期"),
	COMMON_NGS(22,"通用-拟公示"),
	COMMON_XZ(23,"通用-下证"),
	KJXM_ZDY(30,"科技项目-"),
	KJXM_SQ(31,"科技项目-首期"),
	KJXM_LX(32,"科技项目-立项(公示)"),
	KJXM_BK(33,"科技项目-拨款"),
	KJJR_ZDY(40,"科技金融-"),
	KJJR_SQ(41,"科技金融-首期"),
	KJJR_BK(42,"科技金融-拨款"),
	CS_ZDY(50,"财税-"),
	CS_SQ(51,"财税-首期"),
	CS_DQ(52,"财税-期限"),
	HY_ZDY(60,"会员-"),
	HY_SQ(61,"会员-首期"),
	HY_DQ(62,"会员-期限"),
	RJKF_ZDY(70,"软件开发-"),
	RJKF_SQ(71,"软件开发-首期"),
	RJKF_LX(72,"软件开发-立项"),
	RJKF_WZ(73,"软件开发-完成"),
	ZSCQ_ZDY(80,"知识产权-"),
	ZSCQ_SQ(81,"知识产权-首期"),
	ZSCQ_GS_SL_XZ(82,"知识产权-公示/专利受理/软著下证"),
	ZSCQ_XZ(83,"知识产权-专利下证"),
	INVALID(99,"未知");
	
	private NewOrderDunType(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

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