package com.goafanti.order.enums;

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

public enum NewDunState {
//	催款状态 0-未启动 1-催款中 ,2-已完成
	WQD(0,"未启动"),
	CKZ(1,"催款中"),
	YWZ(2,"已完成"),
	YZT(3,"已暂停"),
	INVALID(10, "INVALID");
	
	private NewDunState(Integer code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	public static String getValueByCode(Integer code){
        for(NewDunState newDunState:NewDunState.values()){
            if(code.equals(newDunState.getCode())){
                return newDunState.getDesc();
            }
        }
        return  null;
    }
	private static Map<Integer, NewDunState> status = new HashMap<Integer, NewDunState>();

	static {
		for (NewDunState value : NewDunState.values()) {
			status.put(value.getCode(), value);
		}
	}
	public static NewDunState 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;
	}
}
