package cn.superdesk.uniorder.common.enums.order;


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

/**
 * @Description: 回款状态 0-未回款;1-部分回款;2-全部回款 ---- 源用发票申请的回款状态
 *
 * @Author: linjinyu
 * @CreateDate: 7/30/20 8:52 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/30/20 8:52 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderBackStatusEnum {

	未回款(0, "未回款"),
	部分回款(1, "部分回款"),
	全部回款(2, "全部回款"),
	;

	private Integer key;
	private String  desc;

	UnifiedOrderBackStatusEnum(Integer key, String desc) {
		this.key = key;
		this.desc = desc;
	}

	public Integer getKey() {
		return key;
	}

	public String getDesc() {
		return desc;
	}

	public static String getDesc(Integer key) {
		for (UnifiedOrderBackStatusEnum c : UnifiedOrderBackStatusEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
//		return null;
		return "未开票";
	}

	private static final Map<Integer, UnifiedOrderBackStatusEnum> LOOKUP = new HashMap<>();

	static {
		for (UnifiedOrderBackStatusEnum s : EnumSet.allOf(UnifiedOrderBackStatusEnum.class)) {
			LOOKUP.put(s.getKey(), s);
		}
	}

	public static UnifiedOrderBackStatusEnum get(Integer key) {
		return LOOKUP.get(key);
	}
}
