package com.fs.qw.vo;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class QwChatSopTempSetting {
    // 模板名称
    private String name;
    private List<Content> content;

    @Data
    public static class Content implements Cloneable {
        // 普通/课程/订单
        private int type;
        private String contentType;
        private List<Setting> setting;
        private String time;
        @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 sopLogId;

            private Integer intervalTime;
            /**
             * 员工的id(用于发送)
             */
            private String qwUserid;
            /**
             * 客户的id(用于发送)
             */
            private String externalUserId;
            // 文本-图片-链接-文件-视频-语音
            private String contentType;
            // 文本
            private String value;

            private String talkType;

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

