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

import * as flatbuffers from 'flatbuffers';

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

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

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

blocked():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

permanent():boolean {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false;
}

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

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

static startBlockStatus(builder:flatbuffers.Builder) {
  builder.startObject(4);
}

static addBlocked(builder:flatbuffers.Builder, blocked:boolean) {
  builder.addFieldInt8(0, +blocked, +false);
}

static addPermanent(builder:flatbuffers.Builder, permanent:boolean) {
  builder.addFieldInt8(1, +permanent, +false);
}

static addUntil(builder:flatbuffers.Builder, untilOffset:flatbuffers.Offset) {
  builder.addFieldOffset(2, untilOffset, 0);
}

static addReason(builder:flatbuffers.Builder, reasonOffset:flatbuffers.Offset) {
  builder.addFieldOffset(3, reasonOffset, 0);
}

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

static createBlockStatus(builder:flatbuffers.Builder, blocked:boolean, permanent:boolean, untilOffset:flatbuffers.Offset, reasonOffset:flatbuffers.Offset):flatbuffers.Offset {
  BlockStatus.startBlockStatus(builder);
  BlockStatus.addBlocked(builder, blocked);
  BlockStatus.addPermanent(builder, permanent);
  BlockStatus.addUntil(builder, untilOffset);
  BlockStatus.addReason(builder, reasonOffset);
  return BlockStatus.endBlockStatus(builder);
}
}
