// automatically generated by the FlatBuffers compiler, do not modify
// ignore_for_file: unused_import, unused_field, unused_element, unused_local_variable, constant_identifier_names

import 'dart:typed_data' show Uint8List;

import 'package:flat_buffers/flat_buffers.dart' as fb;

class Foo {
  Foo._(this._bc, this._bcOffset);
  factory Foo(List<int> bytes) {
    final rootRef = fb.BufferContext.fromBytes(bytes);
    return reader.read(rootRef, 0);
  }

  static const fb.Reader<Foo> reader = _FooReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  FooProperties? get myFoo =>
      FooProperties.reader.vTableGetNullable(_bc, _bcOffset, 4);

  @override
  String toString() {
    return 'Foo{myFoo: ${myFoo}}';
  }

  FooT unpack() => FooT(myFoo: myFoo?.unpack());

  static int pack(fb.Builder fbBuilder, FooT? object) {
    if (object == null) return 0;
    return object.pack(fbBuilder);
  }
}

class FooT implements fb.Packable {
  FooPropertiesT? myFoo;

  FooT({this.myFoo});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.startTable(1);
    if (myFoo != null) {
      fbBuilder.addStruct(0, myFoo!.pack(fbBuilder));
    }
    return fbBuilder.endTable();
  }

  @override
  String toString() {
    return 'FooT{myFoo: ${myFoo}}';
  }
}

class _FooReader extends fb.TableReader<Foo> {
  const _FooReader();

  @override
  Foo createObject(fb.BufferContext bc, int offset) => Foo._(bc, offset);
}

class FooBuilder {
  FooBuilder(this.fbBuilder);

  final fb.Builder fbBuilder;

  void begin() {
    fbBuilder.startTable(1);
  }

  int addMyFoo(int offset) {
    fbBuilder.addStruct(0, offset);
    return fbBuilder.offset;
  }

  int finish() {
    return fbBuilder.endTable();
  }
}

class FooObjectBuilder extends fb.ObjectBuilder {
  final FooPropertiesObjectBuilder? _myFoo;

  FooObjectBuilder({FooPropertiesObjectBuilder? myFoo}) : _myFoo = myFoo;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    fbBuilder.startTable(1);
    if (_myFoo != null) {
      fbBuilder.addStruct(0, _myFoo!.finish(fbBuilder));
    }
    return fbBuilder.endTable();
  }

  /// Convenience method to serialize to byte list.
  @override
  Uint8List toBytes([String? fileIdentifier]) {
    final fbBuilder = fb.Builder(deduplicateTables: false);
    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
    return fbBuilder.buffer;
  }
}

class FooProperties {
  FooProperties._(this._bc, this._bcOffset);

  static const fb.Reader<FooProperties> reader = _FooPropertiesReader();

  final fb.BufferContext _bc;
  final int _bcOffset;

  bool get a => const fb.BoolReader().read(_bc, _bcOffset + 0);
  bool get b => const fb.BoolReader().read(_bc, _bcOffset + 1);

  @override
  String toString() {
    return 'FooProperties{a: ${a}, b: ${b}}';
  }

  FooPropertiesT unpack() => FooPropertiesT(a: a, b: b);

  static int pack(fb.Builder fbBuilder, FooPropertiesT? object) {
    if (object == null) return 0;
    return object.pack(fbBuilder);
  }
}

class FooPropertiesT implements fb.Packable {
  bool a;
  bool b;

  FooPropertiesT({required this.a, required this.b});

  @override
  int pack(fb.Builder fbBuilder) {
    fbBuilder.putBool(b);
    fbBuilder.putBool(a);
    return fbBuilder.offset;
  }

  @override
  String toString() {
    return 'FooPropertiesT{a: ${a}, b: ${b}}';
  }
}

class _FooPropertiesReader extends fb.StructReader<FooProperties> {
  const _FooPropertiesReader();

  @override
  int get size => 2;

  @override
  FooProperties createObject(fb.BufferContext bc, int offset) =>
      FooProperties._(bc, offset);
}

class FooPropertiesBuilder {
  FooPropertiesBuilder(this.fbBuilder);

  final fb.Builder fbBuilder;

  int finish(bool a, bool b) {
    fbBuilder.putBool(b);
    fbBuilder.putBool(a);
    return fbBuilder.offset;
  }
}

class FooPropertiesObjectBuilder extends fb.ObjectBuilder {
  final bool _a;
  final bool _b;

  FooPropertiesObjectBuilder({required bool a, required bool b})
    : _a = a,
      _b = b;

  /// Finish building, and store into the [fbBuilder].
  @override
  int finish(fb.Builder fbBuilder) {
    fbBuilder.putBool(_b);
    fbBuilder.putBool(_a);
    return fbBuilder.offset;
  }

  /// Convenience method to serialize to byte list.
  @override
  Uint8List toBytes([String? fileIdentifier]) {
    final fbBuilder = fb.Builder(deduplicateTables: false);
    fbBuilder.finish(finish(fbBuilder), fileIdentifier);
    return fbBuilder.buffer;
  }
}
