package cn.reghao.tnb.content.app.vod.model.vo;

import cn.reghao.tnb.content.app.vod.model.po.VideoPost;
import cn.reghao.tnb.content.app.vod.model.po.VideoStatistic;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author reghao
 * @date 2021-08-27 23:56:22
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class VideoDetail implements Serializable {
    private static final long serialVersionUID = 1L;

    private String videoId;
    private String videoFileId;
    private String title;
    private String description;
    private String coverUrl;
    private int duration;
    private LocalDateTime pubDate;
    private int scope;
    private int status;
    private List<String> tags = new ArrayList<>();
    private String userId;

    private int view;
    private int comment;
    private int favorite;
    private int share;
    private int thumbUp;
    private int thumbDown;

    public VideoDetail(VideoPost videoPost, VideoStatistic videoStatistic, String publishBy) {
        this.videoId = videoPost.getVideoId();
        this.videoFileId = null;
        this.title = videoPost.getTitle();
        this.description = videoPost.getDescription();
        this.coverUrl = videoPost.getCoverUrl();
        this.duration = videoPost.getDuration();
        this.pubDate = videoPost.getPublishAt();
        this.scope = videoPost.getScope();
        this.status = videoPost.getStatus();
        this.userId = publishBy;
        this.view = videoStatistic.getView();
        this.comment = videoStatistic.getComment();
        this.favorite = videoStatistic.getFavorite();
        this.share = videoStatistic.getShare();
        this.thumbUp = videoStatistic.getThumbUp();
        this.thumbDown = videoStatistic.getThumbDown();
    }
}
