"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateAudioLevelObserverRequestT = exports.CreateAudioLevelObserverRequest = 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 audio_level_observer_options_1 = require("../../fbs/audio-level-observer/audio-level-observer-options");
class CreateAudioLevelObserverRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsCreateAudioLevelObserverRequest(bb, obj) {
        return (obj || new CreateAudioLevelObserverRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsCreateAudioLevelObserverRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new CreateAudioLevelObserverRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    rtpObserverId(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    options(obj) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? (obj || new audio_level_observer_options_1.AudioLevelObserverOptions()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startCreateAudioLevelObserverRequest(builder) {
        builder.startObject(2);
    }
    static addRtpObserverId(builder, rtpObserverIdOffset) {
        builder.addFieldOffset(0, rtpObserverIdOffset, 0);
    }
    static addOptions(builder, optionsOffset) {
        builder.addFieldOffset(1, optionsOffset, 0);
    }
    static endCreateAudioLevelObserverRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // rtp_observer_id
        builder.requiredField(offset, 6); // options
        return offset;
    }
    unpack() {
        return new CreateAudioLevelObserverRequestT(this.rtpObserverId(), (this.options() !== null ? this.options().unpack() : null));
    }
    unpackTo(_o) {
        _o.rtpObserverId = this.rtpObserverId();
        _o.options = (this.options() !== null ? this.options().unpack() : null);
    }
}
exports.CreateAudioLevelObserverRequest = CreateAudioLevelObserverRequest;
class CreateAudioLevelObserverRequestT {
    rtpObserverId;
    options;
    constructor(rtpObserverId = null, options = null) {
        this.rtpObserverId = rtpObserverId;
        this.options = options;
    }
    pack(builder) {
        const rtpObserverId = (this.rtpObserverId !== null ? builder.createString(this.rtpObserverId) : 0);
        const options = (this.options !== null ? this.options.pack(builder) : 0);
        CreateAudioLevelObserverRequest.startCreateAudioLevelObserverRequest(builder);
        CreateAudioLevelObserverRequest.addRtpObserverId(builder, rtpObserverId);
        CreateAudioLevelObserverRequest.addOptions(builder, options);
        return CreateAudioLevelObserverRequest.endCreateAudioLevelObserverRequest(builder);
    }
}
exports.CreateAudioLevelObserverRequestT = CreateAudioLevelObserverRequestT;
