package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 推送任务表
 */
@Data
@JsonInclude
@TableName("common_push_task")
@ApiModel(value = "CommonPushTask", description = "推送任务表")
public class CommonPushTask implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("任务编号，全局唯一，自动生成")
    @TableField("task_no")
    private String taskNo;

    @ApiModelProperty("推送标题")
    @TableField("title")
    private String title;

    @ApiModelProperty("推送正文内容")
    @TableField("content")
    private String content;

    @ApiModelProperty("推送类型：1-交易类 2-系统类 3-运营类 4-社交类")
    @TableField("push_type")
    private Integer pushType;

    @ApiModelProperty("所选渠道数组，如 [\"notification\",\"inapp\"]")
    @TableField("channels")
    private String channels;

    @ApiModelProperty("通知栏样式：1-文本 2-大图 3-大文本 4-收件箱")
    @TableField("notification_style")
    private Integer notificationStyle;

    @ApiModelProperty("应用内类型：1-Banner 2-弹窗 3-卡片 4-全屏大图")
    @TableField("inapp_type")
    private Integer inappType;

    @ApiModelProperty("推送图片OSS地址")
    @TableField("image_url")
    private String imageUrl;

    @ApiModelProperty("跳转方式：1-首页 2-Deeplink 3-URL")
    @TableField("jump_type")
    private Integer jumpType;

    @ApiModelProperty("跳转链接")
    @TableField("jump_url")
    private String jumpUrl;

    @ApiModelProperty("附加键值参数JSON")
    @TableField("extra_params")
    private String extraParams;

    @ApiModelProperty("推送声音：default/silent/自定义声音名")
    @TableField("sound")
    private String sound;

    @ApiModelProperty("目标类型：1-全量 2-分组 3-标签 4-导入 5-条件")
    @TableField("target_type")
    private Integer targetType;

    @ApiModelProperty("目标配置JSON：分组ID/标签ID/表达式等")
    @TableField("target_config")
    private String targetConfig;

    @ApiModelProperty("创建时预估目标用户数")
    @TableField("estimated_count")
    private Integer estimatedCount;

    @ApiModelProperty("实际发送人数，完成后回填")
    @TableField("actual_count")
    private Integer actualCount;

    @ApiModelProperty("发送方式：1-立即 2-定时 3-周期 4-事件触发")
    @TableField("send_type")
    private Integer sendType;

    @ApiModelProperty("定时执行时间")
    @TableField("scheduled_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date scheduledAt;

    @ApiModelProperty("周期推送Cron表达式")
    @TableField("cron_expr")
    private String cronExpr;

    @ApiModelProperty("定时推送过期时间")
    @TableField("expire_at")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date expireAt;

    @ApiModelProperty("智能时机：0-否 1-是")
    @TableField("smart_timing")
    private Integer smartTiming;

    @ApiModelProperty("优先级：1-普通 2-高 3-紧急")
    @TableField("priority")
    private Integer priority;

    @ApiModelProperty("任务状态：0-草稿 1-待审核 2-已发送 3-已送达 4-失败 5-审核通过 6-驳回")
    @TableField("status")
    private Integer status;

    @ApiModelProperty("运营内部备注")
    @TableField("remark")
    private String remark;

    @ApiModelProperty("关联消息模板ID")
    @TableField("template_id")
    private Long templateId;

    @ApiModelProperty("各厂商推送任务ID，格式：oppo_task_id: 1001, honor_task_id: 10056")
    @TableField("vendor_task_ids")
    private String vendorTaskIds;

    @ApiModelProperty("删除标记，0:未删除，1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty("创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty("创建人ID")
    @TableField("created_user_id")
    private Integer createdUserId;

    @ApiModelProperty("修改时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty("修改人ID")
    @TableField("updated_user_id")
    private Integer updatedUserId;
}
