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

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

/**
 * @Description: 作为最小单位,只有 0-未回款;1-已回款; 不存在部分回款
 * @Author: linjinyu
 * @CreateDate: 2021/1/19 下午12:57
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/1/19 下午12:57
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderGoodsBackAccountStatusEnum {

	未回款(0, "未回款"),
	已回款(1, "已回款"),
	;

	private Integer key;
	private String  desc;

	UnifiedOrderGoodsBackAccountStatusEnum(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 (UnifiedOrderGoodsBackAccountStatusEnum c : UnifiedOrderGoodsBackAccountStatusEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
//		return null;
		return "未开票";
	}

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

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

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