package com.xunhong.erp.turbo.api.infra.dto.common;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.xunhong.erp.turbo.api.infra.dto.enums.SettingKeyEnum;


// 使用Jackson的多态类型处理
@JsonTypeInfo(
	use = JsonTypeInfo.Id.NAME,
	property = "settingKey",  // 这个字段会在序列化/反序列化时作为类型标识
	visible = true  // 确保反序列化时能读取到这个字段
)
@JsonSubTypes({
	@JsonSubTypes.Type(value = WxMaConfigValue.class, name = "WX_MA_CONFIG"),
	@JsonSubTypes.Type(value = WxMaMessagePushConfigValue.class, name = "WX_MA_MESSAGE_PUSH_CONFIG"),
	@JsonSubTypes.Type(value = WxMaSubscribeMessageConfigValue.class, name = "WX_MA_SUBSCRIBE_MESSAGE_CONFIG"),
	@JsonSubTypes.Type(value = WxMaCodeUploadConfigValue.class, name = "WX_MA_CODE_UPLOAD_CONFIG"),
	@JsonSubTypes.Type(value = WxPayConfigValue.class, name = "WX_PAY_CONFIG"),
	@JsonSubTypes.Type(value = WxMpConfigValue.class, name = "WX_MP_CONFIG"),
	@JsonSubTypes.Type(value = WxMpMessagePushConfigValue.class, name = "WX_MP_MESSAGE_PUSH_CONFIG"),
	@JsonSubTypes.Type(value = AliPayConfigValue.class, name = "ALI_PAY_CONFIG"),
	@JsonSubTypes.Type(value = ChargingPilePurchaseConfig.class, name = "CHARGING_PILE_PURCHASE_CONFIG"),
	@JsonSubTypes.Type(value = CustomThemeConfigValue.class, name = "CUSTOM_THEME_CONFIG"),
	@JsonSubTypes.Type(value = CustomMenuConfigValue.class, name = "CUSTOM_MENU_CONFIG"),
	@JsonSubTypes.Type(value = WxCpNotifyConfigValue.class, name = "WX_CP_NOTIFY_CONFIG"),
	@JsonSubTypes.Type(value = TencentMapConfigValue.class, name = "TENCENT_MAP_CONFIG"),
	@JsonSubTypes.Type(value = SmartRecognitionPromptValue.class, name = "SMART_RECOGNITION_PROMPT"),
})
public interface SettingValue {
	// 必须包含获取类型标识的方法
	@JsonIgnore
	// 避免重复序列化（如果实现类已经有该字段）
	SettingKeyEnum getSettingKey();
}
