"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.SvcConsumerDumpT = exports.SvcConsumerDump = 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 SvcConsumerDump {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsSvcConsumerDump(bb, obj) {
        return (obj || new SvcConsumerDump()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsSvcConsumerDump(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new SvcConsumerDump()).__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 startSvcConsumerDump(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 endSvcConsumerDump(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // base
        builder.requiredField(offset, 6); // rtp_stream
        return offset;
    }
    unpack() {
        return new SvcConsumerDumpT((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.SvcConsumerDump = SvcConsumerDump;
class SvcConsumerDumpT {
    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);
        SvcConsumerDump.startSvcConsumerDump(builder);
        SvcConsumerDump.addBase(builder, base);
        SvcConsumerDump.addRtpStream(builder, rtpStream);
        SvcConsumerDump.addPreferredSpatialLayer(builder, this.preferredSpatialLayer);
        SvcConsumerDump.addTargetSpatialLayer(builder, this.targetSpatialLayer);
        SvcConsumerDump.addCurrentSpatialLayer(builder, this.currentSpatialLayer);
        SvcConsumerDump.addPreferredTemporalLayer(builder, this.preferredTemporalLayer);
        SvcConsumerDump.addTargetTemporalLayer(builder, this.targetTemporalLayer);
        SvcConsumerDump.addCurrentTemporalLayer(builder, this.currentTemporalLayer);
        return SvcConsumerDump.endSvcConsumerDump(builder);
    }
}
exports.SvcConsumerDumpT = SvcConsumerDumpT;
