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

import cn.reghao.jutil.jdk.web.db.BaseObject;
import cn.reghao.tnb.content.api.dto.spider.CrawledVideo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * 视频数据统计
 *
 * @author reghao
 * @date 2022-01-22 21:15:33
 */
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Data
public class VideoStatistic extends BaseObject<Integer> {
    @NotBlank
    private String videoId;
    @NotNull
    private Integer view;
    @NotNull
    private Integer danmaku;
    @NotNull
    private Integer comment;
    @NotNull
    private Integer favorite;
    @NotNull
    private Integer share;
    @NotNull
    private Integer thumbUp;
    @NotNull
    private Integer thumbDown;
    @NotNull
    private Integer coin;

    public VideoStatistic(String videoId) {
        this.videoId = videoId;
        this.view = 0;
        this.danmaku = 0;
        this.comment = 0;
        this.favorite = 0;
        this.share = 0;
        this.thumbUp = 0;
        this.thumbDown = 0;
        this.coin = 0;
    }

    @Deprecated
    public VideoStatistic(CrawledVideo crawledVideo) {
        this.videoId = crawledVideo.getVideoId();
        this.view = crawledVideo.getView();
        this.danmaku = crawledVideo.getDanmaku();
        this.comment = crawledVideo.getComment();
        this.favorite = crawledVideo.getFavorite();
        this.share = crawledVideo.getShare();
        this.thumbUp = crawledVideo.getThumbUp();
        this.thumbDown = crawledVideo.getCoin();
        this.coin = crawledVideo.getCoin();
    }
}
