"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.SimulcastConsumerDumpT = exports.SimulcastConsumerDump = void 0;
const flatbuffers = require("flatbuffers");
const base_consumer_dump_1 = require("../../fbs/consumer/base-consumer-dump");
const dump_1 = require("../../fbs/rtp-stream/dump");
class SimulcastConsumerDump {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsSimulcastConsumerDump(bb, obj) {
        return (obj || new SimulcastConsumerDump()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsSimulcastConsumerDump(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new SimulcastConsumerDump()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    base(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new base_consumer_dump_1.BaseConsumerDump()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    rtpStream(obj) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? (obj || new dump_1.Dump()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    preferredSpatialLayer() {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    targetSpatialLayer() {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    currentSpatialLayer() {
        const offset = this.bb.__offset(this.bb_pos, 12);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    preferredTemporalLayer() {
        const offset = this.bb.__offset(this.bb_pos, 14);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    targetTemporalLayer() {
        const offset = this.bb.__offset(this.bb_pos, 16);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    currentTemporalLayer() {
        const offset = this.bb.__offset(this.bb_pos, 18);
        return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
    }
    static startSimulcastConsumerDump(builder) {
        builder.startObject(8);
    }
    static addBase(builder, baseOffset) {
        builder.addFieldOffset(0, baseOffset, 0);
    }
    static addRtpStream(builder, rtpStreamOffset) {
        builder.addFieldOffset(1, rtpStreamOffset, 0);
    }
    static addPreferredSpatialLayer(builder, preferredSpatialLayer) {
        builder.addFieldInt16(2, preferredSpatialLayer, 0);
    }
    static addTargetSpatialLayer(builder, targetSpatialLayer) {
        builder.addFieldInt16(3, targetSpatialLayer, 0);
    }
    static addCurrentSpatialLayer(builder, currentSpatialLayer) {
        builder.addFieldInt16(4, currentSpatialLayer, 0);
    }
    static addPreferredTemporalLayer(builder, preferredTemporalLayer) {
        builder.addFieldInt16(5, preferredTemporalLayer, 0);
    }
    static addTargetTemporalLayer(builder, targetTemporalLayer) {
        builder.addFieldInt16(6, targetTemporalLayer, 0);
    }
    static addCurrentTemporalLayer(builder, currentTemporalLayer) {
        builder.addFieldInt16(7, currentTemporalLayer, 0);
    }
    static endSimulcastConsumerDump(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // base
        builder.requiredField(offset, 6); // rtp_stream
        return offset;
    }
    unpack() {
        return new SimulcastConsumerDumpT((this.base() !== null ? this.base().unpack() : null), (this.rtpStream() !== null ? this.rtpStream().unpack() : null), this.preferredSpatialLayer(), this.targetSpatialLayer(), this.currentSpatialLayer(), this.preferredTemporalLayer(), this.targetTemporalLayer(), this.currentTemporalLayer());
    }
    unpackTo(_o) {
        _o.base = (this.base() !== null ? this.base().unpack() : null);
        _o.rtpStream = (this.rtpStream() !== null ? this.rtpStream().unpack() : null);
        _o.preferredSpatialLayer = this.preferredSpatialLayer();
        _o.targetSpatialLayer = this.targetSpatialLayer();
        _o.currentSpatialLayer = this.currentSpatialLayer();
        _o.preferredTemporalLayer = this.preferredTemporalLayer();
        _o.targetTemporalLayer = this.targetTemporalLayer();
        _o.currentTemporalLayer = this.currentTemporalLayer();
    }
}
exports.SimulcastConsumerDump = SimulcastConsumerDump;
class SimulcastConsumerDumpT {
    base;
    rtpStream;
    preferredSpatialLayer;
    targetSpatialLayer;
    currentSpatialLayer;
    preferredTemporalLayer;
    targetTemporalLayer;
    currentTemporalLayer;
    constructor(base = null, rtpStream = null, preferredSpatialLayer = 0, targetSpatialLayer = 0, currentSpatialLayer = 0, preferredTemporalLayer = 0, targetTemporalLayer = 0, currentTemporalLayer = 0) {
        this.base = base;
        this.rtpStream = rtpStream;
        this.preferredSpatialLayer = preferredSpatialLayer;
        this.targetSpatialLayer = targetSpatialLayer;
        this.currentSpatialLayer = currentSpatialLayer;
        this.preferredTemporalLayer = preferredTemporalLayer;
        this.targetTemporalLayer = targetTemporalLayer;
        this.currentTemporalLayer = currentTemporalLayer;
    }
    pack(builder) {
        const base = (this.base !== null ? this.base.pack(builder) : 0);
        const rtpStream = (this.rtpStream !== null ? this.rtpStream.pack(builder) : 0);
        SimulcastConsumerDump.startSimulcastConsumerDump(builder);
        SimulcastConsumerDump.addBase(builder, base);
        SimulcastConsumerDump.addRtpStream(builder, rtpStream);
        SimulcastConsumerDump.addPreferredSpatialLayer(builder, this.preferredSpatialLayer);
        SimulcastConsumerDump.addTargetSpatialLayer(builder, this.targetSpatialLayer);
        SimulcastConsumerDump.addCurrentSpatialLayer(builder, this.currentSpatialLayer);
        SimulcastConsumerDump.addPreferredTemporalLayer(builder, this.preferredTemporalLayer);
        SimulcastConsumerDump.addTargetTemporalLayer(builder, this.targetTemporalLayer);
        SimulcastConsumerDump.addCurrentTemporalLayer(builder, this.currentTemporalLayer);
        return SimulcastConsumerDump.endSimulcastConsumerDump(builder);
    }
}
exports.SimulcastConsumerDumpT = SimulcastConsumerDumpT;
