package com.jeesharp.business.modules.finance.paymentrecord.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 支付记录业务区分：支付或退款（与渠道约定数值保持一致）。
 *
 * @author jeesharp
 * @since 2026-05-09
 */
@Getter
@AllArgsConstructor
public enum PayRecordBizKindEnum {

    /**
     * 支付
     */
    PAY(0, "支付"),

    /**
     * 退款
     */
    REFUND(2, "退款");

    private final Integer value;
    private final String desc;

    public static PayRecordBizKindEnum fromValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (PayRecordBizKindEnum e : values()) {
            if (e.value.equals(value)) {
                return e;
            }
        }
        return null;
    }

    public static String getDescByValue(Integer value) {
        PayRecordBizKindEnum e = fromValue(value);
        return e != null ? e.getDesc() : "";
    }
}
