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

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

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

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

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

static addType(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, typeOffset, 0);
}

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

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

static createActorRef(builder:flatbuffers.Builder, typeOffset:flatbuffers.Offset, idOffset:flatbuffers.Offset):flatbuffers.Offset {
  ActorRef.startActorRef(builder);
  ActorRef.addType(builder, typeOffset);
  ActorRef.addId(builder, idOffset);
  return ActorRef.endActorRef(builder);
}

unpack(): ActorRefT {
  return new ActorRefT(
    this.type(),
    this.id()
  );
}


unpackTo(_o: ActorRefT): void {
  _o.type = this.type();
  _o.id = this.id();
}
}

export class ActorRefT implements flatbuffers.IGeneratedObject {
constructor(
  public type: string|Uint8Array|null = null,
  public id: string|Uint8Array|null = null
){}


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

  return ActorRef.createActorRef(builder,
    type,
    id
  );
}
}
