package com.gxwebsoft.hjm.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Map;

/**
 * 微信小程序订阅消息请求
 *
 * @author 科技小王子
 * @since 2025-06-15
 */
@Data
@Schema(name = "SubscribeMessageRequest", description = "微信小程序订阅消息请求")
public class SubscribeMessageRequest {

    @Schema(description = "接收者openid", required = true)
    private String toUser;

    @Schema(description = "所需下发的订阅模板id", required = true)
    private String templateId;

    @Schema(description = "点击模板卡片后的跳转页面，仅限本小程序内的页面。支持带参数,（示例index?foo=bar）。该字段不填则模板无跳转。")
    private String page;

    @Schema(description = "跳转小程序类型：developer为开发版；trial为体验版；formal为正式版；默认为正式版")
    private String miniprogramState = "formal";

    @Schema(description = "进入小程序查看的语言类型，支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文)，默认为zh_CN")
    private String lang = "zh_CN";

    @Schema(description = "模板内容，格式形如 { \"key1\": { \"value\": any }, \"key2\": { \"value\": any } }", required = true)
    private Map<String, SubscribeDataItem> data;

    /**
     * 订阅消息数据项
     */
    @Data
    @Schema(name = "SubscribeDataItem", description = "订阅消息数据项")
    public static class SubscribeDataItem {
        @Schema(description = "数据值", required = true)
        private String value;

        public SubscribeDataItem() {}

        public SubscribeDataItem(String value) {
            this.value = value;
        }
    }
}
