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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @Author: caiwq
 * @Date: 2023/9/15 15:18
 * @Description: 订单中心发票状态枚举类型
 */
@Getter
@AllArgsConstructor
public enum OrderCloseStatusEnum {


    /**
     * 超时关闭
     */
    TIMEOUT(1, "超时关闭"),
    /**
     * 用户关闭
     */
    USER(2, "用户关闭"),

    /**
     * 异常关闭
     */
    ABNORMAL(3, "异常关闭"),

    /**
     * 后台关闭
     */
    PC(4, "后台关闭");

    private final int value;
    private final String desc;

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