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

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 店铺推广码常用渠道预设，供管理端选择；编码用于统计与 wx scene。
 *
 * @author jeesharp
 * @since 2026-06-26
 */
@Getter
@AllArgsConstructor
public enum MarketingChannelPresetEnum {

    DEFAULT("DEFAULT", "门店默认码", "店内通用扫码入会，适合门口、通用物料"),
    COUNTER("COUNTER", "前台台卡", "收银台、服务台放置"),
    POSTER("POSTER", "海报推广", "线下海报、易拉宝、展架"),
    WECHAT("WECHAT", "微信朋友圈", "私域图文、社群分享"),
    DOUYIN("DOUYIN", "抖音推广", "短视频、直播间引流"),
    XHS("XHS", "小红书", "笔记种草、探店分享");

    private final String code;
    private final String name;
    private final String description;

    public static MarketingChannelPresetEnum fromCode(String code) {
        if (code == null || code.isBlank()) {
            return null;
        }
        String normalized = code.trim().toUpperCase();
        for (MarketingChannelPresetEnum preset : values()) {
            if (preset.code.equals(normalized)) {
                return preset;
            }
        }
        return null;
    }

    public static String nameForCode(String code) {
        MarketingChannelPresetEnum preset = fromCode(code);
        return preset != null ? preset.getName() : code;
    }
}
