"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreatePlainTransportRequestT = exports.CreatePlainTransportRequest = 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 plain_transport_options_1 = require("../../fbs/plain-transport/plain-transport-options");
class CreatePlainTransportRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsCreatePlainTransportRequest(bb, obj) {
        return (obj || new CreatePlainTransportRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsCreatePlainTransportRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new CreatePlainTransportRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    transportId(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 plain_transport_options_1.PlainTransportOptions()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startCreatePlainTransportRequest(builder) {
        builder.startObject(2);
    }
    static addTransportId(builder, transportIdOffset) {
        builder.addFieldOffset(0, transportIdOffset, 0);
    }
    static addOptions(builder, optionsOffset) {
        builder.addFieldOffset(1, optionsOffset, 0);
    }
    static endCreatePlainTransportRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // transport_id
        builder.requiredField(offset, 6); // options
        return offset;
    }
    unpack() {
        return new CreatePlainTransportRequestT(this.transportId(), (this.options() !== null ? this.options().unpack() : null));
    }
    unpackTo(_o) {
        _o.transportId = this.transportId();
        _o.options = (this.options() !== null ? this.options().unpack() : null);
    }
}
exports.CreatePlainTransportRequest = CreatePlainTransportRequest;
class CreatePlainTransportRequestT {
    transportId;
    options;
    constructor(transportId = null, options = null) {
        this.transportId = transportId;
        this.options = options;
    }
    pack(builder) {
        const transportId = (this.transportId !== null ? builder.createString(this.transportId) : 0);
        const options = (this.options !== null ? this.options.pack(builder) : 0);
        CreatePlainTransportRequest.startCreatePlainTransportRequest(builder);
        CreatePlainTransportRequest.addTransportId(builder, transportId);
        CreatePlainTransportRequest.addOptions(builder, options);
        return CreatePlainTransportRequest.endCreatePlainTransportRequest(builder);
    }
}
exports.CreatePlainTransportRequestT = CreatePlainTransportRequestT;
