"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.CloseDataProducerRequestT = exports.CloseDataProducerRequest = void 0;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const flatbuffers = require("flatbuffers");
class CloseDataProducerRequest {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsCloseDataProducerRequest(bb, obj) {
        return (obj || new CloseDataProducerRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsCloseDataProducerRequest(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new CloseDataProducerRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    dataProducerId(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    static startCloseDataProducerRequest(builder) {
        builder.startObject(1);
    }
    static addDataProducerId(builder, dataProducerIdOffset) {
        builder.addFieldOffset(0, dataProducerIdOffset, 0);
    }
    static endCloseDataProducerRequest(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // data_producer_id
        return offset;
    }
    static createCloseDataProducerRequest(builder, dataProducerIdOffset) {
        CloseDataProducerRequest.startCloseDataProducerRequest(builder);
        CloseDataProducerRequest.addDataProducerId(builder, dataProducerIdOffset);
        return CloseDataProducerRequest.endCloseDataProducerRequest(builder);
    }
    unpack() {
        return new CloseDataProducerRequestT(this.dataProducerId());
    }
    unpackTo(_o) {
        _o.dataProducerId = this.dataProducerId();
    }
}
exports.CloseDataProducerRequest = CloseDataProducerRequest;
class CloseDataProducerRequestT {
    dataProducerId;
    constructor(dataProducerId = null) {
        this.dataProducerId = dataProducerId;
    }
    pack(builder) {
        const dataProducerId = (this.dataProducerId !== null ? builder.createString(this.dataProducerId) : 0);
        return CloseDataProducerRequest.createCloseDataProducerRequest(builder, dataProducerId);
    }
}
exports.CloseDataProducerRequestT = CloseDataProducerRequestT;
