"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConnectResponseT = exports.ConnectResponse = 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 srtp_parameters_1 = require("../../fbs/srtp-parameters/srtp-parameters");
const tuple_1 = require("../../fbs/transport/tuple");
class ConnectResponse {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsConnectResponse(bb, obj) {
        return (obj || new ConnectResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsConnectResponse(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new ConnectResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    tuple(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new tuple_1.Tuple()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    rtcpTuple(obj) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? (obj || new tuple_1.Tuple()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    srtpParameters(obj) {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? (obj || new srtp_parameters_1.SrtpParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static startConnectResponse(builder) {
        builder.startObject(3);
    }
    static addTuple(builder, tupleOffset) {
        builder.addFieldOffset(0, tupleOffset, 0);
    }
    static addRtcpTuple(builder, rtcpTupleOffset) {
        builder.addFieldOffset(1, rtcpTupleOffset, 0);
    }
    static addSrtpParameters(builder, srtpParametersOffset) {
        builder.addFieldOffset(2, srtpParametersOffset, 0);
    }
    static endConnectResponse(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // tuple
        return offset;
    }
    unpack() {
        return new ConnectResponseT((this.tuple() !== null ? this.tuple().unpack() : null), (this.rtcpTuple() !== null ? this.rtcpTuple().unpack() : null), (this.srtpParameters() !== null ? this.srtpParameters().unpack() : null));
    }
    unpackTo(_o) {
        _o.tuple = (this.tuple() !== null ? this.tuple().unpack() : null);
        _o.rtcpTuple = (this.rtcpTuple() !== null ? this.rtcpTuple().unpack() : null);
        _o.srtpParameters = (this.srtpParameters() !== null ? this.srtpParameters().unpack() : null);
    }
}
exports.ConnectResponse = ConnectResponse;
class ConnectResponseT {
    tuple;
    rtcpTuple;
    srtpParameters;
    constructor(tuple = null, rtcpTuple = null, srtpParameters = null) {
        this.tuple = tuple;
        this.rtcpTuple = rtcpTuple;
        this.srtpParameters = srtpParameters;
    }
    pack(builder) {
        const tuple = (this.tuple !== null ? this.tuple.pack(builder) : 0);
        const rtcpTuple = (this.rtcpTuple !== null ? this.rtcpTuple.pack(builder) : 0);
        const srtpParameters = (this.srtpParameters !== null ? this.srtpParameters.pack(builder) : 0);
        ConnectResponse.startConnectResponse(builder);
        ConnectResponse.addTuple(builder, tuple);
        ConnectResponse.addRtcpTuple(builder, rtcpTuple);
        ConnectResponse.addSrtpParameters(builder, srtpParameters);
        return ConnectResponse.endConnectResponse(builder);
    }
}
exports.ConnectResponseT = ConnectResponseT;
