package com.goafanti.common.enums;

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

public enum CustomerStatusFiled {
	/** 新客户 **/
	STATUS_NEW(0,"新客户"),
	/** 意向客户 **/
	STATUS_INTENTION(1,"意向客户"),
	/** 重点客户 **/
	STATUS_POINT(2,"重点客户"),
	/** 面谈客户  **/
	STATUS_INTERVIEW(3,"面谈客户"),
	/** 签单客户 **/
	STATUS_SIGN(4,"签单客户"),
	/** 被拒绝客户 **/
	STATUS_REFUSE(5,"被拒绝客户"),
	/** 停止跟进 **/
	STATUS_STOP(6,"停止跟进"),
	/** 未知  **/
	OTHER(-1,"未知");
	
	private static Map<Integer, CustomerStatusFiled> status = new HashMap<Integer, CustomerStatusFiled>();

	static {
		for (CustomerStatusFiled value : CustomerStatusFiled.values()) {
			status.put(value.getCode(), value);
		}
	}

	public static CustomerStatusFiled getField(Integer code) {
		if (containsType(code)) {
			return status.get(code);
		}
		return OTHER;
	}

	public static String getFieldDesc(Integer code) {
		return getField(code).getDesc();
	}

	public static boolean containsType(Integer code) {
		return status.containsKey(code);
	}
	private CustomerStatusFiled(Integer code,String desc){
		this.code = code;
		this.desc = desc;
	};
	
	private Integer code;
	private String desc;
	public Integer getCode() {
		return code;
	}
	public String getDesc() {
		return desc;
	} 
}
