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

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 7/9/20 7:56 PM
 * @UpdateUser: linjinyu
 * @UpdateDate: 7/9/20 7:56 PM
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SuperDeskMallOrderStatusEnum {

//	    -1 => array('css' => 'default', 'name' => '已关闭'),
//    0  => array('css' => 'danger', 'name' => '待付款'),
//    1  => array('css' => 'info', 'name' => '待发货'),
//    2  => array('css' => 'warning', 'name' => '待收货'),
//    3  => array('css' => 'success', 'name' => '已完成')


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

	private Integer key;
	private String  desc;

	SuperDeskMallOrderStatusEnum(int key, String desc) {
		this.key = key;
		this.desc = desc;
	}

	public int getKey() {
		return key;
	}

	public String getDesc() {
		return desc;
	}

	public static String getDesc(int key) {
		for (SuperDeskMallOrderStatusEnum c : SuperDeskMallOrderStatusEnum.values()) {
			if (c.key == key) {
				return c.getDesc();
			}
		}
		return null;
	}

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

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

	/**
	 * 方向查找枚举类
	 *
	 * @param key
	 * @return
	 */
	public static SuperDeskMallOrderStatusEnum get(Integer key) {
		return LOOKUP.get(key);
	}
}
