package com.jeesharp.business.modules.pay.paysubmerchantapplyment.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商户注销资格校验结果（微信 validate_result）。
 *
 * @author jeesharp
 * @since 2026-06-15
 */
@Getter
@AllArgsConstructor
public enum PaySubMerchantCancelValidateResultEnum {

    /** 可发起注销 */
    ALLOW_CANCEL_WITHDRAW("ALLOW_CANCEL_WITHDRAW", "可发起注销"),

    /** 不可发起注销 */
    NOT_ALLOW_CANCEL_WITHDRAW("NOT_ALLOW_CANCEL_WITHDRAW", "不可发起注销");

    private final String value;
    private final String desc;

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

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