"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnableTraceEventRequestT = exports.EnableTraceEventRequest = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
class EnableTraceEventRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsEnableTraceEventRequest(bb, obj) {
        return (obj || new EnableTraceEventRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsEnableTraceEventRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new EnableTraceEventRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    events(index) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
    }
    eventsLength() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
    }
    eventsArray() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
    }
    static startEnableTraceEventRequest(builder) {
        builder.startObject(1);
    }
    static addEvents(builder, eventsOffset) {
        builder.addFieldOffset(0, eventsOffset, 0);
    }
    static createEventsVector(builder, data) {
        builder.startVector(1, data.length, 1);
        for (let i = data.length - 1; i >= 0; i--) {
            builder.addInt8(data[i]);
        }
        return builder.endVector();
    }
    static startEventsVector(builder, numElems) {
        builder.startVector(1, numElems, 1);
    }
    static endEnableTraceEventRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // events
        return offset;
    }
    static createEnableTraceEventRequest(builder, eventsOffset) {
        EnableTraceEventRequest.startEnableTraceEventRequest(builder);
        EnableTraceEventRequest.addEvents(builder, eventsOffset);
        return EnableTraceEventRequest.endEnableTraceEventRequest(builder);
    }
    unpack() {
        return new EnableTraceEventRequestT(this.bb.createScalarList(this.events.bind(this), this.eventsLength()));
    }
    unpackTo(_o) {
        _o.events = this.bb.createScalarList(this.events.bind(this), this.eventsLength());
    }
}
exports.EnableTraceEventRequest = EnableTraceEventRequest;
class EnableTraceEventRequestT {
    events;
    constructor(events = []) {
        this.events = events;
    }
    pack(builder) {
        const events = EnableTraceEventRequest.createEventsVector(builder, this.events);
        return EnableTraceEventRequest.createEnableTraceEventRequest(builder, events);
    }
}
exports.EnableTraceEventRequestT = EnableTraceEventRequestT;
