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

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

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

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

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

static startDeviceSessionRevocationSummaryView(builder:flatbuffers.Builder) {
  builder.startObject(2);
}

static addUserId(builder:flatbuffers.Builder, userIdOffset:flatbuffers.Offset) {
  builder.addFieldOffset(0, userIdOffset, 0);
}

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

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

static createDeviceSessionRevocationSummaryView(builder:flatbuffers.Builder, userIdOffset:flatbuffers.Offset, revokedCount:number):flatbuffers.Offset {
  DeviceSessionRevocationSummaryView.startDeviceSessionRevocationSummaryView(builder);
  DeviceSessionRevocationSummaryView.addUserId(builder, userIdOffset);
  DeviceSessionRevocationSummaryView.addRevokedCount(builder, revokedCount);
  return DeviceSessionRevocationSummaryView.endDeviceSessionRevocationSummaryView(builder);
}

unpack(): DeviceSessionRevocationSummaryViewT {
  return new DeviceSessionRevocationSummaryViewT(
    this.userId(),
    this.revokedCount()
  );
}


unpackTo(_o: DeviceSessionRevocationSummaryViewT): void {
  _o.userId = this.userId();
  _o.revokedCount = this.revokedCount();
}
}

export class DeviceSessionRevocationSummaryViewT implements flatbuffers.IGeneratedObject {
constructor(
  public userId: string|Uint8Array|null = null,
  public revokedCount: number = 0
){}


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

  return DeviceSessionRevocationSummaryView.createDeviceSessionRevocationSummaryView(builder,
    userId,
    this.revokedCount
  );
}
}
