package com.seer.teach.mp.admin.controller.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.List;

@Schema(description = "公众号菜单保存请求")
@Data
public class MpMenuSaveReq {

    @Schema(description = "公众号ID", required = true)
    @NotNull(message = "公众号ID不能为空")
    private Integer accountId;

    @Schema(description = "菜单配置JSON字符串")
    @Valid
    private List<Button> button;

    @Schema(description = "菜单按钮结构")
    @Data
    public static class Button {
        
        @Schema(description = "菜单的响应动作类型", example = "click")
        @Size(max = 32, message = "菜单类型长度不能超过32个字符")
        private String type;

        @Schema(description = "菜单标题", required = true, example = "今日歌曲")
        @NotBlank(message = "菜单标题不能为空")
        @Size(max = 60, message = "菜单标题长度不能超过60个字符")
        private String name;

        @Schema(description = "菜单KEY值", example = "V1001_TODAY_MUSIC")
        @Size(max = 128, message = "菜单KEY值长度不能超过128个字符")
        private String key;

        @Schema(description = "网页链接", example = "http://www.soso.com/")
        @Size(max = 1024, message = "网页链接长度不能超过1024个字符")
        private String url;

        @Schema(description = "媒体文件ID", example = "MEDIA_ID1")
        @Size(max = 128, message = "媒体文件ID长度不能超过128个字符")
        private String mediaId;

        @Schema(description = "小程序的appid", example = "wx286b93c14bbf93aa")
        @Size(max = 32, message = "小程序appid长度不能超过32个字符")
        private String appid;

        @Schema(description = "小程序的页面路径", example = "pages/lunar/index")
        @Size(max = 128, message = "小程序页面路径长度不能超过128个字符")
        private String pagepath;

        @Schema(description = "发布后获得的合法 article_id", example = "ARTICLE_ID1")
        @Size(max = 128, message = "文章ID长度不能超过128个字符")
        private String articleId;

        @Schema(description = "二级菜单结构体数组")
        @Valid
        private List<Button> subButton;
    }
}
