"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.DumpT = exports.Dump = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
const params_1 = require("../../fbs/rtp-stream/params");
const rtx_dump_1 = require("../../fbs/rtx-stream/rtx-dump");
class Dump {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsDump(bb, obj) {
        return (obj || new Dump()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsDump(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new Dump()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    params(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new params_1.Params()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    score() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    rtxStream(obj) {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? (obj || new rtx_dump_1.RtxDump()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startDump(builder) {
        builder.startObject(3);
    }
    static addParams(builder, paramsOffset) {
        builder.addFieldOffset(0, paramsOffset, 0);
    }
    static addScore(builder, score) {
        builder.addFieldInt8(1, score, 0);
    }
    static addRtxStream(builder, rtxStreamOffset) {
        builder.addFieldOffset(2, rtxStreamOffset, 0);
    }
    static endDump(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // params
        return offset;
    }
    unpack() {
        return new DumpT((this.params() !== null ? this.params().unpack() : null), this.score(), (this.rtxStream() !== null ? this.rtxStream().unpack() : null));
    }
    unpackTo(_o) {
        _o.params = (this.params() !== null ? this.params().unpack() : null);
        _o.score = this.score();
        _o.rtxStream = (this.rtxStream() !== null ? this.rtxStream().unpack() : null);
    }
}
exports.Dump = Dump;
class DumpT {
    params;
    score;
    rtxStream;
    constructor(params = null, score = 0, rtxStream = null) {
        this.params = params;
        this.score = score;
        this.rtxStream = rtxStream;
    }
    pack(builder) {
        const params = (this.params !== null ? this.params.pack(builder) : 0);
        const rtxStream = (this.rtxStream !== null ? this.rtxStream.pack(builder) : 0);
        Dump.startDump(builder);
        Dump.addParams(builder, params);
        Dump.addScore(builder, this.score);
        Dump.addRtxStream(builder, rtxStream);
        return Dump.endDump(builder);
    }
}
exports.DumpT = DumpT;
