package com.yutou.biliapi.bean.live.database;

import com.alibaba.fastjson2.annotation.JSONField;
import com.yutou.biliapi.bean.websocket.live.WSDanmuData;
import com.yutou.bilibili.datas.DanmuData;
import com.yutou.common.databases.AbsDatabasesBean;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigInteger;

@EqualsAndHashCode(callSuper = true)
@Data
public class LiveDanmuDatabaseBean extends AbsDatabasesBean {
    @JSONField(name = "id")
    int id;
    @JSONField(name = "danmu")
    private String danmu;
    @JSONField(name = "model")
    private int model;// 1~3 滚动弹幕 4 底端弹幕 5 顶端弹幕 6 逆向弹幕 7 精准定位 8 高级弹幕
    @JSONField(name = "fontSize")
    private int fontSize;
    @JSONField(name = "color")
    private String fontColor;
    @JSONField(name = "time")
    private long time;
    @JSONField(name = "uid")
    private String uid;
    @JSONField(name = "uname")
    private String uname;


    public LiveDanmuDatabaseBean() {
        super("danmu", System.currentTimeMillis());
    }

    public LiveDanmuDatabaseBean(WSDanmuData danmu) {
        super("danmu", danmu.getWs_timer());
        this.danmu = danmu.getDanmu();
        model = danmu.getModel();
        fontSize = danmu.getFontSize();
        fontColor = danmu.getFontColor();
        time = danmu.getTime();
        uid = danmu.getUid();
        uname = danmu.getUname();
    }

    public DanmuData createDanmuData() {
        DanmuData data = new DanmuData();
        data.setId(id);
        data.setDanmu(danmu);
        data.setModel(model);
        data.setFontSize(fontSize);
        data.setFontColor(fontColor);
        data.setTime(time);
        return data;
    }
}
