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 OrderManageRefundStatusEnum {


    /**
     * 全部退款
     */
    ALL(2, "全部退款"),
    /**
     * 部分退款
     */
    PART(1, "部分退款"),

    /**
     * 无退款
     */
    NO(0, "无退款");


    private final int value;
    private final String desc;

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