package com.bohuikeji.delivery.backstage.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bohuikeji.frame.module.admin.annotation.TableKeyField;
import com.bohuikeji.frame.module.admin.annotation.TableQueryField;
import com.bohuikeji.frame.module.admin.entity.web.block.TextBlock;
import com.bohuikeji.frame.module.admin.enums.ColumnTypeEnum;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import com.bohuikeji.frame.module.admin.annotation.TableShowField;
import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;


/**
 * <p>
 * 消息发布记录表
 * </p>
 *
 * @author 10552
 * @since 2019-08-22
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="TNews对象", description="消息发布记录表")
@TableName("t_news")
public class TNews extends EntityBase<TNews> {
    @ApiModelProperty(value = "消息id")
    @TableId(value = "news_id", type = IdType.AUTO)
    @TableShowField(value = "ID",id = true)
    @TableNewField(show = false,required = false)
    private Integer newsId;

    @ApiModelProperty(value = "消息分类(系统消息、业务通知)")
    @TableField("news_class")
    @TableQueryField
    @TableShowField("消息分类")
    private String newsClass="系统消息";

    @ApiModelProperty(value = "消息标题")
    @TableField("news_title")
    @TableShowField(value = "消息标题",type = ColumnTypeEnum.AUTO)
    @TableNewField()
    private String newsTitle;

    @ApiModelProperty(value = "消息描述(文本)")
    @TableField("news_desc")
    @TableShowField(value = "消息描述(文本)")
    @TableNewField(show = true,required = false)
    private String newsDesc;

    @ApiModelProperty(value = "通知内容(富文本html)")
    @TableField("news_content")
    @TableShowField(value = "通知内容",type = ColumnTypeEnum.AUTO)
    @TableNewField(block = TextBlock.class)
    private String newsContent;

    @ApiModelProperty(value = "消息类型(1、纯文字，2、富文本html)")
    @TableField("news_type")
    @TableShowField(value = "消息类型")
    private Integer newsType=2;

    @ApiModelProperty(value = "接收人id(群推设置为0)")
    @TableField("receive_user_id")
    @TableQueryField
    @TableShowField(value = "消息接收人")
    @TableKeyField(table = "t_customer",keyShowFields = "customer_name",keyLikeFields = "customer_name")
    @TableNewField(show = true,required = false)
    private Integer receiveUserId;


    @ApiModelProperty(value = "推送类型(1、单推，2、群推，0、全部)")
    @TableField("publish_type")
    @TableShowField(value = "推送类型")
    @TableNewField(options = {"0","1","2"})
    private Integer publishType;

    @ApiModelProperty(value = "是否已读(仅对单推有效)")
    @TableField("news_read")
    @TableShowField(value = "是否已读")
    private Boolean newsRead=false;

    @ApiModelProperty(value = "是否已推送(避免通知栏重复推送，第三方推送后设置为true，不考虑到达率)")
    @TableField("is_publish")
    @TableShowField(value = "是否已推送")
    private Boolean newsPublish=false;

    @ApiModelProperty(value = "消息推送模块")
    @TableField("publish_model")
    @TableQueryField
    @TableShowField(value = "消息推送模块")
    @TableNewField(options = {"t_courier","t_customer","全部"})
    private String publishModel;

    @ApiModelProperty(value = "消息创建时间")
    @TableField("create_time")
    @TableShowField(value = "消息创建时间")
    private LocalDateTime createTime;


    @ApiModelProperty(value = "过期时间(仅对群推有效)")
    @TableField("expiration_time")
    @TableShowField(value = "过期时间")
    @TableNewField(show = true,required = false)
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime expirationTime;


}
