// GENERATED CODE - DO NOT MODIFY BY HAND
// This code was generated by ObjectBox. To update it run the generator again:
// With a Flutter package, run `flutter pub run build_runner build`.
// With a Dart package, run `dart run build_runner build`.
// See also https://docs.objectbox.io/getting-started#generate-objectbox-code

// ignore_for_file: camel_case_types
// coverage:ignore-file

import 'dart:typed_data';

import 'package:flat_buffers/flat_buffers.dart' as fb;
import 'package:objectbox/internal.dart'; // generated code can access "internal" functionality
import 'package:objectbox/objectbox.dart';
import 'package:objectbox_flutter_libs/objectbox_flutter_libs.dart';

import 'models/connection.dart';
import 'models/hashtag.dart';

export 'package:objectbox/objectbox.dart'; // so that callers only have to import this file

final _entities = <ModelEntity>[
  ModelEntity(
      id: const IdUid(1, 1213035855270739890),
      name: 'Connection',
      lastPropertyId: const IdUid(14, 7495390888349913259),
      flags: 0,
      properties: <ModelProperty>[
        ModelProperty(
            id: const IdUid(1, 4133343279264917280),
            name: 'obId',
            type: 6,
            flags: 1),
        ModelProperty(
            id: const IdUid(2, 3393770296096844708),
            name: 'name',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(3, 5864801995210079539),
            name: 'handle',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(4, 2926904168461994523),
            name: 'id',
            type: 9,
            flags: 34848,
            indexId: const IdUid(1, 8342366639839511243)),
        ModelProperty(
            id: const IdUid(5, 3621370552742492695),
            name: 'network',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(6, 3054748457893853359),
            name: 'profileUrl',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(7, 3716471511430220806),
            name: 'avatarUrl',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(8, 3334077197732145885),
            name: 'dbStatus',
            type: 6,
            flags: 0),
        ModelProperty(
            id: const IdUid(9, 7727190023732579468),
            name: 'lastUpdateTime',
            type: 10,
            flags: 0),
        ModelProperty(
            id: const IdUid(10, 7236128628019094924),
            name: 'note',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(11, 714760695336940281),
            name: 'followerCount',
            type: 6,
            flags: 0),
        ModelProperty(
            id: const IdUid(12, 4204087390924684186),
            name: 'followingCount',
            type: 6,
            flags: 0),
        ModelProperty(
            id: const IdUid(13, 6842754750534163483),
            name: 'statusesCount',
            type: 6,
            flags: 0),
        ModelProperty(
            id: const IdUid(14, 7495390888349913259),
            name: 'lastStatus',
            type: 10,
            flags: 0)
      ],
      relations: <ModelRelation>[],
      backlinks: <ModelBacklink>[]),
  ModelEntity(
      id: const IdUid(2, 8060242331335522964),
      name: 'Hashtag',
      lastPropertyId: const IdUid(4, 985152873657204249),
      flags: 0,
      properties: <ModelProperty>[
        ModelProperty(
            id: const IdUid(1, 3633001791521338712),
            name: 'id',
            type: 6,
            flags: 1),
        ModelProperty(
            id: const IdUid(2, 3468373950035339457),
            name: 'tag',
            type: 9,
            flags: 34848,
            indexId: const IdUid(2, 6156017341759176249)),
        ModelProperty(
            id: const IdUid(3, 5102584273729210526),
            name: 'url',
            type: 9,
            flags: 0),
        ModelProperty(
            id: const IdUid(4, 985152873657204249),
            name: 'lastUpdateTime',
            type: 10,
            flags: 0)
      ],
      relations: <ModelRelation>[],
      backlinks: <ModelBacklink>[])
];

