package com.slodon.b2b2c.vo.video;

import com.slodon.b2b2c.core.util.FileUrlUtil;
import com.slodon.b2b2c.video.pojo.SvideoReply;
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 ReplyTreeVO implements Serializable {

    private static final long serialVersionUID = 5272901416847337824L;
    @ApiModelProperty("回复id")
    private Integer replyId;

    @ApiModelProperty("父级回复id")
    private Integer parentReplyId;

    @ApiModelProperty("评论id")
    private Integer commentId;

    @ApiModelProperty("回复人id")
    private Integer fromAuthorId;

    @ApiModelProperty("回复人名称")
    private String fromAuthorName;

    @ApiModelProperty("回复人头像")
    private String memberAvatar;

    @ApiModelProperty("被回复人id")
    private Integer toAuthorId;

    @ApiModelProperty("被回复人名称")
    private String toAuthorName;

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

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

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

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

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

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

    @ApiModelProperty("子级回复列表")
    private List<ReplyTreeVO> children;

    public ReplyTreeVO(SvideoReply svideoReply) {
        this.replyId = svideoReply.getReplyId();
        this.parentReplyId = svideoReply.getParentReplyId();
        this.commentId = svideoReply.getCommentId();
        this.fromAuthorId = svideoReply.getFromAuthorId();
        this.fromAuthorName = svideoReply.getFromAuthorName();
        this.memberAvatar = svideoReply.getMemberAvatar().startsWith("http") ? svideoReply.getMemberAvatar() : FileUrlUtil.getFileUrl(svideoReply.getMemberAvatar(), null);
        this.toAuthorId = svideoReply.getToAuthorId();
        this.toAuthorName = svideoReply.getToAuthorName();
        this.createTime = svideoReply.getCreateTime();
        this.isRead = svideoReply.getIsRead();
        this.content = svideoReply.getContent();
        this.likeNum = svideoReply.getLikeNum();
    }

}
