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

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

/**
 * @Description: error
 * @Author: linjinyu
 * @CreateDate: 7/8/20 11:44 AM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/8/20 11:44 AM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderPayStateEnum {

//	0 未支付
//	1 已支付
//	2 未支付
//	3 什么
	NONE(0, "未支付"),
	SALE(1, "已支付"),
	NO_SALE(2, "未支付"),
	PART(3, "部分付款"), // 20200708 终于在文档上找到说明,也查证程序,大概是对的

//  标记 经看代码后,这个是错的
//	NONE(1, "未支付"),
//	YET(2, "已支付"),
	;

	private Integer key;
	private String  desc;

	UnifiedOrderPayStateEnum(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 (UnifiedOrderPayStateEnum c : UnifiedOrderPayStateEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
		return "未支付";
	}

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

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

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

}
