package com.fs.qw.vo;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
* 企微sop附件的消息内容
*/
@Data
public class QwSopTempSetting implements Serializable{
    //模板名称
    private String name;
    private List<Content> content;

    @Data
    public static class Content implements Cloneable {

        //普通/课程/订单/ai
        private Long id;
        private int type;

        private String contentType;

        private List<Setting> setting;

        //时间
        private String time;

        private String isOfficial;//是否企微官方接口
        //课程
        private Long courseId;
        //课节
        private Long videoId;

        //消息类型 -普通0/待看课1/看课中断2/已完课3/待看和中断4
        private Integer courseType;

        private String aiTouch;

        private String addTag;

        private String delTag;

        @Override
        public Content clone() {
            try {
                Content clone = (Content) super.clone();
                // 深克隆 setting 列表
                if (this.setting != null) {
                    clone.setting = new ArrayList<>();
                    for (Setting originalSetting : this.setting) {
                        clone.setting.add(originalSetting.clone());
                    }
                } else {
                    clone.setting = new ArrayList<>(); // 初始化为空列表
                }
                return clone;
            } catch (CloneNotSupportedException e) {
                throw new AssertionError();
            }
        }

        @Data
        public static class Setting  implements Serializable,Cloneable {
            /**
             * QwSopLog的主键(用于发送)
             */
            private Long id;
            private Long sopLogId;
            private Integer intervalTime;
            private String talkType;
            /**
             * 员工的id(用于发送)
             */
            private String qwUserid;
            /**
             * 客户的id(用于发送)
             */
            private String externalUserId;
            //文本-图片-链接-小程序-文件-视频-语音-视频号-app
            private String contentType;
            //文本
            private String value;
            //图片
            private String imgUrl;
            //链接标题
            private String linkTitle;
            //链接描述
            private String linkDescribe;
            //链接封面
            private String linkImageUrl;
            //链接地址
            private String linkUrl;
            //发送app消息的链接
            private String appLinkUrl;

            /** 小程序appid */
            private String miniprogramAppid;

            /** 小程序消息标题 */
            private String miniprogramTitle;

            /** 小程序封面地址 */
            private String miniprogramPicUrl;


            /** 小程序page路径 */
            private String miniprogramPage;

            //文件地址
            private String fileUrl;
            //视频地址
            private String videoUrl;
            //语音地址
            private String voiceUrl;
            // 封面标题
            private String nickname;
            //头像
            private String avatar;
            //封面图片地址
            private String coverUrl;
            //封面图片地址
            private String thumbUrl;
            //简介
            private String desc;
            //视频地址
            private String url;
            //标识
            private String extras;
            //时长
            private String voiceDuration;
            //是否绑定课程链接
            private String isBindUrl;
            //链接过期时间
            private Integer expiresDays;

            @Override
            public Setting clone() {
                try {
                    Setting clone = (Setting) super.clone();
                    clone.setValue(this.getValue());
                    clone.setLinkUrl(this.getLinkUrl());
                    clone.setAppLinkUrl(this.getAppLinkUrl());
                    return clone;
                } catch (CloneNotSupportedException e) {
                    throw new AssertionError();
                }
            }

        }

    }

}


