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

import cn.reghao.jutil.jdk.db.BaseObject;
import cn.reghao.tnb.message.api.dto.MediaProgress;
import lombok.*;

/**
 * 视频播放记录
 *
 * @author reghao
 * @date 2022-01-22 21:18:13
 */
@AllArgsConstructor
@NoArgsConstructor
@Setter
@Getter
public class PlayRecord extends BaseObject<Integer> {
    private Long userId;
    private String videoId;
    private Double currentTime;
    // ms 时间戳
    private Long createAt;
    private Boolean ended;

    public PlayRecord(long userId, MediaProgress mediaProgress) {
        this.userId = userId;
        this.videoId = mediaProgress.getMediaId();
        this.currentTime = mediaProgress.getCurrentTime();
        this.createAt = System.currentTimeMillis();
        this.ended = mediaProgress.getEnded();
    }
}
