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

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

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

address():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint64(this.bb_pos + offset) : BigInt('0');
}

mutate_address(value:bigint):boolean {
  const offset = this.bb!.__offset(this.bb_pos, 4);

  if (offset === 0) {
    return false;
  }

  this.bb!.writeUint64(this.bb_pos + offset, value);
  return true;
}

size():number {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readUint32(this.bb_pos + offset) : 0;
}

mutate_size(value:number):boolean {
  const offset = this.bb!.__offset(this.bb_pos, 6);

  if (offset === 0) {
    return false;
  }

  this.bb!.writeUint32(this.bb_pos + offset, value);
  return true;
}

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

mutate_success(value:boolean):boolean {
  const offset = this.bb!.__offset(this.bb_pos, 8);

  if (offset === 0) {
    return false;
  }

  this.bb!.writeInt8(this.bb_pos + offset, +value);
  return true;
}

static startWriteMemoryResponse(builder:flatbuffers.Builder) {
  builder.startObject(3);
}

static addAddress(builder:flatbuffers.Builder, address:bigint) {
  builder.addFieldInt64(0, address, BigInt('0'));
}

static addSize(builder:flatbuffers.Builder, size:number) {
  builder.addFieldInt32(1, size, 0);
}

static addSuccess(builder:flatbuffers.Builder, success:boolean) {
  builder.addFieldInt8(2, +success, +false);
}

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

static createWriteMemoryResponse(builder:flatbuffers.Builder, address:bigint, size:number, success:boolean):flatbuffers.Offset {
  WriteMemoryResponse.startWriteMemoryResponse(builder);
  WriteMemoryResponse.addAddress(builder, address);
  WriteMemoryResponse.addSize(builder, size);
  WriteMemoryResponse.addSuccess(builder, success);
  return WriteMemoryResponse.endWriteMemoryResponse(builder);
}

unpack(): WriteMemoryResponseT {
  return new WriteMemoryResponseT(
    this.address(),
    this.size(),
    this.success()
  );
}


unpackTo(_o: WriteMemoryResponseT): void {
  _o.address = this.address();
  _o.size = this.size();
  _o.success = this.success();
}
}

export class WriteMemoryResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public address: bigint = BigInt('0'),
  public size: number = 0,
  public success: boolean = false
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return WriteMemoryResponse.createWriteMemoryResponse(builder,
    this.address,
    this.size,
    this.success
  );
}
}
