package com.brframework.commonapppush.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.brframework.commoncms.annatotion.column.SelectColumn;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * 推送记录
 * @author xu
 * @date 2019/11/18 19:09
 */
@Data
@Entity
@Table(name = "pus_log")
@ApiModel
public class PushLog {
    /** 单播 */
    public static final String MESSAGE_TYPE_UNICAST = "unicast";
    /** 列播  要求不超过500个device_token */
    public static final String MESSAGE_TYPE_LISTCAST = "listcast";
    /** 文件播  多个device_token可通过文件形式批量发送 */
    public static final String MESSAGE_TYPE_FILECAST = "filecast";
    /** 广播 */
    public static final String MESSAGE_TYPE_BROADCAST = "broadcast";
    /** 组播，按照filter筛选用户群, 请参照filter参数 */
    public static final String MESSAGE_TYPE_GROUPCAST = "groupcast";

    /** 已发送 */
    public static final Integer STATUS_OK = 1;
    /** 发送错误 */
    public static final Integer STATUS_ERROR = 2;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "id", required = true, example = "1")
    Long id;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间", required = true, example = "2019-04-24 16:23:19")
    @Column(updatable = false)
    LocalDateTime createDate;

    @ApiModelProperty(value = "消息类型")
    @SelectColumn(options = {"unicast,单播", "listcast,列播", "filecast,文件播", "broadcast,广播", "groupcast,组播"})
    String messageType;

    @ApiModelProperty(value = "消息id")
    String messageId;

    @ApiModelProperty(value = "状态")
    @SelectColumn(options = {"1,已发送", "2,失败"})
    Integer status;

    @ApiModelProperty(value = "错误信息")
    String errorInfo;

    @ApiModelProperty(value = "系统")
    String os;

    @ApiModelProperty(value = "客户端标识")
    String deviceTokens;

    @ApiModelProperty(value = "系统用户标识")
    String userTokens;

    @ApiModelProperty(value = "消息标题")
    String title;

    @ApiModelProperty(value = "消息内容")
    String text;

    @ApiModelProperty(value = "跳转(android有效)")
    String uri;

    @ApiModelProperty(value = "消息描述")
    String description;



}
