package com.goafanti.order.enums;

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

public enum OrderProjectStatus {
	//项目状态 0-项目待提交 1-项目已提交，2-项目评审，3-项目立项，4-项目公示，5-项目抽查，6-项目备案，
	//7-项目下证，8-项目验收，9-项目拨款 10- 项目进度10% 11- 项目进度30% 12- 项目进度70%
	XMDTJ(0,"项目待提交"),
	XMYTJ(1,"项目已提交"),
	XMPS(2,"项目评审"),
	XMLX(3,"项目立项"),
	XMGS(4,"项目公示"),
	XMCC(5,"项目抽查"),
	XMBA(6,"项目备案"),
	XMXZ(7,"项目下证"),
	XMYS(8,"项目验收"),
	XMBK(9,"项目拨款"),
	XMJD10(10,"项目进度10%"),
	XMJD30(11,"项目进度30%"),
	XMJD70(12,"项目进度70%"),
	INVALID(99,"未知");
	
	
	private OrderProjectStatus(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}

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

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