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

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

/**
 * @Description: 是否红冲:0-否;1-是;
 * @Author: linjinyu
 * @CreateDate: 2021/7/27 下午4:51
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/7/27 下午4:51
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
public enum InvoiceInvoicedIsRedWriteOffEnum {

	否(0, "否"),
	是(1, "是"),
	;

	private Integer key;
	private String  desc;

	InvoiceInvoicedIsRedWriteOffEnum(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 (InvoiceInvoicedIsRedWriteOffEnum c : InvoiceInvoicedIsRedWriteOffEnum.values()) {
			if (c.key.equals(key)) {
				return c.getDesc();
			}
		}
		return "未知状态";
	}

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

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

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