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

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

/**
 * @Description: 线下开票(offLine)|深圳航信电子发票(szhtxxElectronicInvoice)
 * @Author: linjinyu
 * @CreateDate: 2022/2/14 下午2:42
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/2/14 下午2:42
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceTypeMoudelXModeEnum {

	线下开票("offLine", "线下开票"),
	深圳航信电子发票("szhtxxElectronicInvoice", "深圳航信电子发票"),
	深圳航信纸质发票("szhtxxPaperInvoice", "深圳航信纸质发票"),
	;

	private String key;
	private String desc;

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

		return "未知方式";
	}

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

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

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