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

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

/**
 * @Description: 积分类型
 * @Author: linjinyu
 * @CreateDate: 2022/2/18 下午2:11
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/2/18 下午2:11
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderCreditTypeDefaultEnum {


	微信支付(0, "微信支付"),
	福利积分(1, "福利积分"),
	工会积分(2, "工会积分"),
	生日积分(3, "生日积分"),
	饭堂积分(4, "饭堂积分"),
	扶贫积分(5, "扶贫积分"),
	商务定制采购(7, "商务定制采购"),
	业主专享积分(8, "业主专享积分"),
	温暖积分(9, "温暖积分"),
	春节积分(10, "春节积分"),
	积分支付(11,"积分支付"),
	;

	/**
	 * credit_type
	 */
	private Integer key;
	/**
	 * credit_name
	 */
	private String  desc;

	UnifiedOrderCreditTypeDefaultEnum(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 (UnifiedOrderCreditTypeDefaultEnum c : UnifiedOrderCreditTypeDefaultEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
		return "未知积分类型";
	}

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

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

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