"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.RtpTraceInfoT = exports.RtpTraceInfo = 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 dump_1 = require("../../fbs/rtp-packet/dump");
class RtpTraceInfo {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsRtpTraceInfo(bb, obj) {
        return (obj || new RtpTraceInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsRtpTraceInfo(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new RtpTraceInfo()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    rtpPacket(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new dump_1.Dump()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    isRtx() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    static startRtpTraceInfo(builder) {
        builder.startObject(2);
    }
    static addRtpPacket(builder, rtpPacketOffset) {
        builder.addFieldOffset(0, rtpPacketOffset, 0);
    }
    static addIsRtx(builder, isRtx) {
        builder.addFieldInt8(1, +isRtx, +false);
    }
    static endRtpTraceInfo(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // rtp_packet
        return offset;
    }
    static createRtpTraceInfo(builder, rtpPacketOffset, isRtx) {
        RtpTraceInfo.startRtpTraceInfo(builder);
        RtpTraceInfo.addRtpPacket(builder, rtpPacketOffset);
        RtpTraceInfo.addIsRtx(builder, isRtx);
        return RtpTraceInfo.endRtpTraceInfo(builder);
    }
    unpack() {
        return new RtpTraceInfoT((this.rtpPacket() !== null ? this.rtpPacket().unpack() : null), this.isRtx());
    }
    unpackTo(_o) {
        _o.rtpPacket = (this.rtpPacket() !== null ? this.rtpPacket().unpack() : null);
        _o.isRtx = this.isRtx();
    }
}
exports.RtpTraceInfo = RtpTraceInfo;
class RtpTraceInfoT {
    rtpPacket;
    isRtx;
    constructor(rtpPacket = null, isRtx = false) {
        this.rtpPacket = rtpPacket;
        this.isRtx = isRtx;
    }
    pack(builder) {
        const rtpPacket = (this.rtpPacket !== null ? this.rtpPacket.pack(builder) : 0);
        return RtpTraceInfo.createRtpTraceInfo(builder, rtpPacket, this.isRtx);
    }
}
exports.RtpTraceInfoT = RtpTraceInfoT;
