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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 财务对账导出行类型：支付、分账、退款。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
@Getter
@AllArgsConstructor
public enum FinanceReconcileRecordTypeEnum {

    PAY("PAY", "支付"),
    SHARING("SHARING", "分账"),
    REFUND("REFUND", "退款");

    private final String value;
    private final String desc;

    public static FinanceReconcileRecordTypeEnum fromValue(String value) {
        if (value == null || value.isEmpty()) {
            return null;
        }
        for (FinanceReconcileRecordTypeEnum item : values()) {
            if (item.value.equals(value)) {
                return item;
            }
        }
        return null;
    }

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