package cn.reghao.tnb.search.app.comment.model.po;

import cn.reghao.jutil.jdk.web.db.BaseObject;
import cn.reghao.tnb.content.api.dto.DanmakuSbtDto;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * dplayer 弹幕的数据定义
 *
 * @author reghao
 * @date 2023-02-02 11:03:09
 */
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@Setter
@Getter
public class UserDanmaku extends BaseObject<String> {
    private Long dmId;
    private String videoId;
    private Integer type;
    private Long color;
    private String text;
    private Double time;
    private Long publishAt;
    private Long publishBy;
    private String midHash;

    public UserDanmaku(long dmId, DanmakuSbtDto danmakuSbtDto, long publishBy) {
        this.dmId = danmakuSbtDto.getDmId() != null ? danmakuSbtDto.getDmId() : dmId;
        this.videoId = danmakuSbtDto.getId();
        this.type = danmakuSbtDto.getType();
        this.color = danmakuSbtDto.getColor();
        this.text = danmakuSbtDto.getText();
        this.time = danmakuSbtDto.getTime();
        this.publishAt = danmakuSbtDto.getPublishAt() != null ? danmakuSbtDto.getPublishAt() : System.currentTimeMillis();
        this.publishBy = publishBy;
        this.midHash = danmakuSbtDto.getMidHash();
    }
}
