import { ScriptBarrageType } from '../../db/ScriptBarrage';
import { getSeconds } from '../../pubUtils/timeUtil';

export class BarrageReturn {
    code: string;      // code
    warId: number;     // 关卡id
    rid: string;       // 剧本id
    index: string;     // 对话索引id
    content: string;   // 弹幕内容
    createTime: number; // 发送时间

    constructor(barrage: ScriptBarrageType) {
        if(barrage) {
            this.code = barrage.code;
            this.warId = barrage.warId;
            this.rid = barrage.rid;
            this.index = barrage.index;
            this.content = barrage.content;
            this.createTime = getSeconds(barrage.createdAt);
        }
    }
}