"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.DumpResponseT = exports.DumpResponse = 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 type_1 = require("../../fbs/data-producer/type");
const sctp_stream_parameters_1 = require("../../fbs/sctp-parameters/sctp-stream-parameters");
class DumpResponse {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsDumpResponse(bb, obj) {
        return (obj || new DumpResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsDumpResponse(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new DumpResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    id(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    type() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : type_1.Type.SCTP;
    }
    sctpStreamParameters(obj) {
        const offset = this.bb.__offset(this.bb_pos, 8);
        return offset ? (obj || new sctp_stream_parameters_1.SctpStreamParameters()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    label(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 10);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    protocol(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 12);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    paused() {
        const offset = this.bb.__offset(this.bb_pos, 14);
        return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
    }
    static startDumpResponse(builder) {
        builder.startObject(6);
    }
    static addId(builder, idOffset) {
        builder.addFieldOffset(0, idOffset, 0);
    }
    static addType(builder, type) {
        builder.addFieldInt8(1, type, type_1.Type.SCTP);
    }
    static addSctpStreamParameters(builder, sctpStreamParametersOffset) {
        builder.addFieldOffset(2, sctpStreamParametersOffset, 0);
    }
    static addLabel(builder, labelOffset) {
        builder.addFieldOffset(3, labelOffset, 0);
    }
    static addProtocol(builder, protocolOffset) {
        builder.addFieldOffset(4, protocolOffset, 0);
    }
    static addPaused(builder, paused) {
        builder.addFieldInt8(5, +paused, +false);
    }
    static endDumpResponse(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // id
        builder.requiredField(offset, 10); // label
        builder.requiredField(offset, 12); // protocol
        return offset;
    }
    unpack() {
        return new DumpResponseT(this.id(), this.type(), (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null), this.label(), this.protocol(), this.paused());
    }
    unpackTo(_o) {
        _o.id = this.id();
        _o.type = this.type();
        _o.sctpStreamParameters = (this.sctpStreamParameters() !== null ? this.sctpStreamParameters().unpack() : null);
        _o.label = this.label();
        _o.protocol = this.protocol();
        _o.paused = this.paused();
    }
}
exports.DumpResponse = DumpResponse;
class DumpResponseT {
    id;
    type;
    sctpStreamParameters;
    label;
    protocol;
    paused;
    constructor(id = null, type = type_1.Type.SCTP, sctpStreamParameters = null, label = null, protocol = null, paused = false) {
        this.id = id;
        this.type = type;
        this.sctpStreamParameters = sctpStreamParameters;
        this.label = label;
        this.protocol = protocol;
        this.paused = paused;
    }
    pack(builder) {
        const id = (this.id !== null ? builder.createString(this.id) : 0);
        const sctpStreamParameters = (this.sctpStreamParameters !== null ? this.sctpStreamParameters.pack(builder) : 0);
        const label = (this.label !== null ? builder.createString(this.label) : 0);
        const protocol = (this.protocol !== null ? builder.createString(this.protocol) : 0);
        DumpResponse.startDumpResponse(builder);
        DumpResponse.addId(builder, id);
        DumpResponse.addType(builder, this.type);
        DumpResponse.addSctpStreamParameters(builder, sctpStreamParameters);
        DumpResponse.addLabel(builder, label);
        DumpResponse.addProtocol(builder, protocol);
        DumpResponse.addPaused(builder, this.paused);
        return DumpResponse.endDumpResponse(builder);
    }
}
exports.DumpResponseT = DumpResponseT;