/// Open an ObjectBox store with the model declared in this file.
Future<Store> openStore(
        {String? directory,
        int? maxDBSizeInKB,
        int? fileMode,
        int? maxReaders,
        bool queriesCaseSensitiveDefault = true,
        String? macosApplicationGroup}) async =>
    Store(getObjectBoxModel(),
        directory: directory ?? (await defaultStoreDirectory()).path,
        maxDBSizeInKB: maxDBSizeInKB,
        fileMode: fileMode,
        maxReaders: maxReaders,
        queriesCaseSensitiveDefault: queriesCaseSensitiveDefault,
        macosApplicationGroup: macosApplicationGroup);

/// ObjectBox model definition, pass it to [Store] - Store(getObjectBoxModel())
ModelDefinition getObjectBoxModel() {
  final model = ModelInfo(
      entities: _entities,
      lastEntityId: const IdUid(2, 8060242331335522964),
      lastIndexId: const IdUid(2, 6156017341759176249),
      lastRelationId: const IdUid(0, 0),
      lastSequenceId: const IdUid(0, 0),
      retiredEntityUids: const [],
      retiredIndexUids: const [],
      retiredPropertyUids: const [],
      retiredRelationUids: const [],
      modelVersion: 5,
      modelVersionParserMinimum: 5,
      version: 1);

  final bindings = <Type, EntityDefinition>{
    Connection: EntityDefinition<Connection>(
        model: _entities[0],
        toOneRelations: (Connection object) => [],
        toManyRelations: (Connection object) => {},
        getId: (Connection object) => object.obId,
        setId: (Connection object, int id) {
          object.obId = id;
        },
        objectToFB: (Connection object, fb.Builder fbb) {
          final nameOffset = fbb.writeString(object.name);
          final handleOffset = fbb.writeString(object.handle);
          final idOffset = fbb.writeString(object.id);
          final networkOffset = fbb.writeString(object.network);
          final profileUrlOffset = fbb.writeString(object.profileUrl);
          final avatarUrlOffset = fbb.writeString(object.avatarUrl);
          final noteOffset = fbb.writeString(object.note);
          fbb.startTable(15);
          fbb.addInt64(0, object.obId);
          fbb.addOffset(1, nameOffset);
          fbb.addOffset(2, handleOffset);
          fbb.addOffset(3, idOffset);
          fbb.addOffset(4, networkOffset);
          fbb.addOffset(5, profileUrlOffset);
          fbb.addOffset(6, avatarUrlOffset);
          fbb.addInt64(7, object.dbStatus);
          fbb.addInt64(8, object.lastUpdateTime.millisecondsSinceEpoch);
          fbb.addOffset(9, noteOffset);
          fbb.addInt64(10, object.followerCount);
          fbb.addInt64(11, object.followingCount);
          fbb.addInt64(12, object.statusesCount);
          fbb.addInt64(13, object.lastStatus?.millisecondsSinceEpoch);
          fbb.finish(fbb.endTable());
          return object.obId;
        },
        objectFromFB: (Store store, ByteData fbData) {
          final buffer = fb.BufferContext(fbData);
          final rootOffset = buffer.derefObject(0);
          final lastStatusValue =
              const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 30);
          final object = Connection(
              obId: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
              name: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 6, ''),
              handle: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 8, ''),
              id: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 10, ''),
              profileUrl: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 14, ''),
              network: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 12, ''),
              avatarUrl: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 16, ''),
              lastUpdateTime: DateTime.fromMillisecondsSinceEpoch(
                  const fb.Int64Reader().vTableGet(buffer, rootOffset, 20, 0)),
              note: const fb.StringReader(asciiOptimization: true).vTableGet(buffer, rootOffset, 22, ''),
              followerCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 24),
              followingCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 26),
              statusesCount: const fb.Int64Reader().vTableGetNullable(buffer, rootOffset, 28),
              lastStatus: lastStatusValue == null ? null : DateTime.fromMillisecondsSinceEpoch(lastStatusValue))
            ..dbStatus = const fb.Int64Reader().vTableGet(buffer, rootOffset, 18, 0);

          return object;
        }),
    Hashtag: EntityDefinition<Hashtag>(
        model: _entities[1],
        toOneRelations: (Hashtag object) => [],
        toManyRelations: (Hashtag object) => {},
        getId: (Hashtag object) => object.id,
        setId: (Hashtag object, int id) {
          object.id = id;
        },
        objectToFB: (Hashtag object, fb.Builder fbb) {
          final tagOffset = fbb.writeString(object.tag);
          final urlOffset = fbb.writeString(object.url);
          fbb.startTable(5);
          fbb.addInt64(0, object.id);
          fbb.addOffset(1, tagOffset);
          fbb.addOffset(2, urlOffset);
          fbb.addInt64(3, object.lastUpdateTime.millisecondsSinceEpoch);
          fbb.finish(fbb.endTable());
          return object.id;
        },
        objectFromFB: (Store store, ByteData fbData) {
          final buffer = fb.BufferContext(fbData);
          final rootOffset = buffer.derefObject(0);

          final object = Hashtag(
              id: const fb.Int64Reader().vTableGet(buffer, rootOffset, 4, 0),
              tag: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 6, ''),
              url: const fb.StringReader(asciiOptimization: true)
                  .vTableGet(buffer, rootOffset, 8, ''))
            ..lastUpdateTime = DateTime.fromMillisecondsSinceEpoch(
                const fb.Int64Reader().vTableGet(buffer, rootOffset, 10, 0));

          return object;
        })
  };

  return ModelDefinition(model, bindings);
}

