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


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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/1/13 上午10:56
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/1/13 上午10:56
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum AccountingOrderLogicModeEnum {

	早期(10, "早期"),
	后期(20, "后期"),
	;

	private Integer key;
	private String  desc;

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

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

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

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