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

import java.util.Objects;

/**
 * @Author: 宋少挺
 * @Description: 退款状态枚举
 */
public enum RefundStateEnum {


    /**
     * 退款中
     */
    ING(0,"退款中"),

    /**
     * 退款成功
     */
    SUCCESS(1,"退款成功"),

    /**
     * 退款失败
     */
    FAIL(2,"退款失败"),

    /**
     * 拒绝退款
     */
    REFUSE(3,"拒绝退款"),

    /**
     * 取消退款
     */
    CANCEL(4,"取消退款"),

    /**
     * 无需退款
     */
    NOT_NEED(5,"无需退款"),

    ;


    private final int value;
    private final String name;

    RefundStateEnum(int value, String name) {
        this.value = value;
        this.name=name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

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