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

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

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

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

attackerShipClass():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 6);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

defender():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 8);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

defenderShipClass():bigint {
  const offset = this.bb!.__offset(this.bb_pos, 10);
  return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0');
}

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

static startBattleActionReport(builder:flatbuffers.Builder) {
  builder.startObject(5);
}

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

static addAttackerShipClass(builder:flatbuffers.Builder, attackerShipClass:bigint) {
  builder.addFieldInt64(1, attackerShipClass, BigInt('0'));
}

static addDefender(builder:flatbuffers.Builder, defender:bigint) {
  builder.addFieldInt64(2, defender, BigInt('0'));
}

static addDefenderShipClass(builder:flatbuffers.Builder, defenderShipClass:bigint) {
  builder.addFieldInt64(3, defenderShipClass, BigInt('0'));
}

static addDestroyed(builder:flatbuffers.Builder, destroyed:boolean) {
  builder.addFieldInt8(4, +destroyed, +false);
}

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

static createBattleActionReport(builder:flatbuffers.Builder, attacker:bigint, attackerShipClass:bigint, defender:bigint, defenderShipClass:bigint, destroyed:boolean):flatbuffers.Offset {
  BattleActionReport.startBattleActionReport(builder);
  BattleActionReport.addAttacker(builder, attacker);
  BattleActionReport.addAttackerShipClass(builder, attackerShipClass);
  BattleActionReport.addDefender(builder, defender);
  BattleActionReport.addDefenderShipClass(builder, defenderShipClass);
  BattleActionReport.addDestroyed(builder, destroyed);
  return BattleActionReport.endBattleActionReport(builder);
}

unpack(): BattleActionReportT {
  return new BattleActionReportT(
    this.attacker(),
    this.attackerShipClass(),
    this.defender(),
    this.defenderShipClass(),
    this.destroyed()
  );
}


unpackTo(_o: BattleActionReportT): void {
  _o.attacker = this.attacker();
  _o.attackerShipClass = this.attackerShipClass();
  _o.defender = this.defender();
  _o.defenderShipClass = this.defenderShipClass();
  _o.destroyed = this.destroyed();
}
}

export class BattleActionReportT implements flatbuffers.IGeneratedObject {
constructor(
  public attacker: bigint = BigInt('0'),
  public attackerShipClass: bigint = BigInt('0'),
  public defender: bigint = BigInt('0'),
  public defenderShipClass: bigint = BigInt('0'),
  public destroyed: boolean = false
){}


pack(builder:flatbuffers.Builder): flatbuffers.Offset {
  return BattleActionReport.createBattleActionReport(builder,
    this.attacker,
    this.attackerShipClass,
    this.defender,
    this.defenderShipClass,
    this.destroyed
  );
}
}
