// automatically generated by the FlatBuffers compiler, do not modify

/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */

import * as flatbuffers from 'flatbuffers';



export class RouteEntry implements flatbuffers.IUnpackableObject<RouteEntryT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):RouteEntry {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

static getRootAsRouteEntry(bb:flatbuffers.ByteBuffer, obj?:RouteEntry):RouteEntry {
  return (obj || new RouteEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

static getSizePrefixedRootAsRouteEntry(bb:flatbuffers.ByteBuffer, obj?:RouteEntry):RouteEntry {
  bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
  return (obj || new RouteEntry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
}

key():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

value():string|null
value(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
value(optionalEncoding?:any):string|Uint8Array|null {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null;
}

static startRouteEntry(builder:flatbuffers.Builder) {
  builder.startObject(2);
}

static addKey(builder:flatbuffers.Builder, key:bigint) {
  builder.addFieldInt64(0, key, BigInt('0'));
}

static addValue(builder:flatbuffers.Builder, valueOffset:flatbuffers.Offset) {
  builder.addFieldOffset(1, valueOffset, 0);
}

static endRouteEntry(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  return offset;
}

static createRouteEntry(builder:flatbuffers.Builder, key:bigint, valueOffset:flatbuffers.Offset):flatbuffers.Offset {
  RouteEntry.startRouteEntry(builder);
  RouteEntry.addKey(builder, key);
  RouteEntry.addValue(builder, valueOffset);
  return RouteEntry.endRouteEntry(builder);
}

unpack(): RouteEntryT {
  return new RouteEntryT(
    this.key(),
    this.value()
  );
}


unpackTo(_o: RouteEntryT): void {
  _o.key = this.key();
  _o.value = this.value();
}
}

export class RouteEntryT implements flatbuffers.IGeneratedObject {
constructor(
  public key: bigint = BigInt('0'),
  public value: string|Uint8Array|null = null
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  const value = (this.value !== null ? builder.createString(this.value!) : 0);

  return RouteEntry.createRouteEntry(builder,
    this.key,
    value
  );
}
}
