"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.StringUint8T = exports.StringUint8 = 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 StringUint8 {
    bb = null;
    bb_pos = 0;
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsStringUint8(bb, obj) {
        return (obj || new StringUint8()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsStringUint8(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new StringUint8()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    key(optionalEncoding) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
    }
    value() {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
    }
    static startStringUint8(builder) {
        builder.startObject(2);
    }
    static addKey(builder, keyOffset) {
        builder.addFieldOffset(0, keyOffset, 0);
    }
    static addValue(builder, value) {
        builder.addFieldInt8(1, value, 0);
    }
    static endStringUint8(builder) {
        const offset = builder.endObject();
        builder.requiredField(offset, 4); // key
        return offset;
    }
    static createStringUint8(builder, keyOffset, value) {
        StringUint8.startStringUint8(builder);
        StringUint8.addKey(builder, keyOffset);
        StringUint8.addValue(builder, value);
        return StringUint8.endStringUint8(builder);
    }
    unpack() {
        return new StringUint8T(this.key(), this.value());
    }
    unpackTo(_o) {
        _o.key = this.key();
        _o.value = this.value();
    }
}
exports.StringUint8 = StringUint8;
class StringUint8T {
    key;
    value;
    constructor(key = null, value = 0) {
        this.key = key;
        this.value = value;
    }
    pack(builder) {
        const key = (this.key !== null ? builder.createString(this.key) : 0);
        return StringUint8.createStringUint8(builder, key, this.value);
    }
}
exports.StringUint8T = StringUint8T;
