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

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

/**
 * @Description: //状态 -1:已关闭,0:待付款,1:待发货,2:待收货,3:已完成
 * 商城 面向客户看的 订单状态
 * @Author: linjinyu
 * @CreateDate: 7/8/20 11:44 AM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/8/20 11:44 AM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum UnifiedOrderPayStateFace2CustomerEnum {


	已关闭(-1, "已关闭"),
	待付款(0, "待付款"),
	待发货(1, "待发货"),
	待收货(2, "待收货"),
	已完成(3, "已完成"),
	;

	private Integer key;
	private String  desc;

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

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

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

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

}
