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

import lombok.NoArgsConstructor;

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


/**
 * @Description: 是否作废:0-正常;1-作废
 * @Author: linjinyu
 * @CreateDate: 2021/8/10 下午12:18
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/8/10 下午12:18
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@NoArgsConstructor
public enum InvoiceInvoicedIsInvalidEnum {


	正常(0, "正常"),
	作废(1, "作废"),
	;

	private Integer key;
	private String  desc;

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

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

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

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