"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetStatsResponseT = exports.GetStatsResponse = 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 stats_1 = require("../../fbs/transport/stats");
const tuple_1 = require("../../fbs/transport/tuple");
class GetStatsResponse {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsGetStatsResponse(bb, obj) {
        return (obj || new GetStatsResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsGetStatsResponse(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new GetStatsResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    base(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new stats_1.Stats()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    rtcpMux() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    comedia() {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    tuple(obj) {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? (obj || new tuple_1.Tuple()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    rtcpTuple(obj) {
        const offset = this.bb.__offset(this.bb_pos, 12);
        return offset ? (obj || new tuple_1.Tuple()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startGetStatsResponse(builder) {
        builder.startObject(5);
    }
    static addBase(builder, baseOffset) {
        builder.addFieldOffset(0, baseOffset, 0);
    }
    static addRtcpMux(builder, rtcpMux) {
        builder.addFieldInt8(1, +rtcpMux, +false);
    }
    static addComedia(builder, comedia) {
        builder.addFieldInt8(2, +comedia, +false);
    }
    static addTuple(builder, tupleOffset) {
        builder.addFieldOffset(3, tupleOffset, 0);
    }
    static addRtcpTuple(builder, rtcpTupleOffset) {
        builder.addFieldOffset(4, rtcpTupleOffset, 0);
    }
    static endGetStatsResponse(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // base
        builder.requiredField(offset, 10); // tuple
        return offset;
    }
    unpack() {
        return new GetStatsResponseT((this.base() !== null ? this.base().unpack() : null), this.rtcpMux(), this.comedia(), (this.tuple() !== null ? this.tuple().unpack() : null), (this.rtcpTuple() !== null ? this.rtcpTuple().unpack() : null));
    }
    unpackTo(_o) {
        _o.base = (this.base() !== null ? this.base().unpack() : null);
        _o.rtcpMux = this.rtcpMux();
        _o.comedia = this.comedia();
        _o.tuple = (this.tuple() !== null ? this.tuple().unpack() : null);
        _o.rtcpTuple = (this.rtcpTuple() !== null ? this.rtcpTuple().unpack() : null);
    }
}
exports.GetStatsResponse = GetStatsResponse;
class GetStatsResponseT {
    base;
    rtcpMux;
    comedia;
    tuple;
    rtcpTuple;
    constructor(base = null, rtcpMux = false, comedia = false, tuple = null, rtcpTuple = null) {
        this.base = base;
        this.rtcpMux = rtcpMux;
        this.comedia = comedia;
        this.tuple = tuple;
        this.rtcpTuple = rtcpTuple;
    }
    pack(builder) {
        const base = (this.base !== null ? this.base.pack(builder) : 0);
        const tuple = (this.tuple !== null ? this.tuple.pack(builder) : 0);
        const rtcpTuple = (this.rtcpTuple !== null ? this.rtcpTuple.pack(builder) : 0);
        GetStatsResponse.startGetStatsResponse(builder);
        GetStatsResponse.addBase(builder, base);
        GetStatsResponse.addRtcpMux(builder, this.rtcpMux);
        GetStatsResponse.addComedia(builder, this.comedia);
        GetStatsResponse.addTuple(builder, tuple);
        GetStatsResponse.addRtcpTuple(builder, rtcpTuple);
        return GetStatsResponse.endGetStatsResponse(builder);
    }
}
exports.GetStatsResponseT = GetStatsResponseT;
