package cn.iocoder.yudao.module.system.api.subscribe.dto;

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, example = "OnJjp5pdjG1PHMoELYaqp3Xq8jWZ5E6ndO0clEIQ4tk")
    @NotNull(message = "模板消息的id不能为空")
    private String templateId;

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

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

    @Schema(description = "小程序页面地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "pages/home/index")
    @NotNull(message = "小程序页面地址不能为空")
    private String page;

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