package com.yuchen.saas.payment.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/10/7 15:18
 * @Description: 开票方式枚举类型
 */
@Getter
@AllArgsConstructor
public enum SaasInvoiceBuildTypeEnum {

    /**
     * 手动生成
     */
    HANDLE(1, "手动生成"),
    /**
     * 自动生成
     */
    AUTO(2, "自动生成");


    private final int value;
    private final String desc;

    public static String getDescByCode(Integer value) {
        if (Objects.isNull(value)) {
            return "";
        }
        SaasInvoiceBuildTypeEnum[] enumArray = SaasInvoiceBuildTypeEnum.values();
        for (SaasInvoiceBuildTypeEnum e : enumArray) {
            if (e.getValue() == value) {
                return e.getDesc();
            }
        }
        return "";
    }
}
