// 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';

import { State } from '../debugger/state.js';


export class GetStateResponse implements flatbuffers.IUnpackableObject<GetStateResponseT> {
  bb: flatbuffers.ByteBuffer|null = null;
  bb_pos = 0;
  __init(i:number, bb:flatbuffers.ByteBuffer):GetStateResponse {
  this.bb_pos = i;
  this.bb = bb;
  return this;
}

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

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

state():State {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? this.bb!.readUint32(this.bb_pos + offset) : State.None;
}

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

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

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

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

static addState(builder:flatbuffers.Builder, state:State) {
  builder.addFieldInt32(0, state, State.None);
}

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

static createGetStateResponse(builder:flatbuffers.Builder, state:State):flatbuffers.Offset {
  GetStateResponse.startGetStateResponse(builder);
  GetStateResponse.addState(builder, state);
  return GetStateResponse.endGetStateResponse(builder);
}

unpack(): GetStateResponseT {
  return new GetStateResponseT(
    this.state()
  );
}


unpackTo(_o: GetStateResponseT): void {
  _o.state = this.state();
}
}

export class GetStateResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public state: State = State.None
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return GetStateResponse.createGetStateResponse(builder,
    this.state
  );
}
}
