"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetSubchannelsRequestT = exports.SetSubchannelsRequest = 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 SetSubchannelsRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsSetSubchannelsRequest(bb, obj) {
        return (obj || new SetSubchannelsRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsSetSubchannelsRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new SetSubchannelsRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    subchannels(index) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.readUint16(this.bb.__vector(this.bb_pos + offset) + index * 2) : 0;
    }
    subchannelsLength() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
    }
    subchannelsArray() {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? new Uint16Array(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 startSetSubchannelsRequest(builder) {
        builder.startObject(1);
    }
    static addSubchannels(builder, subchannelsOffset) {
        builder.addFieldOffset(0, subchannelsOffset, 0);
    }
    static createSubchannelsVector(builder, data) {
        builder.startVector(2, data.length, 2);
        for (let i = data.length - 1; i >= 0; i--) {
            builder.addInt16(data[i]);
        }
        return builder.endVector();
    }
    static startSubchannelsVector(builder, numElems) {
        builder.startVector(2, numElems, 2);
    }
    static endSetSubchannelsRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // subchannels
        return offset;
    }
    static createSetSubchannelsRequest(builder, subchannelsOffset) {
        SetSubchannelsRequest.startSetSubchannelsRequest(builder);
        SetSubchannelsRequest.addSubchannels(builder, subchannelsOffset);
        return SetSubchannelsRequest.endSetSubchannelsRequest(builder);
    }
    unpack() {
        return new SetSubchannelsRequestT(this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength()));
    }
    unpackTo(_o) {
        _o.subchannels = this.bb.createScalarList(this.subchannels.bind(this), this.subchannelsLength());
    }
}
exports.SetSubchannelsRequest = SetSubchannelsRequest;
class SetSubchannelsRequestT {
    subchannels;
    constructor(subchannels = []) {
        this.subchannels = subchannels;
    }
    pack(builder) {
        const subchannels = SetSubchannelsRequest.createSubchannelsVector(builder, this.subchannels);
        return SetSubchannelsRequest.createSetSubchannelsRequest(builder, subchannels);
    }
}
exports.SetSubchannelsRequestT = SetSubchannelsRequestT;
