"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelMessageHandlersT = exports.ChannelMessageHandlers = 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 ChannelMessageHandlers {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsChannelMessageHandlers(bb, obj) {
        return (obj || new ChannelMessageHandlers()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsChannelMessageHandlers(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new ChannelMessageHandlers()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    channelRequestHandlers(index, optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
    }
    channelRequestHandlersLength() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
    }
    channelNotificationHandlers(index, optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
    }
    channelNotificationHandlersLength() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
    }
    static startChannelMessageHandlers(builder) {
        builder.startObject(2);
    }
    static addChannelRequestHandlers(builder, channelRequestHandlersOffset) {
        builder.addFieldOffset(0, channelRequestHandlersOffset, 0);
    }
    static createChannelRequestHandlersVector(builder, data) {
        builder.startVector(4, data.length, 4);
        for (let i = data.length - 1; i >= 0; i--) {
            builder.addOffset(data[i]);
        }
        return builder.endVector();
    }
    static startChannelRequestHandlersVector(builder, numElems) {
        builder.startVector(4, numElems, 4);
    }
    static addChannelNotificationHandlers(builder, channelNotificationHandlersOffset) {
        builder.addFieldOffset(1, channelNotificationHandlersOffset, 0);
    }
    static createChannelNotificationHandlersVector(builder, data) {
        builder.startVector(4, data.length, 4);
        for (let i = data.length - 1; i >= 0; i--) {
            builder.addOffset(data[i]);
        }
        return builder.endVector();
    }
    static startChannelNotificationHandlersVector(builder, numElems) {
        builder.startVector(4, numElems, 4);
    }
    static endChannelMessageHandlers(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // channel_request_handlers
        builder.requiredField(offset, 6); // channel_notification_handlers
        return offset;
    }
    static createChannelMessageHandlers(builder, channelRequestHandlersOffset, channelNotificationHandlersOffset) {
        ChannelMessageHandlers.startChannelMessageHandlers(builder);
        ChannelMessageHandlers.addChannelRequestHandlers(builder, channelRequestHandlersOffset);
        ChannelMessageHandlers.addChannelNotificationHandlers(builder, channelNotificationHandlersOffset);
        return ChannelMessageHandlers.endChannelMessageHandlers(builder);
    }
    unpack() {
        return new ChannelMessageHandlersT(this.bb.createScalarList(this.channelRequestHandlers.bind(this), this.channelRequestHandlersLength()), this.bb.createScalarList(this.channelNotificationHandlers.bind(this), this.channelNotificationHandlersLength()));
    }
    unpackTo(_o) {
        _o.channelRequestHandlers = this.bb.createScalarList(this.channelRequestHandlers.bind(this), this.channelRequestHandlersLength());
        _o.channelNotificationHandlers = this.bb.createScalarList(this.channelNotificationHandlers.bind(this), this.channelNotificationHandlersLength());
    }
}
exports.ChannelMessageHandlers = ChannelMessageHandlers;
class ChannelMessageHandlersT {
    channelRequestHandlers;
    channelNotificationHandlers;
    constructor(channelRequestHandlers = [], channelNotificationHandlers = []) {
        this.channelRequestHandlers = channelRequestHandlers;
        this.channelNotificationHandlers = channelNotificationHandlers;
    }
    pack(builder) {
        const channelRequestHandlers = ChannelMessageHandlers.createChannelRequestHandlersVector(builder, builder.createObjectOffsetList(this.channelRequestHandlers));
        const channelNotificationHandlers = ChannelMessageHandlers.createChannelNotificationHandlersVector(builder, builder.createObjectOffsetList(this.channelNotificationHandlers));
        return ChannelMessageHandlers.createChannelMessageHandlers(builder, channelRequestHandlers, channelNotificationHandlers);
    }
}
exports.ChannelMessageHandlersT = ChannelMessageHandlersT;
