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


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

@Data
public class ChatMessageResponseVO {

    @ApiModelProperty("对话消息类型")
    private Integer type;

    @ApiModelProperty("消息ID")
    private Long messId;

    @ApiModelProperty("")
    private String senderId;
    @ApiModelProperty("消息发送人详情")
    private UserBaseResponseInfoVO sender;

    @ApiModelProperty("消息代理对象ID（适用于群聊场景）")
    private String proxySenderId;
    @ApiModelProperty("消息代理对象（适用于群聊场景）")
    private UserBaseResponseInfoVO proxySender;

    @ApiModelProperty("消息接受人id")
    private String receiverId;
    @ApiModelProperty("消息接受人详情")
    private UserBaseResponseInfoVO receiver;

    @ApiModelProperty("消息文本正文")
    private String message;

    @ApiModelProperty("消息图片")
    private String image;

    @ApiModelProperty("消息发送时间")
    private Long time;

    @ApiModelProperty("消息状态")
    private Boolean isRead;

    @ApiModelProperty("是否来自群组消息")
    private Boolean groupMessage = false;

    @ApiModelProperty("来自红包通知")
    private Boolean redPacket = false;

    @ApiModelProperty("红包详情")
    private RedPacketDetailVO redPacketDetail;

    @ApiModelProperty("公众号文章详情")
    private PublicAccountArticleMessageVO publicAccountArticle;

    @ApiModelProperty("是否来自音视频offer")
    private Boolean videoOffer = false;

    @ApiModelProperty("拒绝接受音视频")
    private Boolean rejectVideoOffer = false;

    @ApiModelProperty("来自朋友圈的消息")
    private Boolean momentMessage = false;

    @ApiModelProperty("发送人姓名")
    private String senderName;


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