// 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 TechEntry implements flatbuffers.IUnpackableObject<TechEntryT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):TechEntry {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

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

value():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readFloat32(this.bb_pos + offset) : 0.0;
}

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

static addKey(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, keyOffset, 0);
}

static addValue(builder:flatbuffers.Builder, value:number) {
  builder.addFieldFloat32(1, value, 0.0);
}

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

static createTechEntry(builder:flatbuffers.Builder, keyOffset:flatbuffers.Offset, value:number):flatbuffers.Offset {
  TechEntry.startTechEntry(builder);
  TechEntry.addKey(builder, keyOffset);
  TechEntry.addValue(builder, value);
  return TechEntry.endTechEntry(builder);
}

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


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

export class TechEntryT implements flatbuffers.IGeneratedObject {
constructor(
  public key: string|Uint8Array|null = null,
  public value: number = 0.0
){}


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

  return TechEntry.createTechEntry(builder,
    key,
    this.value
  );
}
}
