package com.gxwebsoft.common.system.entity;

import com.baomidou.mybatisplus.annotation.*;

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

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 聊天消息表
 *
 * @author 科技小王子
 * @since 2024-04-27 15:57:27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "ChatMessage对象", description = "聊天消息表")
@TableName("sys_chat_message")
public class ChatMessage implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "自增ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @Schema(description = "发送人ID")
    private Integer formUserId;

    @Schema(description = "接收人ID")
    private Integer toUserId;

    @Schema(description = "消息类型")
    private String type;

    @Schema(description = "消息内容")
    private String content;

    @Schema(description = "屏蔽接收方")
    private Integer sideTo;

    @Schema(description = "屏蔽发送方")
    private Integer sideFrom;

    @Schema(description = "是否撤回")
    private Integer withdraw;

    @Schema(description = "文件信息")
    private String fileInfo;

    @Schema(description = "存在联系方式")
    private Integer hasContact;

    @Schema(description = "状态, 0未读, 1已读")
    private Integer status;

    @Schema(description = "是否删除, 0否, 1是")
    @TableLogic
    private Integer deleted;

    @Schema(description = "租户id")
    private Integer tenantId;

    @Schema(description = "注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @Schema(description = "发送人昵称")
    @TableField(exist = false)
    private String formUserName;

    @Schema(description = "发送人头像")
    @TableField(exist = false)
    private String formUserAvatar;

    @Schema(description = "接收人昵称")
    @TableField(exist = false)
    private String toUserName;

    @Schema(description = "接收人头像")
    @TableField(exist = false)
    private String toUserAvatar;

}
