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

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

public enum InvoiceInvoicedIsOverdueEnum {

	// 是否逾期:
	// -2-没办
	// -1-没办法判定(没有任务开票记录);
	//  0-没有;
	//  1-逾期;

	正常(0, "正常"),
	逾期(1, "逾期"),
	;

	private Integer key;
	private String  desc;

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

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

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

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