package com.slodon.b2b2c.vo.video;

import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.video.pojo.SvideoComment;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 *
 * 封装视频评论vo对象
 * @author wuxy
 */
@Data
public class VideoCommentVO implements Serializable {

    private static final long serialVersionUID = -4696183692630813796L;
    @ApiModelProperty("评论id")
    private Integer commentId;

    @ApiModelProperty("视频id")
    private Integer videoId;

    @ApiModelProperty("评论人id")
    private Integer authorId;

    @ApiModelProperty("评论人名称")
    private String authorName;

    @ApiModelProperty("评论时间")
    private Date createTime;

    @ApiModelProperty("是否已读：0未读，1已读")
    private Integer isRead;

    @ApiModelProperty("评论内容")
    private String content;

    @ApiModelProperty("会员头像")
    private String memberAvatar;

    @ApiModelProperty("封面图地址")
    private String videoImage;

    @ApiModelProperty("点赞数")
    private Integer likeNum;

    @ApiModelProperty("是否自己的评论")
    private Boolean isSelf = false;

    @ApiModelProperty("是否点赞")
    private Boolean isLike = false;

    @ApiModelProperty("回复列表")
    private List<ReplyTreeVO> replyList;

    public VideoCommentVO(SvideoComment svideoComment) {
        this.commentId = svideoComment.getCommentId();
        this.videoId = svideoComment.getVideoId();
        this.authorId = svideoComment.getFromAuthorId();
        this.authorName = svideoComment.getFromAuthorName();
        this.createTime = svideoComment.getCreateTime();
        this.isRead = svideoComment.getIsRead();
        this.content = svideoComment.getContent();
        this.memberAvatar = svideoComment.getMemberAvatar().startsWith("http") ? svideoComment.getMemberAvatar() : FileUrlUtil.getFileUrl(svideoComment.getMemberAvatar(), null);
        this.videoImage = FileUrlUtil.getFileUrl(svideoComment.getVideoImage(), null);
        this.likeNum = svideoComment.getLikeNum();
    }

}
