package com.jeesharp.business.modules.marketing.memberTenant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 会员-店铺入会来源枚举。
 *
 * @author jeesharp
 * @since 2026-06-25
 */
@Getter
@AllArgsConstructor
public enum MemberTenantJoinSourceEnum {

    QR_SCAN("QR_SCAN", "扫码入会"),
    ADMIN("ADMIN", "后台绑定"),
    IMPORT("IMPORT", "导入"),
    MINI_APPLY("MINI_APPLY", "小程序申请");

    private final String value;
    private final String desc;

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

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