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

import * as flatbuffers from 'flatbuffers';

export class DraftView {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):DraftView {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

json():string|null
json(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null
json(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 startDraftView(builder:flatbuffers.Builder) {
  builder.startObject(1);
}

static addJson(builder:flatbuffers.Builder, jsonOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, jsonOffset, 0);
}

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

static createDraftView(builder:flatbuffers.Builder, jsonOffset:flatbuffers.Offset):flatbuffers.Offset {
  DraftView.startDraftView(builder);
  DraftView.addJson(builder, jsonOffset);
  return DraftView.endDraftView(builder);
}
}
