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


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

/**
 * @Description: 各种订单在统一订单完成情况的表示 setCompletState
 * @Author: linjinyu
 * @CreateDate: 7/14/20 3:32 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/14/20 3:32 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderCompletStateEnum {


//	统一订单的 只分三种 1-已完成 ; 2-未完成 ; 3-已取消

	已完成(1, "已完成"),
	未完成(2, "未完成"),
	已取消(3, "已取消"),
	;

	private Integer key;
	private String  desc;

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

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

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

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

}
