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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 分账回退单状态枚举。
 *
 * @author jeesharp
 * @since 2026-06-11
 */
@Getter
@AllArgsConstructor
public enum ProfitSharingReturnStatusEnum {

    PENDING("PENDING", "待发起"),
    PROCESSING("PROCESSING", "处理中"),
    SUCCESS("SUCCESS", "成功"),
    FAIL("FAIL", "失败");

    private final String value;
    private final String desc;

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

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