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

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


/**
 * @Description: -1-失败;0-待命;1-成功
 * @Author: linjinyu
 * @CreateDate: 2020/12/21 下午7:18
 * @UpdateUser: linjinyu
 * @UpdateDate: 2020/12/21 下午7:18
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum SysQuartzScheduleTaskStatementOfAccountRunStateEnum {

	失败(-1, "失败"),
	待命(0, "待命"),
	成功(1, "成功"),
	;

	private Integer key;
	private String  desc;

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

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

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

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