package com.yutou.bilibili.datas.web;

import com.yutou.biliapi.bean.live.database.LiveSuperChatDatabaseBean;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class LiveVideoDanmu {

    List<Danmu> danmu = new ArrayList<>();
    List<SuperChat> superChat = new ArrayList<>();


    @Data
    public static class Addition {
        private int grade = 2;
    }

    @Data
    public static class Danmu {
        public static final String DANMU_TYPE_SCROLL = "scroll";
        public static final String DANMU_TYPE_TOP = "top";
        public static final String DANMU_TYPE_BOTTOM = "bottom";
        private String id;
        private String barrageType = DANMU_TYPE_SCROLL;
        private long time;
        private String text;
        private int fontSize = 25;
        private int lineHeight = 1;
        private String color = "#ffffff";
        private Addition addition = new Addition();
    }

    @Data
    public static class SuperChat {
        private int id;
        private long price;
        private String uid;
        private long start_time;
        private long duration;
        private String message;
        private String message_trans;
        private String message_font_color;
        private String backgroundBottomColor;
        private String userName;
        private String userNameColor;
        private String userAvatar;

        public SuperChat(long videoTime, LiveSuperChatDatabaseBean bean) {
            this.id = bean.getId();
            this.price = bean.getPrice();
            this.uid = bean.getUid();
            this.start_time = (bean.getSql_time().getTime() - videoTime) / 1000;
            this.duration = bean.getEnd_time() - bean.getStart_time();
            this.message = bean.getMessage();
            this.message_trans = bean.getMessage_trans();
            this.message_font_color = bean.getMessage_font_color();
            this.backgroundBottomColor = bean.getBackgroundBottomColor();
            this.userName = bean.getUserName();
            this.userAvatar = bean.getUserAvatar();
            this.userNameColor=bean.getUserNameColor();
        }
    }
}
