package cn.iocoder.yudao.framework.common.template.vo;

import cn.iocoder.yudao.framework.common.enums.SocialTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述
 *
 * @author: yj
 * @date: 2024年02月25日 15:50
 */
@Schema(description = "RPC 服务 - 微信小程序订阅消息 Request DTO")
@Data
public class SubscribeMessageReqDTO {

    @Schema(description = "接收者（用户）的 openid", requiredMode = Schema.RequiredMode.REQUIRED, example = "o3bwX6Yw1bvbMAV-jUNjHrbrJu0I")
    @NotNull(message = "openid不能为空")
    private String toUser;

    @Schema(description = "所需下发的模板消息的id", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "模板消息的id不能为空")
    private String templateId;

    @Schema(description = "所需下发的模板消息的属性集合", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<MsgData> data = new ArrayList<>();

    @Schema(description = "跳转小程序类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "developer为开发版；trial为体验版；formal为正式版；默认为正式版")
    private String miniProgramState = "formal";

    @Schema(description = "是否跳转小程序 true 是 false 否 默认跳转", requiredMode = Schema.RequiredMode.REQUIRED)
    private Boolean jumpWxMaFlag;

    @Schema(description = "公众号跳转小程序appId(公众号消息需要跳转小程序时候传)", requiredMode = Schema.RequiredMode.REQUIRED, example = "developer为开发版；trial为体验版；formal为正式版；默认为正式版")
    private String miniAppId;

    @Schema(description = "小程序页面地址(公众号消息需要跳转小程序时候传)", requiredMode = Schema.RequiredMode.REQUIRED, example = "pages/home/index")
    private String page;

    /**
     * 社交平台的类型 (参见 {@link SocialTypeEnum} 枚举)
     */
    @Schema(description = "社交平台的类型")
    private Integer socialType;

    public void addData(MsgData data) {
        this.data.add(data);
    }
}
