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


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

/**
 * @Description: 订单类型:1-订单;2-退单;
 * @Author: linjinyu
 * @CreateDate: 2021/6/28 下午5:49
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/6/28 下午5:49
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum CommonOrderTypeEnum {

	订单(1, "订单"),
	退单(2, "退单"),

	;

	private Integer key;
	private String  desc;

	CommonOrderTypeEnum(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 (CommonOrderTypeEnum c : CommonOrderTypeEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
		return null;
	}

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

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

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