package cn.axzo.msg.center.service.template.request;

import cn.axzo.msg.center.service.dto.MessageDetailRouteStrategyDTO;
import cn.axzo.msg.center.service.dto.MessageCardContentItemDTO;
import cn.axzo.msg.center.service.dto.MessageButtonRouteStrategyDTO;
import cn.axzo.msg.center.service.enums.MessageCategoryEnum;
import cn.axzo.msg.center.service.enums.MessageGroupCategoryEnum;
import cn.axzo.msg.center.service.enums.PushTerminalEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @description
 *
 * @author cold_blade
 * @date 2023/9/26
 * @version 1.0
 */
@Setter
@Getter
public class MessageTemplateCreateRequest implements Serializable {

    private static final long serialVersionUID = -2894419272913799317L;

    /**
     * 操作者的自然人id
     */
    @NotNull(message = "operatorId is required")
    private Long operatorId;
    /**
     * 操作人人姓名
     */
    private String operatorName;
    /**
     * 模板名称
     */
    @NotBlank(message = "templateName is required")
    private String templateName;
    /**
     * 消息类型
     *   NOTIFICATION: 通知
     *   PENDING: 待办
     */
    @NotNull(message = "category is required")
    private MessageGroupCategoryEnum category;
    /**
     * 消息类型
     *   BIZ_PENDING_MESSAGE: 业务待办
     *   APPROVAL_PENDING_MESSAGE: 审批待办
     */
    private MessageCategoryEnum subCategory;
    /**
     * 消息分类树的叶结点的结点编码列表
     */
    @NotEmpty(message = "leafGroupNodes is required")
    private List<String> leafGroupNodes;
    /**
     * 推送终端配置
     *   B_ENTERPRISE_APP: B-安心筑企业版
     *   C_WORKER_APP: C-安心筑工人版
     */
    private List<PushTerminalEnum> pushTerminals;
    /**
     * 该模板最低支持的APP版本号
     */
    private String minAppVersion;
    /**
     * 消息标题
     */
    @NotBlank(message = "msgTitle is required")
    private String msgTitle;
    /**
     * 消息内容
     */
    @NotBlank(message = "msgContent is required")
    private String msgContent;
    /**
     * 消息图标
     */
    private String msgIcon;
    /**
     * 消息卡片信息标签列表，可为空
     */
    private List<MessageCardContentItemDTO> msgCardContentItems;
    /**
     * 详情展示策略
     */
    private MessageDetailRouteStrategyDTO detailStrategy;
    /**
     * 路由策略列表
     */
    private List<MessageButtonRouteStrategyDTO> routers;
    /**
     * 待办样式, BIZ_COMMON: 业务待办能用, FLOW_COMMON: 审批待办能用, 其它动态配置的
     */
    private String detailStyleCode;

    private JSONObject pushData;

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
