// 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 { MailRecipientState, MailRecipientStateT } from '../diplomail/mail-recipient-state.js';


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

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

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

state(obj?:MailRecipientState):MailRecipientState|null {
  const offset = this.bb!.__offset(this.bb_pos, 4);
  return offset ? (obj || new MailRecipientState()).__init(this.bb!.__indirect(this.bb_pos + offset), this.bb!) : null;
}

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

static addState(builder:flatbuffers.Builder, stateOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, stateOffset, 0);
}

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

static createDeleteResponse(builder:flatbuffers.Builder, stateOffset:flatbuffers.Offset):flatbuffers.Offset {
  DeleteResponse.startDeleteResponse(builder);
  DeleteResponse.addState(builder, stateOffset);
  return DeleteResponse.endDeleteResponse(builder);
}

unpack(): DeleteResponseT {
  return new DeleteResponseT(
    (this.state() !== null ? this.state()!.unpack() : null)
  );
}


unpackTo(_o: DeleteResponseT): void {
  _o.state = (this.state() !== null ? this.state()!.unpack() : null);
}
}

export class DeleteResponseT implements flatbuffers.IGeneratedObject {
constructor(
  public state: MailRecipientStateT|null = null
){}


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

  return DeleteResponse.createDeleteResponse(builder,
    state
  );
}
}
