// automatically generated by the FlatBuffers compiler, do not modify
// swiftlint:disable all
// swiftformat:disable all

import FlatBuffers

public struct zzz_DflatGen_GenerationEstimation: FlatBufferObject, Verifiable {

  static func validateVersion() { FlatBuffersVersion_22_9_29() }
  public var __buffer: ByteBuffer! { return _accessor.bb }
  private var _accessor: Table

  public static func getRootAsGenerationEstimation(bb: ByteBuffer)
    -> zzz_DflatGen_GenerationEstimation
  {
    return zzz_DflatGen_GenerationEstimation(
      Table(
        bb: bb, position: Int32(bb.read(def: UOffset.self, position: bb.reader)) + Int32(bb.reader))
    )
  }

  private init(_ t: Table) { _accessor = t }
  public init(_ bb: ByteBuffer, o: Int32) { _accessor = Table(bb: bb, position: o) }

  private enum VTOFFSET: VOffset {
    case textEncoded = 4
    case imageEncoded = 6
    case samplingStep = 8
    case imageDecoded = 10
    case secondPassImageEncoded = 12
    case secondPassSamplingStep = 14
    case secondPassImageDecoded = 16
    case imageUpscaled = 18
    case faceRestored = 20
    var v: Int32 { Int32(self.rawValue) }
    var p: VOffset { self.rawValue }
  }

  public var textEncoded: Float32 {
    let o = _accessor.offset(VTOFFSET.textEncoded.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var imageEncoded: Float32 {
    let o = _accessor.offset(VTOFFSET.imageEncoded.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var samplingStep: Float32 {
    let o = _accessor.offset(VTOFFSET.samplingStep.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var imageDecoded: Float32 {
    let o = _accessor.offset(VTOFFSET.imageDecoded.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var secondPassImageEncoded: Float32 {
    let o = _accessor.offset(VTOFFSET.secondPassImageEncoded.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var secondPassSamplingStep: Float32 {
    let o = _accessor.offset(VTOFFSET.secondPassSamplingStep.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var secondPassImageDecoded: Float32 {
    let o = _accessor.offset(VTOFFSET.secondPassImageDecoded.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var imageUpscaled: Float32 {
    let o = _accessor.offset(VTOFFSET.imageUpscaled.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public var faceRestored: Float32 {
    let o = _accessor.offset(VTOFFSET.faceRestored.v)
    return o == 0 ? 0.0 : _accessor.readBuffer(of: Float32.self, at: o)
  }
  public static func startGenerationEstimation(_ fbb: inout FlatBufferBuilder) -> UOffset {
    fbb.startTable(with: 9)
  }
  public static func add(textEncoded: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: textEncoded, def: 0.0, at: VTOFFSET.textEncoded.p)
  }
  public static func add(imageEncoded: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: imageEncoded, def: 0.0, at: VTOFFSET.imageEncoded.p)
  }
  public static func add(samplingStep: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: samplingStep, def: 0.0, at: VTOFFSET.samplingStep.p)
  }
  public static func add(imageDecoded: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: imageDecoded, def: 0.0, at: VTOFFSET.imageDecoded.p)
  }
  public static func add(secondPassImageEncoded: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: secondPassImageEncoded, def: 0.0, at: VTOFFSET.secondPassImageEncoded.p)
  }
  public static func add(secondPassSamplingStep: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: secondPassSamplingStep, def: 0.0, at: VTOFFSET.secondPassSamplingStep.p)
  }
  public static func add(secondPassImageDecoded: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: secondPassImageDecoded, def: 0.0, at: VTOFFSET.secondPassImageDecoded.p)
  }
  public static func add(imageUpscaled: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: imageUpscaled, def: 0.0, at: VTOFFSET.imageUpscaled.p)
  }
  public static func add(faceRestored: Float32, _ fbb: inout FlatBufferBuilder) {
    fbb.add(element: faceRestored, def: 0.0, at: VTOFFSET.faceRestored.p)
  }
  public static func endGenerationEstimation(_ fbb: inout FlatBufferBuilder, start: UOffset)
    -> Offset
  {
    let end = Offset(offset: fbb.endTable(at: start))
    return end
  }
  public static func createGenerationEstimation(
    _ fbb: inout FlatBufferBuilder,
    textEncoded: Float32 = 0.0,
    imageEncoded: Float32 = 0.0,
    samplingStep: Float32 = 0.0,
    imageDecoded: Float32 = 0.0,
    secondPassImageEncoded: Float32 = 0.0,
    secondPassSamplingStep: Float32 = 0.0,
    secondPassImageDecoded: Float32 = 0.0,
    imageUpscaled: Float32 = 0.0,
    faceRestored: Float32 = 0.0
  ) -> Offset {
    let __start = zzz_DflatGen_GenerationEstimation.startGenerationEstimation(&fbb)
    zzz_DflatGen_GenerationEstimation.add(textEncoded: textEncoded, &fbb)
    zzz_DflatGen_GenerationEstimation.add(imageEncoded: imageEncoded, &fbb)
    zzz_DflatGen_GenerationEstimation.add(samplingStep: samplingStep, &fbb)
    zzz_DflatGen_GenerationEstimation.add(imageDecoded: imageDecoded, &fbb)
    zzz_DflatGen_GenerationEstimation.add(secondPassImageEncoded: secondPassImageEncoded, &fbb)
    zzz_DflatGen_GenerationEstimation.add(secondPassSamplingStep: secondPassSamplingStep, &fbb)
    zzz_DflatGen_GenerationEstimation.add(secondPassImageDecoded: secondPassImageDecoded, &fbb)
    zzz_DflatGen_GenerationEstimation.add(imageUpscaled: imageUpscaled, &fbb)
    zzz_DflatGen_GenerationEstimation.add(faceRestored: faceRestored, &fbb)
    return zzz_DflatGen_GenerationEstimation.endGenerationEstimation(&fbb, start: __start)
  }

  public static func verify<T>(_ verifier: inout Verifier, at position: Int, of type: T.Type) throws
  where T: Verifiable {
    var _v = try verifier.visitTable(at: position)
    try _v.visit(
      field: VTOFFSET.textEncoded.p, fieldName: "textEncoded", required: false, type: Float32.self)
    try _v.visit(
      field: VTOFFSET.imageEncoded.p, fieldName: "imageEncoded", required: false, type: Float32.self
    )
    try _v.visit(
      field: VTOFFSET.samplingStep.p, fieldName: "samplingStep", required: false, type: Float32.self
    )
    try _v.visit(
      field: VTOFFSET.imageDecoded.p, fieldName: "imageDecoded", required: false, type: Float32.self
    )
    try _v.visit(
      field: VTOFFSET.secondPassImageEncoded.p, fieldName: "secondPassImageEncoded",
      required: false, type: Float32.self)
    try _v.visit(
      field: VTOFFSET.secondPassSamplingStep.p, fieldName: "secondPassSamplingStep",
      required: false, type: Float32.self)
    try _v.visit(
      field: VTOFFSET.secondPassImageDecoded.p, fieldName: "secondPassImageDecoded",
      required: false, type: Float32.self)
    try _v.visit(
      field: VTOFFSET.imageUpscaled.p, fieldName: "imageUpscaled", required: false,
      type: Float32.self)
    try _v.visit(
      field: VTOFFSET.faceRestored.p, fieldName: "faceRestored", required: false, type: Float32.self
    )
    _v.finish()
  }
}