/// [Connection] entity fields to define ObjectBox queries.
class Connection_ {
  /// see [Connection.obId]
  static final obId =
      QueryIntegerProperty<Connection>(_entities[0].properties[0]);

  /// see [Connection.name]
  static final name =
      QueryStringProperty<Connection>(_entities[0].properties[1]);

  /// see [Connection.handle]
  static final handle =
      QueryStringProperty<Connection>(_entities[0].properties[2]);

  /// see [Connection.id]
  static final id = QueryStringProperty<Connection>(_entities[0].properties[3]);

  /// see [Connection.network]
  static final network =
      QueryStringProperty<Connection>(_entities[0].properties[4]);

  /// see [Connection.profileUrl]
  static final profileUrl =
      QueryStringProperty<Connection>(_entities[0].properties[5]);

  /// see [Connection.avatarUrl]
  static final avatarUrl =
      QueryStringProperty<Connection>(_entities[0].properties[6]);

  /// see [Connection.dbStatus]
  static final dbStatus =
      QueryIntegerProperty<Connection>(_entities[0].properties[7]);

  /// see [Connection.lastUpdateTime]
  static final lastUpdateTime =
      QueryIntegerProperty<Connection>(_entities[0].properties[8]);

  /// see [Connection.note]
  static final note =
      QueryStringProperty<Connection>(_entities[0].properties[9]);

  /// see [Connection.followerCount]
  static final followerCount =
      QueryIntegerProperty<Connection>(_entities[0].properties[10]);

  /// see [Connection.followingCount]
  static final followingCount =
      QueryIntegerProperty<Connection>(_entities[0].properties[11]);

  /// see [Connection.statusesCount]
  static final statusesCount =
      QueryIntegerProperty<Connection>(_entities[0].properties[12]);

  /// see [Connection.lastStatus]
  static final lastStatus =
      QueryIntegerProperty<Connection>(_entities[0].properties[13]);
}

/// [Hashtag] entity fields to define ObjectBox queries.
class Hashtag_ {
  /// see [Hashtag.id]
  static final id = QueryIntegerProperty<Hashtag>(_entities[1].properties[0]);

  /// see [Hashtag.tag]
  static final tag = QueryStringProperty<Hashtag>(_entities[1].properties[1]);

  /// see [Hashtag.url]
  static final url = QueryStringProperty<Hashtag>(_entities[1].properties[2]);

  /// see [Hashtag.lastUpdateTime]
  static final lastUpdateTime =
      QueryIntegerProperty<Hashtag>(_entities[1].properties[3]);
}
