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

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

/**
 * @Description: 客户结算(customerGoods)|积分结算(customerCredit)|供应商结算(supplierGoods)
 * @Author: linjinyu
 * @CreateDate: 2022/2/14 下午2:42
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/2/14 下午2:42
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceTypeMoudelEnum {

	客户结算("customerGoods", "客户结算"),
	积分结算("customerCredit", "积分结算"),
	供应商结算("supplierGoods", "供应商结算"),
	;

	private String key;
	private String desc;

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

	public String getKey() {
		return key;
	}

	public String getDesc() {
		return desc;
	}

	public static String getDesc(String key) {
		for (InvoiceTypeMoudelEnum c : InvoiceTypeMoudelEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}

		return "未知模块";
	}

	private static final Map<String, InvoiceTypeMoudelEnum> LOOKUP = new HashMap<>();

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

	public static InvoiceTypeMoudelEnum get(String key) {
		return LOOKUP.get(key);
	}
}
