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

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

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

v():string|null
v(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
v(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;
}

static startStringValue(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addV(builder:flatbuffers.Builder, vOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, vOffset, 0);
}

static endStringValue(builder:flatbuffers.Builder):flatbuffers.Offset {
  const offset = builder.endObject();
  builder.requiredField(offset, 4) // v
  return offset;
}

static createStringValue(builder:flatbuffers.Builder, vOffset:flatbuffers.Offset):flatbuffers.Offset {
  StringValue.startStringValue(builder);
  StringValue.addV(builder, vOffset);
  return StringValue.endStringValue(builder);
}
}
