"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreatePipeTransportRequestT = exports.CreatePipeTransportRequest = 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 pipe_transport_options_1 = require("../../fbs/pipe-transport/pipe-transport-options");
class CreatePipeTransportRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsCreatePipeTransportRequest(bb, obj) {
        return (obj || new CreatePipeTransportRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsCreatePipeTransportRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new CreatePipeTransportRequest()).__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 pipe_transport_options_1.PipeTransportOptions()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startCreatePipeTransportRequest(builder) {
        builder.startObject(2);
    }
    static addTransportId(builder, transportIdOffset) {
        builder.addFieldOffset(0, transportIdOffset, 0);
    }
    static addOptions(builder, optionsOffset) {
        builder.addFieldOffset(1, optionsOffset, 0);
    }
    static endCreatePipeTransportRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // transport_id
        builder.requiredField(offset, 6); // options
        return offset;
    }
    unpack() {
        return new CreatePipeTransportRequestT(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.CreatePipeTransportRequest = CreatePipeTransportRequest;
class CreatePipeTransportRequestT {
    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);
        CreatePipeTransportRequest.startCreatePipeTransportRequest(builder);
        CreatePipeTransportRequest.addTransportId(builder, transportId);
        CreatePipeTransportRequest.addOptions(builder, options);
        return CreatePipeTransportRequest.endCreatePipeTransportRequest(builder);
    }
}
exports.CreatePipeTransportRequestT = CreatePipeTransportRequestT;
