"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectRequestT = exports.ConnectRequest = 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 dtls_parameters_1 = require("../../fbs/web-rtc-transport/dtls-parameters");
class ConnectRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsConnectRequest(bb, obj) {
        return (obj || new ConnectRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsConnectRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new ConnectRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    dtlsParameters(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new dtls_parameters_1.DtlsParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startConnectRequest(builder) {
        builder.startObject(1);
    }
    static addDtlsParameters(builder, dtlsParametersOffset) {
        builder.addFieldOffset(0, dtlsParametersOffset, 0);
    }
    static endConnectRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // dtls_parameters
        return offset;
    }
    static createConnectRequest(builder, dtlsParametersOffset) {
        ConnectRequest.startConnectRequest(builder);
        ConnectRequest.addDtlsParameters(builder, dtlsParametersOffset);
        return ConnectRequest.endConnectRequest(builder);
    }
    unpack() {
        return new ConnectRequestT((this.dtlsParameters() !== null ? this.dtlsParameters().unpack() : null));
    }
    unpackTo(_o) {
        _o.dtlsParameters = (this.dtlsParameters() !== null ? this.dtlsParameters().unpack() : null);
    }
}
exports.ConnectRequest = ConnectRequest;
class ConnectRequestT {
    dtlsParameters;
    constructor(dtlsParameters = null) {
        this.dtlsParameters = dtlsParameters;
    }
    pack(builder) {
        const dtlsParameters = (this.dtlsParameters !== null ? this.dtlsParameters.pack(builder) : 0);
        return ConnectRequest.createConnectRequest(builder, dtlsParameters);
    }
}
exports.ConnectRequestT = ConnectRequestT;
