package com.webchat.domain.vo.response.mess;


import com.webchat.domain.vo.response.RedPacketDetailVO;
import com.webchat.domain.vo.response.UserBaseResponseInfoVO;
import lombok.Data;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;

@Data
public class ChatMessageResponseVO {


    /**
     * 对话消息类型
     */
    private Integer type;

    /***
     * 消息ID
     */
    private Long messId;

    /***
     * 当前用户
     */
    private String senderId;
    private UserBaseResponseInfoVO sender;

    /**
     * 消息代理对象（适用于群聊场景）
     */
    private String proxySenderId;
    private UserBaseResponseInfoVO proxySender;

    /***
     * 聊天对象
     */
    private String receiverId;
    private UserBaseResponseInfoVO receiver;

    /***
     * 消息文本正文
     */
    private String message;

    /***
     * 消息图片
     */
    private String image;

    /***
     * 消息发送时间
     */
    private Long time;

    /***
     * 消息状态
     */
    private Boolean isRead;

    /**
     * 是否来自群组消息
     */
    private Boolean groupMessage = false;

    /**
     * 来自红包通知
     */
    private Boolean redPacket = false;
    /**
     * 红包信息
     */
    private RedPacketDetailVO redPacketDetail;

    /**
     * 消息文章
     */
    private PublicAccountArticleMessageVO publicAccountArticle;

    /**
     * 是否来自音视频offer
     */
    private Boolean videoOffer = false;

    private Boolean rejectVideoOffer = false;

    private Boolean momentMessage = false;

    private String senderName;


    public String getPrintMessage() {
        if (ObjectUtils.equals(redPacket, true)) {
            return "红包来啦~";
        }
        if (StringUtils.isNotBlank(message)) {
            return message;
        }
        if (StringUtils.isNotBlank(image)) {
            return "[图片]";
        }
        return "无消息";
    }
}
