package com.fdkankan.common.constant;

/**
 * 发票类型
 */
public enum InvoiceType {

    NO_NEAD(1, "不需要发票"),
    ORDINARY(2, "普通发票"),
    SPECIAL(3, "专用发票");

    private Integer code;
    private String message;

    private InvoiceType(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer code() {
        return code;
    }

    public String message() {
        return message;
    }

    public static InvoiceType get(Integer code){
        InvoiceType[] values = InvoiceType.values();
        Integer enumValue = null;
        for(InvoiceType eachValue : values){
            enumValue = eachValue.code();
            if(enumValue.equals(code)){
                return eachValue;
            }
        }
        return null;
    }

}
