// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'database.dart';

// ignore_for_file: type=lint
class $VarietiesTable extends Varieties
    with TableInfo<$VarietiesTable, Variety> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $VarietiesTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _labelMeta = const VerificationMeta('label');
  @override
  late final GeneratedColumn<String> label = GeneratedColumn<String>(
    'label',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _speciesIdMeta = const VerificationMeta(
    'speciesId',
  );
  @override
  late final GeneratedColumn<String> speciesId = GeneratedColumn<String>(
    'species_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _cultivarNameMeta = const VerificationMeta(
    'cultivarName',
  );
  @override
  late final GeneratedColumn<String> cultivarName = GeneratedColumn<String>(
    'cultivar_name',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _categoryMeta = const VerificationMeta(
    'category',
  );
  @override
  late final GeneratedColumn<String> category = GeneratedColumn<String>(
    'category',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _notesMeta = const VerificationMeta('notes');
  @override
  late final GeneratedColumn<String> notes = GeneratedColumn<String>(
    'notes',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _isDraftMeta = const VerificationMeta(
    'isDraft',
  );
  @override
  late final GeneratedColumn<bool> isDraft = GeneratedColumn<bool>(
    'is_draft',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_draft" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _isOrganicMeta = const VerificationMeta(
    'isOrganic',
  );
  @override
  late final GeneratedColumn<bool> isOrganic = GeneratedColumn<bool>(
    'is_organic',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_organic" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _needsReproductionMeta = const VerificationMeta(
    'needsReproduction',
  );
  @override
  late final GeneratedColumn<bool> needsReproduction = GeneratedColumn<bool>(
    'needs_reproduction',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("needs_reproduction" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _sowMonthsMeta = const VerificationMeta(
    'sowMonths',
  );
  @override
  late final GeneratedColumn<int> sowMonths = GeneratedColumn<int>(
    'sow_months',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _transplantMonthsMeta = const VerificationMeta(
    'transplantMonths',
  );
  @override
  late final GeneratedColumn<int> transplantMonths = GeneratedColumn<int>(
    'transplant_months',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _floweringMonthsMeta = const VerificationMeta(
    'floweringMonths',
  );
  @override
  late final GeneratedColumn<int> floweringMonths = GeneratedColumn<int>(
    'flowering_months',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _fruitingMonthsMeta = const VerificationMeta(
    'fruitingMonths',
  );
  @override
  late final GeneratedColumn<int> fruitingMonths = GeneratedColumn<int>(
    'fruiting_months',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _seedHarvestMonthsMeta = const VerificationMeta(
    'seedHarvestMonths',
  );
  @override
  late final GeneratedColumn<int> seedHarvestMonths = GeneratedColumn<int>(
    'seed_harvest_months',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    label,
    speciesId,
    cultivarName,
    category,
    notes,
    isDraft,
    isOrganic,
    needsReproduction,
    sowMonths,
    transplantMonths,
    floweringMonths,
    fruitingMonths,
    seedHarvestMonths,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'varieties';
  @override
  VerificationContext validateIntegrity(
    Insertable<Variety> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('label')) {
      context.handle(
        _labelMeta,
        label.isAcceptableOrUnknown(data['label']!, _labelMeta),
      );
    } else if (isInserting) {
      context.missing(_labelMeta);
    }
    if (data.containsKey('species_id')) {
      context.handle(
        _speciesIdMeta,
        speciesId.isAcceptableOrUnknown(data['species_id']!, _speciesIdMeta),
      );
    }
    if (data.containsKey('cultivar_name')) {
      context.handle(
        _cultivarNameMeta,
        cultivarName.isAcceptableOrUnknown(
          data['cultivar_name']!,
          _cultivarNameMeta,
        ),
      );
    }
    if (data.containsKey('category')) {
      context.handle(
        _categoryMeta,
        category.isAcceptableOrUnknown(data['category']!, _categoryMeta),
      );
    }
    if (data.containsKey('notes')) {
      context.handle(
        _notesMeta,
        notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
      );
    }
    if (data.containsKey('is_draft')) {
      context.handle(
        _isDraftMeta,
        isDraft.isAcceptableOrUnknown(data['is_draft']!, _isDraftMeta),
      );
    }
    if (data.containsKey('is_organic')) {
      context.handle(
        _isOrganicMeta,
        isOrganic.isAcceptableOrUnknown(data['is_organic']!, _isOrganicMeta),
      );
    }
    if (data.containsKey('needs_reproduction')) {
      context.handle(
        _needsReproductionMeta,
        needsReproduction.isAcceptableOrUnknown(
          data['needs_reproduction']!,
          _needsReproductionMeta,
        ),
      );
    }
    if (data.containsKey('sow_months')) {
      context.handle(
        _sowMonthsMeta,
        sowMonths.isAcceptableOrUnknown(data['sow_months']!, _sowMonthsMeta),
      );
    }
    if (data.containsKey('transplant_months')) {
      context.handle(
        _transplantMonthsMeta,
        transplantMonths.isAcceptableOrUnknown(
          data['transplant_months']!,
          _transplantMonthsMeta,
        ),
      );
    }
    if (data.containsKey('flowering_months')) {
      context.handle(
        _floweringMonthsMeta,
        floweringMonths.isAcceptableOrUnknown(
          data['flowering_months']!,
          _floweringMonthsMeta,
        ),
      );
    }
    if (data.containsKey('fruiting_months')) {
      context.handle(
        _fruitingMonthsMeta,
        fruitingMonths.isAcceptableOrUnknown(
          data['fruiting_months']!,
          _fruitingMonthsMeta,
        ),
      );
    }
    if (data.containsKey('seed_harvest_months')) {
      context.handle(
        _seedHarvestMonthsMeta,
        seedHarvestMonths.isAcceptableOrUnknown(
          data['seed_harvest_months']!,
          _seedHarvestMonthsMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Variety map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Variety(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      label: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}label'],
      )!,
      speciesId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}species_id'],
      ),
      cultivarName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}cultivar_name'],
      ),
      category: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}category'],
      ),
      notes: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}notes'],
      ),
      isDraft: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_draft'],
      )!,
      isOrganic: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_organic'],
      )!,
      needsReproduction: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}needs_reproduction'],
      )!,
      sowMonths: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sow_months'],
      ),
      transplantMonths: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}transplant_months'],
      ),
      floweringMonths: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}flowering_months'],
      ),
      fruitingMonths: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}fruiting_months'],
      ),
      seedHarvestMonths: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}seed_harvest_months'],
      ),
    );
  }

  @override
  $VarietiesTable createAlias(String alias) {
    return $VarietiesTable(attachedDatabase, alias);
  }
}

class Variety extends DataClass implements Insertable<Variety> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String label;
  final String? speciesId;
  final String? cultivarName;
  final String? category;
  final String? notes;

  /// A draft captured photo-first ("capture now, catalogue later"): it holds a
  /// photo but not yet a real name, and lives in the "to catalogue" tray until
  /// the user labels it. A plain LWW scalar, so it merges like any other field.
  final bool isDraft;

  /// Grower-declared organic ("eco") provenance. A self-declaration, not a
  /// third-party certification (that would be a separate flag). Surfaced as a
  /// badge and an inventory filter. A plain LWW scalar.
  final bool isOrganic;

  /// A stewardship intent set by the grower: "regrow this variety this season"
  /// before its stock or vitality runs out. Complements the automatic viability
  /// warning (which is age-derived) with an explicit human decision. Surfaced
  /// as a badge and an inventory filter. A plain LWW scalar.
  final bool needsReproduction;

  /// Advisory crop-calendar months, typical for this variety — when to sow,
  /// transplant, expect flowers/fruit, and harvest seed. Each phase usually
  /// spans several months (e.g. sow in spring *and* autumn), so each is a set
  /// of months packed as a 12-bit mask (see `domain/crop_calendar.dart`), an
  /// optional LWW scalar; null means "not recorded". Guidance, not a per-year
  /// actuals log (that path stays available via Movements).
  final int? sowMonths;
  final int? transplantMonths;
  final int? floweringMonths;
  final int? fruitingMonths;
  final int? seedHarvestMonths;
  const Variety({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.label,
    this.speciesId,
    this.cultivarName,
    this.category,
    this.notes,
    required this.isDraft,
    required this.isOrganic,
    required this.needsReproduction,
    this.sowMonths,
    this.transplantMonths,
    this.floweringMonths,
    this.fruitingMonths,
    this.seedHarvestMonths,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['label'] = Variable<String>(label);
    if (!nullToAbsent || speciesId != null) {
      map['species_id'] = Variable<String>(speciesId);
    }
    if (!nullToAbsent || cultivarName != null) {
      map['cultivar_name'] = Variable<String>(cultivarName);
    }
    if (!nullToAbsent || category != null) {
      map['category'] = Variable<String>(category);
    }
    if (!nullToAbsent || notes != null) {
      map['notes'] = Variable<String>(notes);
    }
    map['is_draft'] = Variable<bool>(isDraft);
    map['is_organic'] = Variable<bool>(isOrganic);
    map['needs_reproduction'] = Variable<bool>(needsReproduction);
    if (!nullToAbsent || sowMonths != null) {
      map['sow_months'] = Variable<int>(sowMonths);
    }
    if (!nullToAbsent || transplantMonths != null) {
      map['transplant_months'] = Variable<int>(transplantMonths);
    }
    if (!nullToAbsent || floweringMonths != null) {
      map['flowering_months'] = Variable<int>(floweringMonths);
    }
    if (!nullToAbsent || fruitingMonths != null) {
      map['fruiting_months'] = Variable<int>(fruitingMonths);
    }
    if (!nullToAbsent || seedHarvestMonths != null) {
      map['seed_harvest_months'] = Variable<int>(seedHarvestMonths);
    }
    return map;
  }

  VarietiesCompanion toCompanion(bool nullToAbsent) {
    return VarietiesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      label: Value(label),
      speciesId: speciesId == null && nullToAbsent
          ? const Value.absent()
          : Value(speciesId),
      cultivarName: cultivarName == null && nullToAbsent
          ? const Value.absent()
          : Value(cultivarName),
      category: category == null && nullToAbsent
          ? const Value.absent()
          : Value(category),
      notes: notes == null && nullToAbsent
          ? const Value.absent()
          : Value(notes),
      isDraft: Value(isDraft),
      isOrganic: Value(isOrganic),
      needsReproduction: Value(needsReproduction),
      sowMonths: sowMonths == null && nullToAbsent
          ? const Value.absent()
          : Value(sowMonths),
      transplantMonths: transplantMonths == null && nullToAbsent
          ? const Value.absent()
          : Value(transplantMonths),
      floweringMonths: floweringMonths == null && nullToAbsent
          ? const Value.absent()
          : Value(floweringMonths),
      fruitingMonths: fruitingMonths == null && nullToAbsent
          ? const Value.absent()
          : Value(fruitingMonths),
      seedHarvestMonths: seedHarvestMonths == null && nullToAbsent
          ? const Value.absent()
          : Value(seedHarvestMonths),
    );
  }

  factory Variety.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Variety(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      label: serializer.fromJson<String>(json['label']),
      speciesId: serializer.fromJson<String?>(json['speciesId']),
      cultivarName: serializer.fromJson<String?>(json['cultivarName']),
      category: serializer.fromJson<String?>(json['category']),
      notes: serializer.fromJson<String?>(json['notes']),
      isDraft: serializer.fromJson<bool>(json['isDraft']),
      isOrganic: serializer.fromJson<bool>(json['isOrganic']),
      needsReproduction: serializer.fromJson<bool>(json['needsReproduction']),
      sowMonths: serializer.fromJson<int?>(json['sowMonths']),
      transplantMonths: serializer.fromJson<int?>(json['transplantMonths']),
      floweringMonths: serializer.fromJson<int?>(json['floweringMonths']),
      fruitingMonths: serializer.fromJson<int?>(json['fruitingMonths']),
      seedHarvestMonths: serializer.fromJson<int?>(json['seedHarvestMonths']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'label': serializer.toJson<String>(label),
      'speciesId': serializer.toJson<String?>(speciesId),
      'cultivarName': serializer.toJson<String?>(cultivarName),
      'category': serializer.toJson<String?>(category),
      'notes': serializer.toJson<String?>(notes),
      'isDraft': serializer.toJson<bool>(isDraft),
      'isOrganic': serializer.toJson<bool>(isOrganic),
      'needsReproduction': serializer.toJson<bool>(needsReproduction),
      'sowMonths': serializer.toJson<int?>(sowMonths),
      'transplantMonths': serializer.toJson<int?>(transplantMonths),
      'floweringMonths': serializer.toJson<int?>(floweringMonths),
      'fruitingMonths': serializer.toJson<int?>(fruitingMonths),
      'seedHarvestMonths': serializer.toJson<int?>(seedHarvestMonths),
    };
  }

  Variety copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? label,
    Value<String?> speciesId = const Value.absent(),
    Value<String?> cultivarName = const Value.absent(),
    Value<String?> category = const Value.absent(),
    Value<String?> notes = const Value.absent(),
    bool? isDraft,
    bool? isOrganic,
    bool? needsReproduction,
    Value<int?> sowMonths = const Value.absent(),
    Value<int?> transplantMonths = const Value.absent(),
    Value<int?> floweringMonths = const Value.absent(),
    Value<int?> fruitingMonths = const Value.absent(),
    Value<int?> seedHarvestMonths = const Value.absent(),
  }) => Variety(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    label: label ?? this.label,
    speciesId: speciesId.present ? speciesId.value : this.speciesId,
    cultivarName: cultivarName.present ? cultivarName.value : this.cultivarName,
    category: category.present ? category.value : this.category,
    notes: notes.present ? notes.value : this.notes,
    isDraft: isDraft ?? this.isDraft,
    isOrganic: isOrganic ?? this.isOrganic,
    needsReproduction: needsReproduction ?? this.needsReproduction,
    sowMonths: sowMonths.present ? sowMonths.value : this.sowMonths,
    transplantMonths: transplantMonths.present
        ? transplantMonths.value
        : this.transplantMonths,
    floweringMonths: floweringMonths.present
        ? floweringMonths.value
        : this.floweringMonths,
    fruitingMonths: fruitingMonths.present
        ? fruitingMonths.value
        : this.fruitingMonths,
    seedHarvestMonths: seedHarvestMonths.present
        ? seedHarvestMonths.value
        : this.seedHarvestMonths,
  );
  Variety copyWithCompanion(VarietiesCompanion data) {
    return Variety(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      label: data.label.present ? data.label.value : this.label,
      speciesId: data.speciesId.present ? data.speciesId.value : this.speciesId,
      cultivarName: data.cultivarName.present
          ? data.cultivarName.value
          : this.cultivarName,
      category: data.category.present ? data.category.value : this.category,
      notes: data.notes.present ? data.notes.value : this.notes,
      isDraft: data.isDraft.present ? data.isDraft.value : this.isDraft,
      isOrganic: data.isOrganic.present ? data.isOrganic.value : this.isOrganic,
      needsReproduction: data.needsReproduction.present
          ? data.needsReproduction.value
          : this.needsReproduction,
      sowMonths: data.sowMonths.present ? data.sowMonths.value : this.sowMonths,
      transplantMonths: data.transplantMonths.present
          ? data.transplantMonths.value
          : this.transplantMonths,
      floweringMonths: data.floweringMonths.present
          ? data.floweringMonths.value
          : this.floweringMonths,
      fruitingMonths: data.fruitingMonths.present
          ? data.fruitingMonths.value
          : this.fruitingMonths,
      seedHarvestMonths: data.seedHarvestMonths.present
          ? data.seedHarvestMonths.value
          : this.seedHarvestMonths,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Variety(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('label: $label, ')
          ..write('speciesId: $speciesId, ')
          ..write('cultivarName: $cultivarName, ')
          ..write('category: $category, ')
          ..write('notes: $notes, ')
          ..write('isDraft: $isDraft, ')
          ..write('isOrganic: $isOrganic, ')
          ..write('needsReproduction: $needsReproduction, ')
          ..write('sowMonths: $sowMonths, ')
          ..write('transplantMonths: $transplantMonths, ')
          ..write('floweringMonths: $floweringMonths, ')
          ..write('fruitingMonths: $fruitingMonths, ')
          ..write('seedHarvestMonths: $seedHarvestMonths')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    label,
    speciesId,
    cultivarName,
    category,
    notes,
    isDraft,
    isOrganic,
    needsReproduction,
    sowMonths,
    transplantMonths,
    floweringMonths,
    fruitingMonths,
    seedHarvestMonths,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Variety &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.label == this.label &&
          other.speciesId == this.speciesId &&
          other.cultivarName == this.cultivarName &&
          other.category == this.category &&
          other.notes == this.notes &&
          other.isDraft == this.isDraft &&
          other.isOrganic == this.isOrganic &&
          other.needsReproduction == this.needsReproduction &&
          other.sowMonths == this.sowMonths &&
          other.transplantMonths == this.transplantMonths &&
          other.floweringMonths == this.floweringMonths &&
          other.fruitingMonths == this.fruitingMonths &&
          other.seedHarvestMonths == this.seedHarvestMonths);
}

class VarietiesCompanion extends UpdateCompanion<Variety> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> label;
  final Value<String?> speciesId;
  final Value<String?> cultivarName;
  final Value<String?> category;
  final Value<String?> notes;
  final Value<bool> isDraft;
  final Value<bool> isOrganic;
  final Value<bool> needsReproduction;
  final Value<int?> sowMonths;
  final Value<int?> transplantMonths;
  final Value<int?> floweringMonths;
  final Value<int?> fruitingMonths;
  final Value<int?> seedHarvestMonths;
  final Value<int> rowid;
  const VarietiesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.label = const Value.absent(),
    this.speciesId = const Value.absent(),
    this.cultivarName = const Value.absent(),
    this.category = const Value.absent(),
    this.notes = const Value.absent(),
    this.isDraft = const Value.absent(),
    this.isOrganic = const Value.absent(),
    this.needsReproduction = const Value.absent(),
    this.sowMonths = const Value.absent(),
    this.transplantMonths = const Value.absent(),
    this.floweringMonths = const Value.absent(),
    this.fruitingMonths = const Value.absent(),
    this.seedHarvestMonths = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  VarietiesCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String label,
    this.speciesId = const Value.absent(),
    this.cultivarName = const Value.absent(),
    this.category = const Value.absent(),
    this.notes = const Value.absent(),
    this.isDraft = const Value.absent(),
    this.isOrganic = const Value.absent(),
    this.needsReproduction = const Value.absent(),
    this.sowMonths = const Value.absent(),
    this.transplantMonths = const Value.absent(),
    this.floweringMonths = const Value.absent(),
    this.fruitingMonths = const Value.absent(),
    this.seedHarvestMonths = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       label = Value(label);
  static Insertable<Variety> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? label,
    Expression<String>? speciesId,
    Expression<String>? cultivarName,
    Expression<String>? category,
    Expression<String>? notes,
    Expression<bool>? isDraft,
    Expression<bool>? isOrganic,
    Expression<bool>? needsReproduction,
    Expression<int>? sowMonths,
    Expression<int>? transplantMonths,
    Expression<int>? floweringMonths,
    Expression<int>? fruitingMonths,
    Expression<int>? seedHarvestMonths,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (label != null) 'label': label,
      if (speciesId != null) 'species_id': speciesId,
      if (cultivarName != null) 'cultivar_name': cultivarName,
      if (category != null) 'category': category,
      if (notes != null) 'notes': notes,
      if (isDraft != null) 'is_draft': isDraft,
      if (isOrganic != null) 'is_organic': isOrganic,
      if (needsReproduction != null) 'needs_reproduction': needsReproduction,
      if (sowMonths != null) 'sow_months': sowMonths,
      if (transplantMonths != null) 'transplant_months': transplantMonths,
      if (floweringMonths != null) 'flowering_months': floweringMonths,
      if (fruitingMonths != null) 'fruiting_months': fruitingMonths,
      if (seedHarvestMonths != null) 'seed_harvest_months': seedHarvestMonths,
      if (rowid != null) 'rowid': rowid,
    });
  }

  VarietiesCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? label,
    Value<String?>? speciesId,
    Value<String?>? cultivarName,
    Value<String?>? category,
    Value<String?>? notes,
    Value<bool>? isDraft,
    Value<bool>? isOrganic,
    Value<bool>? needsReproduction,
    Value<int?>? sowMonths,
    Value<int?>? transplantMonths,
    Value<int?>? floweringMonths,
    Value<int?>? fruitingMonths,
    Value<int?>? seedHarvestMonths,
    Value<int>? rowid,
  }) {
    return VarietiesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      label: label ?? this.label,
      speciesId: speciesId ?? this.speciesId,
      cultivarName: cultivarName ?? this.cultivarName,
      category: category ?? this.category,
      notes: notes ?? this.notes,
      isDraft: isDraft ?? this.isDraft,
      isOrganic: isOrganic ?? this.isOrganic,
      needsReproduction: needsReproduction ?? this.needsReproduction,
      sowMonths: sowMonths ?? this.sowMonths,
      transplantMonths: transplantMonths ?? this.transplantMonths,
      floweringMonths: floweringMonths ?? this.floweringMonths,
      fruitingMonths: fruitingMonths ?? this.fruitingMonths,
      seedHarvestMonths: seedHarvestMonths ?? this.seedHarvestMonths,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (label.present) {
      map['label'] = Variable<String>(label.value);
    }
    if (speciesId.present) {
      map['species_id'] = Variable<String>(speciesId.value);
    }
    if (cultivarName.present) {
      map['cultivar_name'] = Variable<String>(cultivarName.value);
    }
    if (category.present) {
      map['category'] = Variable<String>(category.value);
    }
    if (notes.present) {
      map['notes'] = Variable<String>(notes.value);
    }
    if (isDraft.present) {
      map['is_draft'] = Variable<bool>(isDraft.value);
    }
    if (isOrganic.present) {
      map['is_organic'] = Variable<bool>(isOrganic.value);
    }
    if (needsReproduction.present) {
      map['needs_reproduction'] = Variable<bool>(needsReproduction.value);
    }
    if (sowMonths.present) {
      map['sow_months'] = Variable<int>(sowMonths.value);
    }
    if (transplantMonths.present) {
      map['transplant_months'] = Variable<int>(transplantMonths.value);
    }
    if (floweringMonths.present) {
      map['flowering_months'] = Variable<int>(floweringMonths.value);
    }
    if (fruitingMonths.present) {
      map['fruiting_months'] = Variable<int>(fruitingMonths.value);
    }
    if (seedHarvestMonths.present) {
      map['seed_harvest_months'] = Variable<int>(seedHarvestMonths.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('VarietiesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('label: $label, ')
          ..write('speciesId: $speciesId, ')
          ..write('cultivarName: $cultivarName, ')
          ..write('category: $category, ')
          ..write('notes: $notes, ')
          ..write('isDraft: $isDraft, ')
          ..write('isOrganic: $isOrganic, ')
          ..write('needsReproduction: $needsReproduction, ')
          ..write('sowMonths: $sowMonths, ')
          ..write('transplantMonths: $transplantMonths, ')
          ..write('floweringMonths: $floweringMonths, ')
          ..write('fruitingMonths: $fruitingMonths, ')
          ..write('seedHarvestMonths: $seedHarvestMonths, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $VarietyVernacularNamesTable extends VarietyVernacularNames
    with TableInfo<$VarietyVernacularNamesTable, VarietyVernacularName> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $VarietyVernacularNamesTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _varietyIdMeta = const VerificationMeta(
    'varietyId',
  );
  @override
  late final GeneratedColumn<String> varietyId = GeneratedColumn<String>(
    'variety_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _languageMeta = const VerificationMeta(
    'language',
  );
  @override
  late final GeneratedColumn<String> language = GeneratedColumn<String>(
    'language',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _regionMeta = const VerificationMeta('region');
  @override
  late final GeneratedColumn<String> region = GeneratedColumn<String>(
    'region',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    varietyId,
    name,
    language,
    region,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'variety_vernacular_names';
  @override
  VerificationContext validateIntegrity(
    Insertable<VarietyVernacularName> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('variety_id')) {
      context.handle(
        _varietyIdMeta,
        varietyId.isAcceptableOrUnknown(data['variety_id']!, _varietyIdMeta),
      );
    } else if (isInserting) {
      context.missing(_varietyIdMeta);
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('language')) {
      context.handle(
        _languageMeta,
        language.isAcceptableOrUnknown(data['language']!, _languageMeta),
      );
    }
    if (data.containsKey('region')) {
      context.handle(
        _regionMeta,
        region.isAcceptableOrUnknown(data['region']!, _regionMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  VarietyVernacularName map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return VarietyVernacularName(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      varietyId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}variety_id'],
      )!,
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      language: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}language'],
      ),
      region: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}region'],
      ),
    );
  }

  @override
  $VarietyVernacularNamesTable createAlias(String alias) {
    return $VarietyVernacularNamesTable(attachedDatabase, alias);
  }
}

class VarietyVernacularName extends DataClass
    implements Insertable<VarietyVernacularName> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String varietyId;
  final String name;
  final String? language;
  final String? region;
  const VarietyVernacularName({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.varietyId,
    required this.name,
    this.language,
    this.region,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['variety_id'] = Variable<String>(varietyId);
    map['name'] = Variable<String>(name);
    if (!nullToAbsent || language != null) {
      map['language'] = Variable<String>(language);
    }
    if (!nullToAbsent || region != null) {
      map['region'] = Variable<String>(region);
    }
    return map;
  }

  VarietyVernacularNamesCompanion toCompanion(bool nullToAbsent) {
    return VarietyVernacularNamesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      varietyId: Value(varietyId),
      name: Value(name),
      language: language == null && nullToAbsent
          ? const Value.absent()
          : Value(language),
      region: region == null && nullToAbsent
          ? const Value.absent()
          : Value(region),
    );
  }

  factory VarietyVernacularName.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return VarietyVernacularName(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      varietyId: serializer.fromJson<String>(json['varietyId']),
      name: serializer.fromJson<String>(json['name']),
      language: serializer.fromJson<String?>(json['language']),
      region: serializer.fromJson<String?>(json['region']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'varietyId': serializer.toJson<String>(varietyId),
      'name': serializer.toJson<String>(name),
      'language': serializer.toJson<String?>(language),
      'region': serializer.toJson<String?>(region),
    };
  }

  VarietyVernacularName copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? varietyId,
    String? name,
    Value<String?> language = const Value.absent(),
    Value<String?> region = const Value.absent(),
  }) => VarietyVernacularName(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    varietyId: varietyId ?? this.varietyId,
    name: name ?? this.name,
    language: language.present ? language.value : this.language,
    region: region.present ? region.value : this.region,
  );
  VarietyVernacularName copyWithCompanion(
    VarietyVernacularNamesCompanion data,
  ) {
    return VarietyVernacularName(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      varietyId: data.varietyId.present ? data.varietyId.value : this.varietyId,
      name: data.name.present ? data.name.value : this.name,
      language: data.language.present ? data.language.value : this.language,
      region: data.region.present ? data.region.value : this.region,
    );
  }

  @override
  String toString() {
    return (StringBuffer('VarietyVernacularName(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('varietyId: $varietyId, ')
          ..write('name: $name, ')
          ..write('language: $language, ')
          ..write('region: $region')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    varietyId,
    name,
    language,
    region,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is VarietyVernacularName &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.varietyId == this.varietyId &&
          other.name == this.name &&
          other.language == this.language &&
          other.region == this.region);
}

class VarietyVernacularNamesCompanion
    extends UpdateCompanion<VarietyVernacularName> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> varietyId;
  final Value<String> name;
  final Value<String?> language;
  final Value<String?> region;
  final Value<int> rowid;
  const VarietyVernacularNamesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.varietyId = const Value.absent(),
    this.name = const Value.absent(),
    this.language = const Value.absent(),
    this.region = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  VarietyVernacularNamesCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String varietyId,
    required String name,
    this.language = const Value.absent(),
    this.region = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       varietyId = Value(varietyId),
       name = Value(name);
  static Insertable<VarietyVernacularName> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? varietyId,
    Expression<String>? name,
    Expression<String>? language,
    Expression<String>? region,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (varietyId != null) 'variety_id': varietyId,
      if (name != null) 'name': name,
      if (language != null) 'language': language,
      if (region != null) 'region': region,
      if (rowid != null) 'rowid': rowid,
    });
  }

  VarietyVernacularNamesCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? varietyId,
    Value<String>? name,
    Value<String?>? language,
    Value<String?>? region,
    Value<int>? rowid,
  }) {
    return VarietyVernacularNamesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      varietyId: varietyId ?? this.varietyId,
      name: name ?? this.name,
      language: language ?? this.language,
      region: region ?? this.region,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (varietyId.present) {
      map['variety_id'] = Variable<String>(varietyId.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (language.present) {
      map['language'] = Variable<String>(language.value);
    }
    if (region.present) {
      map['region'] = Variable<String>(region.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('VarietyVernacularNamesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('varietyId: $varietyId, ')
          ..write('name: $name, ')
          ..write('language: $language, ')
          ..write('region: $region, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $SpeciesTable extends Species with TableInfo<$SpeciesTable, Specy> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $SpeciesTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _scientificNameMeta = const VerificationMeta(
    'scientificName',
  );
  @override
  late final GeneratedColumn<String> scientificName = GeneratedColumn<String>(
    'scientific_name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _wikidataQidMeta = const VerificationMeta(
    'wikidataQid',
  );
  @override
  late final GeneratedColumn<String> wikidataQid = GeneratedColumn<String>(
    'wikidata_qid',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _gbifKeyMeta = const VerificationMeta(
    'gbifKey',
  );
  @override
  late final GeneratedColumn<int> gbifKey = GeneratedColumn<int>(
    'gbif_key',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _familyMeta = const VerificationMeta('family');
  @override
  late final GeneratedColumn<String> family = GeneratedColumn<String>(
    'family',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _isBundledMeta = const VerificationMeta(
    'isBundled',
  );
  @override
  late final GeneratedColumn<bool> isBundled = GeneratedColumn<bool>(
    'is_bundled',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_bundled" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _viabilityYearsMeta = const VerificationMeta(
    'viabilityYears',
  );
  @override
  late final GeneratedColumn<int> viabilityYears = GeneratedColumn<int>(
    'viability_years',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    scientificName,
    wikidataQid,
    gbifKey,
    family,
    isBundled,
    viabilityYears,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'species';
  @override
  VerificationContext validateIntegrity(
    Insertable<Specy> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('scientific_name')) {
      context.handle(
        _scientificNameMeta,
        scientificName.isAcceptableOrUnknown(
          data['scientific_name']!,
          _scientificNameMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_scientificNameMeta);
    }
    if (data.containsKey('wikidata_qid')) {
      context.handle(
        _wikidataQidMeta,
        wikidataQid.isAcceptableOrUnknown(
          data['wikidata_qid']!,
          _wikidataQidMeta,
        ),
      );
    }
    if (data.containsKey('gbif_key')) {
      context.handle(
        _gbifKeyMeta,
        gbifKey.isAcceptableOrUnknown(data['gbif_key']!, _gbifKeyMeta),
      );
    }
    if (data.containsKey('family')) {
      context.handle(
        _familyMeta,
        family.isAcceptableOrUnknown(data['family']!, _familyMeta),
      );
    }
    if (data.containsKey('is_bundled')) {
      context.handle(
        _isBundledMeta,
        isBundled.isAcceptableOrUnknown(data['is_bundled']!, _isBundledMeta),
      );
    }
    if (data.containsKey('viability_years')) {
      context.handle(
        _viabilityYearsMeta,
        viabilityYears.isAcceptableOrUnknown(
          data['viability_years']!,
          _viabilityYearsMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Specy map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Specy(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      scientificName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}scientific_name'],
      )!,
      wikidataQid: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}wikidata_qid'],
      ),
      gbifKey: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}gbif_key'],
      ),
      family: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}family'],
      ),
      isBundled: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_bundled'],
      )!,
      viabilityYears: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}viability_years'],
      ),
    );
  }

  @override
  $SpeciesTable createAlias(String alias) {
    return $SpeciesTable(attachedDatabase, alias);
  }
}

class Specy extends DataClass implements Insertable<Specy> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String scientificName;
  final String? wikidataQid;
  final int? gbifKey;
  final String? family;
  final bool isBundled;

  /// Typical seed longevity in years under normal home storage — public-domain
  /// reference data bundled with the catalog (agricultural-extension viability
  /// tables). Drives the "expiring / past viability" warning on aging lots by
  /// comparing against a lot's [Lots.harvestYear]. Nullable: unknown for
  /// species without a bundled figure.
  final int? viabilityYears;
  const Specy({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.scientificName,
    this.wikidataQid,
    this.gbifKey,
    this.family,
    required this.isBundled,
    this.viabilityYears,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['scientific_name'] = Variable<String>(scientificName);
    if (!nullToAbsent || wikidataQid != null) {
      map['wikidata_qid'] = Variable<String>(wikidataQid);
    }
    if (!nullToAbsent || gbifKey != null) {
      map['gbif_key'] = Variable<int>(gbifKey);
    }
    if (!nullToAbsent || family != null) {
      map['family'] = Variable<String>(family);
    }
    map['is_bundled'] = Variable<bool>(isBundled);
    if (!nullToAbsent || viabilityYears != null) {
      map['viability_years'] = Variable<int>(viabilityYears);
    }
    return map;
  }

  SpeciesCompanion toCompanion(bool nullToAbsent) {
    return SpeciesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      scientificName: Value(scientificName),
      wikidataQid: wikidataQid == null && nullToAbsent
          ? const Value.absent()
          : Value(wikidataQid),
      gbifKey: gbifKey == null && nullToAbsent
          ? const Value.absent()
          : Value(gbifKey),
      family: family == null && nullToAbsent
          ? const Value.absent()
          : Value(family),
      isBundled: Value(isBundled),
      viabilityYears: viabilityYears == null && nullToAbsent
          ? const Value.absent()
          : Value(viabilityYears),
    );
  }

  factory Specy.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Specy(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      scientificName: serializer.fromJson<String>(json['scientificName']),
      wikidataQid: serializer.fromJson<String?>(json['wikidataQid']),
      gbifKey: serializer.fromJson<int?>(json['gbifKey']),
      family: serializer.fromJson<String?>(json['family']),
      isBundled: serializer.fromJson<bool>(json['isBundled']),
      viabilityYears: serializer.fromJson<int?>(json['viabilityYears']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'scientificName': serializer.toJson<String>(scientificName),
      'wikidataQid': serializer.toJson<String?>(wikidataQid),
      'gbifKey': serializer.toJson<int?>(gbifKey),
      'family': serializer.toJson<String?>(family),
      'isBundled': serializer.toJson<bool>(isBundled),
      'viabilityYears': serializer.toJson<int?>(viabilityYears),
    };
  }

  Specy copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? scientificName,
    Value<String?> wikidataQid = const Value.absent(),
    Value<int?> gbifKey = const Value.absent(),
    Value<String?> family = const Value.absent(),
    bool? isBundled,
    Value<int?> viabilityYears = const Value.absent(),
  }) => Specy(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    scientificName: scientificName ?? this.scientificName,
    wikidataQid: wikidataQid.present ? wikidataQid.value : this.wikidataQid,
    gbifKey: gbifKey.present ? gbifKey.value : this.gbifKey,
    family: family.present ? family.value : this.family,
    isBundled: isBundled ?? this.isBundled,
    viabilityYears: viabilityYears.present
        ? viabilityYears.value
        : this.viabilityYears,
  );
  Specy copyWithCompanion(SpeciesCompanion data) {
    return Specy(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      scientificName: data.scientificName.present
          ? data.scientificName.value
          : this.scientificName,
      wikidataQid: data.wikidataQid.present
          ? data.wikidataQid.value
          : this.wikidataQid,
      gbifKey: data.gbifKey.present ? data.gbifKey.value : this.gbifKey,
      family: data.family.present ? data.family.value : this.family,
      isBundled: data.isBundled.present ? data.isBundled.value : this.isBundled,
      viabilityYears: data.viabilityYears.present
          ? data.viabilityYears.value
          : this.viabilityYears,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Specy(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('scientificName: $scientificName, ')
          ..write('wikidataQid: $wikidataQid, ')
          ..write('gbifKey: $gbifKey, ')
          ..write('family: $family, ')
          ..write('isBundled: $isBundled, ')
          ..write('viabilityYears: $viabilityYears')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    scientificName,
    wikidataQid,
    gbifKey,
    family,
    isBundled,
    viabilityYears,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Specy &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.scientificName == this.scientificName &&
          other.wikidataQid == this.wikidataQid &&
          other.gbifKey == this.gbifKey &&
          other.family == this.family &&
          other.isBundled == this.isBundled &&
          other.viabilityYears == this.viabilityYears);
}

class SpeciesCompanion extends UpdateCompanion<Specy> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> scientificName;
  final Value<String?> wikidataQid;
  final Value<int?> gbifKey;
  final Value<String?> family;
  final Value<bool> isBundled;
  final Value<int?> viabilityYears;
  final Value<int> rowid;
  const SpeciesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.scientificName = const Value.absent(),
    this.wikidataQid = const Value.absent(),
    this.gbifKey = const Value.absent(),
    this.family = const Value.absent(),
    this.isBundled = const Value.absent(),
    this.viabilityYears = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  SpeciesCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String scientificName,
    this.wikidataQid = const Value.absent(),
    this.gbifKey = const Value.absent(),
    this.family = const Value.absent(),
    this.isBundled = const Value.absent(),
    this.viabilityYears = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       scientificName = Value(scientificName);
  static Insertable<Specy> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? scientificName,
    Expression<String>? wikidataQid,
    Expression<int>? gbifKey,
    Expression<String>? family,
    Expression<bool>? isBundled,
    Expression<int>? viabilityYears,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (scientificName != null) 'scientific_name': scientificName,
      if (wikidataQid != null) 'wikidata_qid': wikidataQid,
      if (gbifKey != null) 'gbif_key': gbifKey,
      if (family != null) 'family': family,
      if (isBundled != null) 'is_bundled': isBundled,
      if (viabilityYears != null) 'viability_years': viabilityYears,
      if (rowid != null) 'rowid': rowid,
    });
  }

  SpeciesCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? scientificName,
    Value<String?>? wikidataQid,
    Value<int?>? gbifKey,
    Value<String?>? family,
    Value<bool>? isBundled,
    Value<int?>? viabilityYears,
    Value<int>? rowid,
  }) {
    return SpeciesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      scientificName: scientificName ?? this.scientificName,
      wikidataQid: wikidataQid ?? this.wikidataQid,
      gbifKey: gbifKey ?? this.gbifKey,
      family: family ?? this.family,
      isBundled: isBundled ?? this.isBundled,
      viabilityYears: viabilityYears ?? this.viabilityYears,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (scientificName.present) {
      map['scientific_name'] = Variable<String>(scientificName.value);
    }
    if (wikidataQid.present) {
      map['wikidata_qid'] = Variable<String>(wikidataQid.value);
    }
    if (gbifKey.present) {
      map['gbif_key'] = Variable<int>(gbifKey.value);
    }
    if (family.present) {
      map['family'] = Variable<String>(family.value);
    }
    if (isBundled.present) {
      map['is_bundled'] = Variable<bool>(isBundled.value);
    }
    if (viabilityYears.present) {
      map['viability_years'] = Variable<int>(viabilityYears.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('SpeciesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('scientificName: $scientificName, ')
          ..write('wikidataQid: $wikidataQid, ')
          ..write('gbifKey: $gbifKey, ')
          ..write('family: $family, ')
          ..write('isBundled: $isBundled, ')
          ..write('viabilityYears: $viabilityYears, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $SpeciesCommonNamesTable extends SpeciesCommonNames
    with TableInfo<$SpeciesCommonNamesTable, SpeciesCommonName> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $SpeciesCommonNamesTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _speciesIdMeta = const VerificationMeta(
    'speciesId',
  );
  @override
  late final GeneratedColumn<String> speciesId = GeneratedColumn<String>(
    'species_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _languageMeta = const VerificationMeta(
    'language',
  );
  @override
  late final GeneratedColumn<String> language = GeneratedColumn<String>(
    'language',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    speciesId,
    name,
    language,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'species_common_names';
  @override
  VerificationContext validateIntegrity(
    Insertable<SpeciesCommonName> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('species_id')) {
      context.handle(
        _speciesIdMeta,
        speciesId.isAcceptableOrUnknown(data['species_id']!, _speciesIdMeta),
      );
    } else if (isInserting) {
      context.missing(_speciesIdMeta);
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('language')) {
      context.handle(
        _languageMeta,
        language.isAcceptableOrUnknown(data['language']!, _languageMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  SpeciesCommonName map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return SpeciesCommonName(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      speciesId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}species_id'],
      )!,
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      language: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}language'],
      ),
    );
  }

  @override
  $SpeciesCommonNamesTable createAlias(String alias) {
    return $SpeciesCommonNamesTable(attachedDatabase, alias);
  }
}

class SpeciesCommonName extends DataClass
    implements Insertable<SpeciesCommonName> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String speciesId;
  final String name;
  final String? language;
  const SpeciesCommonName({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.speciesId,
    required this.name,
    this.language,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['species_id'] = Variable<String>(speciesId);
    map['name'] = Variable<String>(name);
    if (!nullToAbsent || language != null) {
      map['language'] = Variable<String>(language);
    }
    return map;
  }

  SpeciesCommonNamesCompanion toCompanion(bool nullToAbsent) {
    return SpeciesCommonNamesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      speciesId: Value(speciesId),
      name: Value(name),
      language: language == null && nullToAbsent
          ? const Value.absent()
          : Value(language),
    );
  }

  factory SpeciesCommonName.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return SpeciesCommonName(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      speciesId: serializer.fromJson<String>(json['speciesId']),
      name: serializer.fromJson<String>(json['name']),
      language: serializer.fromJson<String?>(json['language']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'speciesId': serializer.toJson<String>(speciesId),
      'name': serializer.toJson<String>(name),
      'language': serializer.toJson<String?>(language),
    };
  }

  SpeciesCommonName copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? speciesId,
    String? name,
    Value<String?> language = const Value.absent(),
  }) => SpeciesCommonName(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    speciesId: speciesId ?? this.speciesId,
    name: name ?? this.name,
    language: language.present ? language.value : this.language,
  );
  SpeciesCommonName copyWithCompanion(SpeciesCommonNamesCompanion data) {
    return SpeciesCommonName(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      speciesId: data.speciesId.present ? data.speciesId.value : this.speciesId,
      name: data.name.present ? data.name.value : this.name,
      language: data.language.present ? data.language.value : this.language,
    );
  }

  @override
  String toString() {
    return (StringBuffer('SpeciesCommonName(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('speciesId: $speciesId, ')
          ..write('name: $name, ')
          ..write('language: $language')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    speciesId,
    name,
    language,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is SpeciesCommonName &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.speciesId == this.speciesId &&
          other.name == this.name &&
          other.language == this.language);
}

class SpeciesCommonNamesCompanion extends UpdateCompanion<SpeciesCommonName> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> speciesId;
  final Value<String> name;
  final Value<String?> language;
  final Value<int> rowid;
  const SpeciesCommonNamesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.speciesId = const Value.absent(),
    this.name = const Value.absent(),
    this.language = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  SpeciesCommonNamesCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String speciesId,
    required String name,
    this.language = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       speciesId = Value(speciesId),
       name = Value(name);
  static Insertable<SpeciesCommonName> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? speciesId,
    Expression<String>? name,
    Expression<String>? language,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (speciesId != null) 'species_id': speciesId,
      if (name != null) 'name': name,
      if (language != null) 'language': language,
      if (rowid != null) 'rowid': rowid,
    });
  }

  SpeciesCommonNamesCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? speciesId,
    Value<String>? name,
    Value<String?>? language,
    Value<int>? rowid,
  }) {
    return SpeciesCommonNamesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      speciesId: speciesId ?? this.speciesId,
      name: name ?? this.name,
      language: language ?? this.language,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (speciesId.present) {
      map['species_id'] = Variable<String>(speciesId.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (language.present) {
      map['language'] = Variable<String>(language.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('SpeciesCommonNamesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('speciesId: $speciesId, ')
          ..write('name: $name, ')
          ..write('language: $language, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $LotsTable extends Lots with TableInfo<$LotsTable, Lot> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $LotsTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _varietyIdMeta = const VerificationMeta(
    'varietyId',
  );
  @override
  late final GeneratedColumn<String> varietyId = GeneratedColumn<String>(
    'variety_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  @override
  late final GeneratedColumnWithTypeConverter<LotType, String> type =
      GeneratedColumn<String>(
        'type',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('seed'),
      ).withConverter<LotType>($LotsTable.$convertertype);
  static const VerificationMeta _harvestYearMeta = const VerificationMeta(
    'harvestYear',
  );
  @override
  late final GeneratedColumn<int> harvestYear = GeneratedColumn<int>(
    'harvest_year',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _harvestMonthMeta = const VerificationMeta(
    'harvestMonth',
  );
  @override
  late final GeneratedColumn<int> harvestMonth = GeneratedColumn<int>(
    'harvest_month',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityKindMeta = const VerificationMeta(
    'quantityKind',
  );
  @override
  late final GeneratedColumn<String> quantityKind = GeneratedColumn<String>(
    'quantity_kind',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityPreciseMeta = const VerificationMeta(
    'quantityPrecise',
  );
  @override
  late final GeneratedColumn<double> quantityPrecise = GeneratedColumn<double>(
    'quantity_precise',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityLabelMeta = const VerificationMeta(
    'quantityLabel',
  );
  @override
  late final GeneratedColumn<String> quantityLabel = GeneratedColumn<String>(
    'quantity_label',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  late final GeneratedColumnWithTypeConverter<Presentation?, String>
  presentation = GeneratedColumn<String>(
    'presentation',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  ).withConverter<Presentation?>($LotsTable.$converterpresentationn);
  static const VerificationMeta _storageLocationMeta = const VerificationMeta(
    'storageLocation',
  );
  @override
  late final GeneratedColumn<String> storageLocation = GeneratedColumn<String>(
    'storage_location',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  late final GeneratedColumnWithTypeConverter<OfferStatus, String> offerStatus =
      GeneratedColumn<String>(
        'offer_status',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('private'),
      ).withConverter<OfferStatus>($LotsTable.$converterofferStatus);
  static const VerificationMeta _seedbankIdMeta = const VerificationMeta(
    'seedbankId',
  );
  @override
  late final GeneratedColumn<String> seedbankId = GeneratedColumn<String>(
    'seedbank_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _originNameMeta = const VerificationMeta(
    'originName',
  );
  @override
  late final GeneratedColumn<String> originName = GeneratedColumn<String>(
    'origin_name',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _originPlaceMeta = const VerificationMeta(
    'originPlace',
  );
  @override
  late final GeneratedColumn<String> originPlace = GeneratedColumn<String>(
    'origin_place',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  late final GeneratedColumnWithTypeConverter<Abundance?, String> abundance =
      GeneratedColumn<String>(
        'abundance',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      ).withConverter<Abundance?>($LotsTable.$converterabundancen);
  @override
  late final GeneratedColumnWithTypeConverter<PreservationFormat?, String>
  preservationFormat =
      GeneratedColumn<String>(
        'preservation_format',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      ).withConverter<PreservationFormat?>(
        $LotsTable.$converterpreservationFormatn,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    varietyId,
    type,
    harvestYear,
    harvestMonth,
    quantityKind,
    quantityPrecise,
    quantityLabel,
    presentation,
    storageLocation,
    offerStatus,
    seedbankId,
    originName,
    originPlace,
    abundance,
    preservationFormat,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'lots';
  @override
  VerificationContext validateIntegrity(
    Insertable<Lot> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('variety_id')) {
      context.handle(
        _varietyIdMeta,
        varietyId.isAcceptableOrUnknown(data['variety_id']!, _varietyIdMeta),
      );
    } else if (isInserting) {
      context.missing(_varietyIdMeta);
    }
    if (data.containsKey('harvest_year')) {
      context.handle(
        _harvestYearMeta,
        harvestYear.isAcceptableOrUnknown(
          data['harvest_year']!,
          _harvestYearMeta,
        ),
      );
    }
    if (data.containsKey('harvest_month')) {
      context.handle(
        _harvestMonthMeta,
        harvestMonth.isAcceptableOrUnknown(
          data['harvest_month']!,
          _harvestMonthMeta,
        ),
      );
    }
    if (data.containsKey('quantity_kind')) {
      context.handle(
        _quantityKindMeta,
        quantityKind.isAcceptableOrUnknown(
          data['quantity_kind']!,
          _quantityKindMeta,
        ),
      );
    }
    if (data.containsKey('quantity_precise')) {
      context.handle(
        _quantityPreciseMeta,
        quantityPrecise.isAcceptableOrUnknown(
          data['quantity_precise']!,
          _quantityPreciseMeta,
        ),
      );
    }
    if (data.containsKey('quantity_label')) {
      context.handle(
        _quantityLabelMeta,
        quantityLabel.isAcceptableOrUnknown(
          data['quantity_label']!,
          _quantityLabelMeta,
        ),
      );
    }
    if (data.containsKey('storage_location')) {
      context.handle(
        _storageLocationMeta,
        storageLocation.isAcceptableOrUnknown(
          data['storage_location']!,
          _storageLocationMeta,
        ),
      );
    }
    if (data.containsKey('seedbank_id')) {
      context.handle(
        _seedbankIdMeta,
        seedbankId.isAcceptableOrUnknown(data['seedbank_id']!, _seedbankIdMeta),
      );
    }
    if (data.containsKey('origin_name')) {
      context.handle(
        _originNameMeta,
        originName.isAcceptableOrUnknown(data['origin_name']!, _originNameMeta),
      );
    }
    if (data.containsKey('origin_place')) {
      context.handle(
        _originPlaceMeta,
        originPlace.isAcceptableOrUnknown(
          data['origin_place']!,
          _originPlaceMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Lot map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Lot(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      varietyId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}variety_id'],
      )!,
      type: $LotsTable.$convertertype.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}type'],
        )!,
      ),
      harvestYear: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}harvest_year'],
      ),
      harvestMonth: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}harvest_month'],
      ),
      quantityKind: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}quantity_kind'],
      ),
      quantityPrecise: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}quantity_precise'],
      ),
      quantityLabel: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}quantity_label'],
      ),
      presentation: $LotsTable.$converterpresentationn.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}presentation'],
        ),
      ),
      storageLocation: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}storage_location'],
      ),
      offerStatus: $LotsTable.$converterofferStatus.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}offer_status'],
        )!,
      ),
      seedbankId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}seedbank_id'],
      ),
      originName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_name'],
      ),
      originPlace: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_place'],
      ),
      abundance: $LotsTable.$converterabundancen.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}abundance'],
        ),
      ),
      preservationFormat: $LotsTable.$converterpreservationFormatn.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}preservation_format'],
        ),
      ),
    );
  }

  @override
  $LotsTable createAlias(String alias) {
    return $LotsTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<LotType, String, String> $convertertype =
      const EnumNameConverter<LotType>(LotType.values);
  static JsonTypeConverter2<Presentation, String, String>
  $converterpresentation = const EnumNameConverter<Presentation>(
    Presentation.values,
  );
  static JsonTypeConverter2<Presentation?, String?, String?>
  $converterpresentationn = JsonTypeConverter2.asNullable(
    $converterpresentation,
  );
  static JsonTypeConverter2<OfferStatus, String, String> $converterofferStatus =
      const EnumNameConverter<OfferStatus>(OfferStatus.values);
  static JsonTypeConverter2<Abundance, String, String> $converterabundance =
      const EnumNameConverter<Abundance>(Abundance.values);
  static JsonTypeConverter2<Abundance?, String?, String?> $converterabundancen =
      JsonTypeConverter2.asNullable($converterabundance);
  static JsonTypeConverter2<PreservationFormat, String, String>
  $converterpreservationFormat = const EnumNameConverter<PreservationFormat>(
    PreservationFormat.values,
  );
  static JsonTypeConverter2<PreservationFormat?, String?, String?>
  $converterpreservationFormatn = JsonTypeConverter2.asNullable(
    $converterpreservationFormat,
  );
}

class Lot extends DataClass implements Insertable<Lot> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String varietyId;
  final LotType type;
  final int? harvestYear;
  final int? harvestMonth;
  final String? quantityKind;
  final double? quantityPrecise;
  final String? quantityLabel;
  final Presentation? presentation;
  final String? storageLocation;
  final OfferStatus offerStatus;
  final String? seedbankId;

  /// Provenance of this batch, kept as lightweight free text so it needs no
  /// Party/Movement to record (the rigorous exchange path stays via Movements).
  /// [originName] = who grew or gave the seeds; [originPlace] = where they come
  /// from (with region/province). Both optional LWW scalars.
  final String? originName;
  final String? originPlace;

  /// Optional coarse "how much I have" for this lot — see [Abundance]. An
  /// offline alternative to the precise Quantity columns; either, both, or
  /// neither may be set.
  final Abundance? abundance;

  /// How the (seed) lot is physically conserved — see [PreservationFormat].
  /// Distinct from [storageLocation]. Optional.
  final PreservationFormat? preservationFormat;
  const Lot({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.varietyId,
    required this.type,
    this.harvestYear,
    this.harvestMonth,
    this.quantityKind,
    this.quantityPrecise,
    this.quantityLabel,
    this.presentation,
    this.storageLocation,
    required this.offerStatus,
    this.seedbankId,
    this.originName,
    this.originPlace,
    this.abundance,
    this.preservationFormat,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['variety_id'] = Variable<String>(varietyId);
    {
      map['type'] = Variable<String>($LotsTable.$convertertype.toSql(type));
    }
    if (!nullToAbsent || harvestYear != null) {
      map['harvest_year'] = Variable<int>(harvestYear);
    }
    if (!nullToAbsent || harvestMonth != null) {
      map['harvest_month'] = Variable<int>(harvestMonth);
    }
    if (!nullToAbsent || quantityKind != null) {
      map['quantity_kind'] = Variable<String>(quantityKind);
    }
    if (!nullToAbsent || quantityPrecise != null) {
      map['quantity_precise'] = Variable<double>(quantityPrecise);
    }
    if (!nullToAbsent || quantityLabel != null) {
      map['quantity_label'] = Variable<String>(quantityLabel);
    }
    if (!nullToAbsent || presentation != null) {
      map['presentation'] = Variable<String>(
        $LotsTable.$converterpresentationn.toSql(presentation),
      );
    }
    if (!nullToAbsent || storageLocation != null) {
      map['storage_location'] = Variable<String>(storageLocation);
    }
    {
      map['offer_status'] = Variable<String>(
        $LotsTable.$converterofferStatus.toSql(offerStatus),
      );
    }
    if (!nullToAbsent || seedbankId != null) {
      map['seedbank_id'] = Variable<String>(seedbankId);
    }
    if (!nullToAbsent || originName != null) {
      map['origin_name'] = Variable<String>(originName);
    }
    if (!nullToAbsent || originPlace != null) {
      map['origin_place'] = Variable<String>(originPlace);
    }
    if (!nullToAbsent || abundance != null) {
      map['abundance'] = Variable<String>(
        $LotsTable.$converterabundancen.toSql(abundance),
      );
    }
    if (!nullToAbsent || preservationFormat != null) {
      map['preservation_format'] = Variable<String>(
        $LotsTable.$converterpreservationFormatn.toSql(preservationFormat),
      );
    }
    return map;
  }

  LotsCompanion toCompanion(bool nullToAbsent) {
    return LotsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      varietyId: Value(varietyId),
      type: Value(type),
      harvestYear: harvestYear == null && nullToAbsent
          ? const Value.absent()
          : Value(harvestYear),
      harvestMonth: harvestMonth == null && nullToAbsent
          ? const Value.absent()
          : Value(harvestMonth),
      quantityKind: quantityKind == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityKind),
      quantityPrecise: quantityPrecise == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityPrecise),
      quantityLabel: quantityLabel == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityLabel),
      presentation: presentation == null && nullToAbsent
          ? const Value.absent()
          : Value(presentation),
      storageLocation: storageLocation == null && nullToAbsent
          ? const Value.absent()
          : Value(storageLocation),
      offerStatus: Value(offerStatus),
      seedbankId: seedbankId == null && nullToAbsent
          ? const Value.absent()
          : Value(seedbankId),
      originName: originName == null && nullToAbsent
          ? const Value.absent()
          : Value(originName),
      originPlace: originPlace == null && nullToAbsent
          ? const Value.absent()
          : Value(originPlace),
      abundance: abundance == null && nullToAbsent
          ? const Value.absent()
          : Value(abundance),
      preservationFormat: preservationFormat == null && nullToAbsent
          ? const Value.absent()
          : Value(preservationFormat),
    );
  }

  factory Lot.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Lot(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      varietyId: serializer.fromJson<String>(json['varietyId']),
      type: $LotsTable.$convertertype.fromJson(
        serializer.fromJson<String>(json['type']),
      ),
      harvestYear: serializer.fromJson<int?>(json['harvestYear']),
      harvestMonth: serializer.fromJson<int?>(json['harvestMonth']),
      quantityKind: serializer.fromJson<String?>(json['quantityKind']),
      quantityPrecise: serializer.fromJson<double?>(json['quantityPrecise']),
      quantityLabel: serializer.fromJson<String?>(json['quantityLabel']),
      presentation: $LotsTable.$converterpresentationn.fromJson(
        serializer.fromJson<String?>(json['presentation']),
      ),
      storageLocation: serializer.fromJson<String?>(json['storageLocation']),
      offerStatus: $LotsTable.$converterofferStatus.fromJson(
        serializer.fromJson<String>(json['offerStatus']),
      ),
      seedbankId: serializer.fromJson<String?>(json['seedbankId']),
      originName: serializer.fromJson<String?>(json['originName']),
      originPlace: serializer.fromJson<String?>(json['originPlace']),
      abundance: $LotsTable.$converterabundancen.fromJson(
        serializer.fromJson<String?>(json['abundance']),
      ),
      preservationFormat: $LotsTable.$converterpreservationFormatn.fromJson(
        serializer.fromJson<String?>(json['preservationFormat']),
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'varietyId': serializer.toJson<String>(varietyId),
      'type': serializer.toJson<String>($LotsTable.$convertertype.toJson(type)),
      'harvestYear': serializer.toJson<int?>(harvestYear),
      'harvestMonth': serializer.toJson<int?>(harvestMonth),
      'quantityKind': serializer.toJson<String?>(quantityKind),
      'quantityPrecise': serializer.toJson<double?>(quantityPrecise),
      'quantityLabel': serializer.toJson<String?>(quantityLabel),
      'presentation': serializer.toJson<String?>(
        $LotsTable.$converterpresentationn.toJson(presentation),
      ),
      'storageLocation': serializer.toJson<String?>(storageLocation),
      'offerStatus': serializer.toJson<String>(
        $LotsTable.$converterofferStatus.toJson(offerStatus),
      ),
      'seedbankId': serializer.toJson<String?>(seedbankId),
      'originName': serializer.toJson<String?>(originName),
      'originPlace': serializer.toJson<String?>(originPlace),
      'abundance': serializer.toJson<String?>(
        $LotsTable.$converterabundancen.toJson(abundance),
      ),
      'preservationFormat': serializer.toJson<String?>(
        $LotsTable.$converterpreservationFormatn.toJson(preservationFormat),
      ),
    };
  }

  Lot copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? varietyId,
    LotType? type,
    Value<int?> harvestYear = const Value.absent(),
    Value<int?> harvestMonth = const Value.absent(),
    Value<String?> quantityKind = const Value.absent(),
    Value<double?> quantityPrecise = const Value.absent(),
    Value<String?> quantityLabel = const Value.absent(),
    Value<Presentation?> presentation = const Value.absent(),
    Value<String?> storageLocation = const Value.absent(),
    OfferStatus? offerStatus,
    Value<String?> seedbankId = const Value.absent(),
    Value<String?> originName = const Value.absent(),
    Value<String?> originPlace = const Value.absent(),
    Value<Abundance?> abundance = const Value.absent(),
    Value<PreservationFormat?> preservationFormat = const Value.absent(),
  }) => Lot(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    varietyId: varietyId ?? this.varietyId,
    type: type ?? this.type,
    harvestYear: harvestYear.present ? harvestYear.value : this.harvestYear,
    harvestMonth: harvestMonth.present ? harvestMonth.value : this.harvestMonth,
    quantityKind: quantityKind.present ? quantityKind.value : this.quantityKind,
    quantityPrecise: quantityPrecise.present
        ? quantityPrecise.value
        : this.quantityPrecise,
    quantityLabel: quantityLabel.present
        ? quantityLabel.value
        : this.quantityLabel,
    presentation: presentation.present ? presentation.value : this.presentation,
    storageLocation: storageLocation.present
        ? storageLocation.value
        : this.storageLocation,
    offerStatus: offerStatus ?? this.offerStatus,
    seedbankId: seedbankId.present ? seedbankId.value : this.seedbankId,
    originName: originName.present ? originName.value : this.originName,
    originPlace: originPlace.present ? originPlace.value : this.originPlace,
    abundance: abundance.present ? abundance.value : this.abundance,
    preservationFormat: preservationFormat.present
        ? preservationFormat.value
        : this.preservationFormat,
  );
  Lot copyWithCompanion(LotsCompanion data) {
    return Lot(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      varietyId: data.varietyId.present ? data.varietyId.value : this.varietyId,
      type: data.type.present ? data.type.value : this.type,
      harvestYear: data.harvestYear.present
          ? data.harvestYear.value
          : this.harvestYear,
      harvestMonth: data.harvestMonth.present
          ? data.harvestMonth.value
          : this.harvestMonth,
      quantityKind: data.quantityKind.present
          ? data.quantityKind.value
          : this.quantityKind,
      quantityPrecise: data.quantityPrecise.present
          ? data.quantityPrecise.value
          : this.quantityPrecise,
      quantityLabel: data.quantityLabel.present
          ? data.quantityLabel.value
          : this.quantityLabel,
      presentation: data.presentation.present
          ? data.presentation.value
          : this.presentation,
      storageLocation: data.storageLocation.present
          ? data.storageLocation.value
          : this.storageLocation,
      offerStatus: data.offerStatus.present
          ? data.offerStatus.value
          : this.offerStatus,
      seedbankId: data.seedbankId.present
          ? data.seedbankId.value
          : this.seedbankId,
      originName: data.originName.present
          ? data.originName.value
          : this.originName,
      originPlace: data.originPlace.present
          ? data.originPlace.value
          : this.originPlace,
      abundance: data.abundance.present ? data.abundance.value : this.abundance,
      preservationFormat: data.preservationFormat.present
          ? data.preservationFormat.value
          : this.preservationFormat,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Lot(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('varietyId: $varietyId, ')
          ..write('type: $type, ')
          ..write('harvestYear: $harvestYear, ')
          ..write('harvestMonth: $harvestMonth, ')
          ..write('quantityKind: $quantityKind, ')
          ..write('quantityPrecise: $quantityPrecise, ')
          ..write('quantityLabel: $quantityLabel, ')
          ..write('presentation: $presentation, ')
          ..write('storageLocation: $storageLocation, ')
          ..write('offerStatus: $offerStatus, ')
          ..write('seedbankId: $seedbankId, ')
          ..write('originName: $originName, ')
          ..write('originPlace: $originPlace, ')
          ..write('abundance: $abundance, ')
          ..write('preservationFormat: $preservationFormat')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    varietyId,
    type,
    harvestYear,
    harvestMonth,
    quantityKind,
    quantityPrecise,
    quantityLabel,
    presentation,
    storageLocation,
    offerStatus,
    seedbankId,
    originName,
    originPlace,
    abundance,
    preservationFormat,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Lot &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.varietyId == this.varietyId &&
          other.type == this.type &&
          other.harvestYear == this.harvestYear &&
          other.harvestMonth == this.harvestMonth &&
          other.quantityKind == this.quantityKind &&
          other.quantityPrecise == this.quantityPrecise &&
          other.quantityLabel == this.quantityLabel &&
          other.presentation == this.presentation &&
          other.storageLocation == this.storageLocation &&
          other.offerStatus == this.offerStatus &&
          other.seedbankId == this.seedbankId &&
          other.originName == this.originName &&
          other.originPlace == this.originPlace &&
          other.abundance == this.abundance &&
          other.preservationFormat == this.preservationFormat);
}

class LotsCompanion extends UpdateCompanion<Lot> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> varietyId;
  final Value<LotType> type;
  final Value<int?> harvestYear;
  final Value<int?> harvestMonth;
  final Value<String?> quantityKind;
  final Value<double?> quantityPrecise;
  final Value<String?> quantityLabel;
  final Value<Presentation?> presentation;
  final Value<String?> storageLocation;
  final Value<OfferStatus> offerStatus;
  final Value<String?> seedbankId;
  final Value<String?> originName;
  final Value<String?> originPlace;
  final Value<Abundance?> abundance;
  final Value<PreservationFormat?> preservationFormat;
  final Value<int> rowid;
  const LotsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.varietyId = const Value.absent(),
    this.type = const Value.absent(),
    this.harvestYear = const Value.absent(),
    this.harvestMonth = const Value.absent(),
    this.quantityKind = const Value.absent(),
    this.quantityPrecise = const Value.absent(),
    this.quantityLabel = const Value.absent(),
    this.presentation = const Value.absent(),
    this.storageLocation = const Value.absent(),
    this.offerStatus = const Value.absent(),
    this.seedbankId = const Value.absent(),
    this.originName = const Value.absent(),
    this.originPlace = const Value.absent(),
    this.abundance = const Value.absent(),
    this.preservationFormat = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  LotsCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String varietyId,
    this.type = const Value.absent(),
    this.harvestYear = const Value.absent(),
    this.harvestMonth = const Value.absent(),
    this.quantityKind = const Value.absent(),
    this.quantityPrecise = const Value.absent(),
    this.quantityLabel = const Value.absent(),
    this.presentation = const Value.absent(),
    this.storageLocation = const Value.absent(),
    this.offerStatus = const Value.absent(),
    this.seedbankId = const Value.absent(),
    this.originName = const Value.absent(),
    this.originPlace = const Value.absent(),
    this.abundance = const Value.absent(),
    this.preservationFormat = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       varietyId = Value(varietyId);
  static Insertable<Lot> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? varietyId,
    Expression<String>? type,
    Expression<int>? harvestYear,
    Expression<int>? harvestMonth,
    Expression<String>? quantityKind,
    Expression<double>? quantityPrecise,
    Expression<String>? quantityLabel,
    Expression<String>? presentation,
    Expression<String>? storageLocation,
    Expression<String>? offerStatus,
    Expression<String>? seedbankId,
    Expression<String>? originName,
    Expression<String>? originPlace,
    Expression<String>? abundance,
    Expression<String>? preservationFormat,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (varietyId != null) 'variety_id': varietyId,
      if (type != null) 'type': type,
      if (harvestYear != null) 'harvest_year': harvestYear,
      if (harvestMonth != null) 'harvest_month': harvestMonth,
      if (quantityKind != null) 'quantity_kind': quantityKind,
      if (quantityPrecise != null) 'quantity_precise': quantityPrecise,
      if (quantityLabel != null) 'quantity_label': quantityLabel,
      if (presentation != null) 'presentation': presentation,
      if (storageLocation != null) 'storage_location': storageLocation,
      if (offerStatus != null) 'offer_status': offerStatus,
      if (seedbankId != null) 'seedbank_id': seedbankId,
      if (originName != null) 'origin_name': originName,
      if (originPlace != null) 'origin_place': originPlace,
      if (abundance != null) 'abundance': abundance,
      if (preservationFormat != null) 'preservation_format': preservationFormat,
      if (rowid != null) 'rowid': rowid,
    });
  }

  LotsCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? varietyId,
    Value<LotType>? type,
    Value<int?>? harvestYear,
    Value<int?>? harvestMonth,
    Value<String?>? quantityKind,
    Value<double?>? quantityPrecise,
    Value<String?>? quantityLabel,
    Value<Presentation?>? presentation,
    Value<String?>? storageLocation,
    Value<OfferStatus>? offerStatus,
    Value<String?>? seedbankId,
    Value<String?>? originName,
    Value<String?>? originPlace,
    Value<Abundance?>? abundance,
    Value<PreservationFormat?>? preservationFormat,
    Value<int>? rowid,
  }) {
    return LotsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      varietyId: varietyId ?? this.varietyId,
      type: type ?? this.type,
      harvestYear: harvestYear ?? this.harvestYear,
      harvestMonth: harvestMonth ?? this.harvestMonth,
      quantityKind: quantityKind ?? this.quantityKind,
      quantityPrecise: quantityPrecise ?? this.quantityPrecise,
      quantityLabel: quantityLabel ?? this.quantityLabel,
      presentation: presentation ?? this.presentation,
      storageLocation: storageLocation ?? this.storageLocation,
      offerStatus: offerStatus ?? this.offerStatus,
      seedbankId: seedbankId ?? this.seedbankId,
      originName: originName ?? this.originName,
      originPlace: originPlace ?? this.originPlace,
      abundance: abundance ?? this.abundance,
      preservationFormat: preservationFormat ?? this.preservationFormat,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (varietyId.present) {
      map['variety_id'] = Variable<String>(varietyId.value);
    }
    if (type.present) {
      map['type'] = Variable<String>(
        $LotsTable.$convertertype.toSql(type.value),
      );
    }
    if (harvestYear.present) {
      map['harvest_year'] = Variable<int>(harvestYear.value);
    }
    if (harvestMonth.present) {
      map['harvest_month'] = Variable<int>(harvestMonth.value);
    }
    if (quantityKind.present) {
      map['quantity_kind'] = Variable<String>(quantityKind.value);
    }
    if (quantityPrecise.present) {
      map['quantity_precise'] = Variable<double>(quantityPrecise.value);
    }
    if (quantityLabel.present) {
      map['quantity_label'] = Variable<String>(quantityLabel.value);
    }
    if (presentation.present) {
      map['presentation'] = Variable<String>(
        $LotsTable.$converterpresentationn.toSql(presentation.value),
      );
    }
    if (storageLocation.present) {
      map['storage_location'] = Variable<String>(storageLocation.value);
    }
    if (offerStatus.present) {
      map['offer_status'] = Variable<String>(
        $LotsTable.$converterofferStatus.toSql(offerStatus.value),
      );
    }
    if (seedbankId.present) {
      map['seedbank_id'] = Variable<String>(seedbankId.value);
    }
    if (originName.present) {
      map['origin_name'] = Variable<String>(originName.value);
    }
    if (originPlace.present) {
      map['origin_place'] = Variable<String>(originPlace.value);
    }
    if (abundance.present) {
      map['abundance'] = Variable<String>(
        $LotsTable.$converterabundancen.toSql(abundance.value),
      );
    }
    if (preservationFormat.present) {
      map['preservation_format'] = Variable<String>(
        $LotsTable.$converterpreservationFormatn.toSql(
          preservationFormat.value,
        ),
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('LotsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('varietyId: $varietyId, ')
          ..write('type: $type, ')
          ..write('harvestYear: $harvestYear, ')
          ..write('harvestMonth: $harvestMonth, ')
          ..write('quantityKind: $quantityKind, ')
          ..write('quantityPrecise: $quantityPrecise, ')
          ..write('quantityLabel: $quantityLabel, ')
          ..write('presentation: $presentation, ')
          ..write('storageLocation: $storageLocation, ')
          ..write('offerStatus: $offerStatus, ')
          ..write('seedbankId: $seedbankId, ')
          ..write('originName: $originName, ')
          ..write('originPlace: $originPlace, ')
          ..write('abundance: $abundance, ')
          ..write('preservationFormat: $preservationFormat, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $GerminationTestsTable extends GerminationTests
    with TableInfo<$GerminationTestsTable, GerminationTest> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $GerminationTestsTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _lotIdMeta = const VerificationMeta('lotId');
  @override
  late final GeneratedColumn<String> lotId = GeneratedColumn<String>(
    'lot_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _testedOnMeta = const VerificationMeta(
    'testedOn',
  );
  @override
  late final GeneratedColumn<int> testedOn = GeneratedColumn<int>(
    'tested_on',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _sampleSizeMeta = const VerificationMeta(
    'sampleSize',
  );
  @override
  late final GeneratedColumn<int> sampleSize = GeneratedColumn<int>(
    'sample_size',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _germinatedCountMeta = const VerificationMeta(
    'germinatedCount',
  );
  @override
  late final GeneratedColumn<int> germinatedCount = GeneratedColumn<int>(
    'germinated_count',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _notesMeta = const VerificationMeta('notes');
  @override
  late final GeneratedColumn<String> notes = GeneratedColumn<String>(
    'notes',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    lotId,
    testedOn,
    sampleSize,
    germinatedCount,
    notes,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'germination_tests';
  @override
  VerificationContext validateIntegrity(
    Insertable<GerminationTest> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('lot_id')) {
      context.handle(
        _lotIdMeta,
        lotId.isAcceptableOrUnknown(data['lot_id']!, _lotIdMeta),
      );
    } else if (isInserting) {
      context.missing(_lotIdMeta);
    }
    if (data.containsKey('tested_on')) {
      context.handle(
        _testedOnMeta,
        testedOn.isAcceptableOrUnknown(data['tested_on']!, _testedOnMeta),
      );
    }
    if (data.containsKey('sample_size')) {
      context.handle(
        _sampleSizeMeta,
        sampleSize.isAcceptableOrUnknown(data['sample_size']!, _sampleSizeMeta),
      );
    }
    if (data.containsKey('germinated_count')) {
      context.handle(
        _germinatedCountMeta,
        germinatedCount.isAcceptableOrUnknown(
          data['germinated_count']!,
          _germinatedCountMeta,
        ),
      );
    }
    if (data.containsKey('notes')) {
      context.handle(
        _notesMeta,
        notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  GerminationTest map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return GerminationTest(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      lotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}lot_id'],
      )!,
      testedOn: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}tested_on'],
      ),
      sampleSize: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sample_size'],
      ),
      germinatedCount: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}germinated_count'],
      ),
      notes: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}notes'],
      ),
    );
  }

  @override
  $GerminationTestsTable createAlias(String alias) {
    return $GerminationTestsTable(attachedDatabase, alias);
  }
}

class GerminationTest extends DataClass implements Insertable<GerminationTest> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String lotId;
  final int? testedOn;
  final int? sampleSize;
  final int? germinatedCount;
  final String? notes;
  const GerminationTest({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.lotId,
    this.testedOn,
    this.sampleSize,
    this.germinatedCount,
    this.notes,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['lot_id'] = Variable<String>(lotId);
    if (!nullToAbsent || testedOn != null) {
      map['tested_on'] = Variable<int>(testedOn);
    }
    if (!nullToAbsent || sampleSize != null) {
      map['sample_size'] = Variable<int>(sampleSize);
    }
    if (!nullToAbsent || germinatedCount != null) {
      map['germinated_count'] = Variable<int>(germinatedCount);
    }
    if (!nullToAbsent || notes != null) {
      map['notes'] = Variable<String>(notes);
    }
    return map;
  }

  GerminationTestsCompanion toCompanion(bool nullToAbsent) {
    return GerminationTestsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      lotId: Value(lotId),
      testedOn: testedOn == null && nullToAbsent
          ? const Value.absent()
          : Value(testedOn),
      sampleSize: sampleSize == null && nullToAbsent
          ? const Value.absent()
          : Value(sampleSize),
      germinatedCount: germinatedCount == null && nullToAbsent
          ? const Value.absent()
          : Value(germinatedCount),
      notes: notes == null && nullToAbsent
          ? const Value.absent()
          : Value(notes),
    );
  }

  factory GerminationTest.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return GerminationTest(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      lotId: serializer.fromJson<String>(json['lotId']),
      testedOn: serializer.fromJson<int?>(json['testedOn']),
      sampleSize: serializer.fromJson<int?>(json['sampleSize']),
      germinatedCount: serializer.fromJson<int?>(json['germinatedCount']),
      notes: serializer.fromJson<String?>(json['notes']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'lotId': serializer.toJson<String>(lotId),
      'testedOn': serializer.toJson<int?>(testedOn),
      'sampleSize': serializer.toJson<int?>(sampleSize),
      'germinatedCount': serializer.toJson<int?>(germinatedCount),
      'notes': serializer.toJson<String?>(notes),
    };
  }

  GerminationTest copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? lotId,
    Value<int?> testedOn = const Value.absent(),
    Value<int?> sampleSize = const Value.absent(),
    Value<int?> germinatedCount = const Value.absent(),
    Value<String?> notes = const Value.absent(),
  }) => GerminationTest(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    lotId: lotId ?? this.lotId,
    testedOn: testedOn.present ? testedOn.value : this.testedOn,
    sampleSize: sampleSize.present ? sampleSize.value : this.sampleSize,
    germinatedCount: germinatedCount.present
        ? germinatedCount.value
        : this.germinatedCount,
    notes: notes.present ? notes.value : this.notes,
  );
  GerminationTest copyWithCompanion(GerminationTestsCompanion data) {
    return GerminationTest(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      lotId: data.lotId.present ? data.lotId.value : this.lotId,
      testedOn: data.testedOn.present ? data.testedOn.value : this.testedOn,
      sampleSize: data.sampleSize.present
          ? data.sampleSize.value
          : this.sampleSize,
      germinatedCount: data.germinatedCount.present
          ? data.germinatedCount.value
          : this.germinatedCount,
      notes: data.notes.present ? data.notes.value : this.notes,
    );
  }

  @override
  String toString() {
    return (StringBuffer('GerminationTest(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('testedOn: $testedOn, ')
          ..write('sampleSize: $sampleSize, ')
          ..write('germinatedCount: $germinatedCount, ')
          ..write('notes: $notes')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    lotId,
    testedOn,
    sampleSize,
    germinatedCount,
    notes,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is GerminationTest &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.lotId == this.lotId &&
          other.testedOn == this.testedOn &&
          other.sampleSize == this.sampleSize &&
          other.germinatedCount == this.germinatedCount &&
          other.notes == this.notes);
}

class GerminationTestsCompanion extends UpdateCompanion<GerminationTest> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> lotId;
  final Value<int?> testedOn;
  final Value<int?> sampleSize;
  final Value<int?> germinatedCount;
  final Value<String?> notes;
  final Value<int> rowid;
  const GerminationTestsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.lotId = const Value.absent(),
    this.testedOn = const Value.absent(),
    this.sampleSize = const Value.absent(),
    this.germinatedCount = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  GerminationTestsCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String lotId,
    this.testedOn = const Value.absent(),
    this.sampleSize = const Value.absent(),
    this.germinatedCount = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       lotId = Value(lotId);
  static Insertable<GerminationTest> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? lotId,
    Expression<int>? testedOn,
    Expression<int>? sampleSize,
    Expression<int>? germinatedCount,
    Expression<String>? notes,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (lotId != null) 'lot_id': lotId,
      if (testedOn != null) 'tested_on': testedOn,
      if (sampleSize != null) 'sample_size': sampleSize,
      if (germinatedCount != null) 'germinated_count': germinatedCount,
      if (notes != null) 'notes': notes,
      if (rowid != null) 'rowid': rowid,
    });
  }

  GerminationTestsCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? lotId,
    Value<int?>? testedOn,
    Value<int?>? sampleSize,
    Value<int?>? germinatedCount,
    Value<String?>? notes,
    Value<int>? rowid,
  }) {
    return GerminationTestsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      lotId: lotId ?? this.lotId,
      testedOn: testedOn ?? this.testedOn,
      sampleSize: sampleSize ?? this.sampleSize,
      germinatedCount: germinatedCount ?? this.germinatedCount,
      notes: notes ?? this.notes,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (lotId.present) {
      map['lot_id'] = Variable<String>(lotId.value);
    }
    if (testedOn.present) {
      map['tested_on'] = Variable<int>(testedOn.value);
    }
    if (sampleSize.present) {
      map['sample_size'] = Variable<int>(sampleSize.value);
    }
    if (germinatedCount.present) {
      map['germinated_count'] = Variable<int>(germinatedCount.value);
    }
    if (notes.present) {
      map['notes'] = Variable<String>(notes.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('GerminationTestsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('testedOn: $testedOn, ')
          ..write('sampleSize: $sampleSize, ')
          ..write('germinatedCount: $germinatedCount, ')
          ..write('notes: $notes, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ConditionChecksTable extends ConditionChecks
    with TableInfo<$ConditionChecksTable, ConditionCheck> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ConditionChecksTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _lotIdMeta = const VerificationMeta('lotId');
  @override
  late final GeneratedColumn<String> lotId = GeneratedColumn<String>(
    'lot_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _checkedOnMeta = const VerificationMeta(
    'checkedOn',
  );
  @override
  late final GeneratedColumn<int> checkedOn = GeneratedColumn<int>(
    'checked_on',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _containerCountMeta = const VerificationMeta(
    'containerCount',
  );
  @override
  late final GeneratedColumn<int> containerCount = GeneratedColumn<int>(
    'container_count',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  @override
  late final GeneratedColumnWithTypeConverter<DesiccantState?, String>
  desiccantState =
      GeneratedColumn<String>(
        'desiccant_state',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      ).withConverter<DesiccantState?>(
        $ConditionChecksTable.$converterdesiccantStaten,
      );
  static const VerificationMeta _notesMeta = const VerificationMeta('notes');
  @override
  late final GeneratedColumn<String> notes = GeneratedColumn<String>(
    'notes',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    lotId,
    checkedOn,
    containerCount,
    desiccantState,
    notes,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'condition_checks';
  @override
  VerificationContext validateIntegrity(
    Insertable<ConditionCheck> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('lot_id')) {
      context.handle(
        _lotIdMeta,
        lotId.isAcceptableOrUnknown(data['lot_id']!, _lotIdMeta),
      );
    } else if (isInserting) {
      context.missing(_lotIdMeta);
    }
    if (data.containsKey('checked_on')) {
      context.handle(
        _checkedOnMeta,
        checkedOn.isAcceptableOrUnknown(data['checked_on']!, _checkedOnMeta),
      );
    }
    if (data.containsKey('container_count')) {
      context.handle(
        _containerCountMeta,
        containerCount.isAcceptableOrUnknown(
          data['container_count']!,
          _containerCountMeta,
        ),
      );
    }
    if (data.containsKey('notes')) {
      context.handle(
        _notesMeta,
        notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ConditionCheck map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ConditionCheck(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      lotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}lot_id'],
      )!,
      checkedOn: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}checked_on'],
      ),
      containerCount: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}container_count'],
      ),
      desiccantState: $ConditionChecksTable.$converterdesiccantStaten.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}desiccant_state'],
        ),
      ),
      notes: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}notes'],
      ),
    );
  }

  @override
  $ConditionChecksTable createAlias(String alias) {
    return $ConditionChecksTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<DesiccantState, String, String>
  $converterdesiccantState = const EnumNameConverter<DesiccantState>(
    DesiccantState.values,
  );
  static JsonTypeConverter2<DesiccantState?, String?, String?>
  $converterdesiccantStaten = JsonTypeConverter2.asNullable(
    $converterdesiccantState,
  );
}

class ConditionCheck extends DataClass implements Insertable<ConditionCheck> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String lotId;
  final int? checkedOn;
  final int? containerCount;
  final DesiccantState? desiccantState;
  final String? notes;
  const ConditionCheck({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.lotId,
    this.checkedOn,
    this.containerCount,
    this.desiccantState,
    this.notes,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['lot_id'] = Variable<String>(lotId);
    if (!nullToAbsent || checkedOn != null) {
      map['checked_on'] = Variable<int>(checkedOn);
    }
    if (!nullToAbsent || containerCount != null) {
      map['container_count'] = Variable<int>(containerCount);
    }
    if (!nullToAbsent || desiccantState != null) {
      map['desiccant_state'] = Variable<String>(
        $ConditionChecksTable.$converterdesiccantStaten.toSql(desiccantState),
      );
    }
    if (!nullToAbsent || notes != null) {
      map['notes'] = Variable<String>(notes);
    }
    return map;
  }

  ConditionChecksCompanion toCompanion(bool nullToAbsent) {
    return ConditionChecksCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      lotId: Value(lotId),
      checkedOn: checkedOn == null && nullToAbsent
          ? const Value.absent()
          : Value(checkedOn),
      containerCount: containerCount == null && nullToAbsent
          ? const Value.absent()
          : Value(containerCount),
      desiccantState: desiccantState == null && nullToAbsent
          ? const Value.absent()
          : Value(desiccantState),
      notes: notes == null && nullToAbsent
          ? const Value.absent()
          : Value(notes),
    );
  }

  factory ConditionCheck.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ConditionCheck(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      lotId: serializer.fromJson<String>(json['lotId']),
      checkedOn: serializer.fromJson<int?>(json['checkedOn']),
      containerCount: serializer.fromJson<int?>(json['containerCount']),
      desiccantState: $ConditionChecksTable.$converterdesiccantStaten.fromJson(
        serializer.fromJson<String?>(json['desiccantState']),
      ),
      notes: serializer.fromJson<String?>(json['notes']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'lotId': serializer.toJson<String>(lotId),
      'checkedOn': serializer.toJson<int?>(checkedOn),
      'containerCount': serializer.toJson<int?>(containerCount),
      'desiccantState': serializer.toJson<String?>(
        $ConditionChecksTable.$converterdesiccantStaten.toJson(desiccantState),
      ),
      'notes': serializer.toJson<String?>(notes),
    };
  }

  ConditionCheck copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? lotId,
    Value<int?> checkedOn = const Value.absent(),
    Value<int?> containerCount = const Value.absent(),
    Value<DesiccantState?> desiccantState = const Value.absent(),
    Value<String?> notes = const Value.absent(),
  }) => ConditionCheck(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    lotId: lotId ?? this.lotId,
    checkedOn: checkedOn.present ? checkedOn.value : this.checkedOn,
    containerCount: containerCount.present
        ? containerCount.value
        : this.containerCount,
    desiccantState: desiccantState.present
        ? desiccantState.value
        : this.desiccantState,
    notes: notes.present ? notes.value : this.notes,
  );
  ConditionCheck copyWithCompanion(ConditionChecksCompanion data) {
    return ConditionCheck(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      lotId: data.lotId.present ? data.lotId.value : this.lotId,
      checkedOn: data.checkedOn.present ? data.checkedOn.value : this.checkedOn,
      containerCount: data.containerCount.present
          ? data.containerCount.value
          : this.containerCount,
      desiccantState: data.desiccantState.present
          ? data.desiccantState.value
          : this.desiccantState,
      notes: data.notes.present ? data.notes.value : this.notes,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ConditionCheck(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('checkedOn: $checkedOn, ')
          ..write('containerCount: $containerCount, ')
          ..write('desiccantState: $desiccantState, ')
          ..write('notes: $notes')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    lotId,
    checkedOn,
    containerCount,
    desiccantState,
    notes,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ConditionCheck &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.lotId == this.lotId &&
          other.checkedOn == this.checkedOn &&
          other.containerCount == this.containerCount &&
          other.desiccantState == this.desiccantState &&
          other.notes == this.notes);
}

class ConditionChecksCompanion extends UpdateCompanion<ConditionCheck> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> lotId;
  final Value<int?> checkedOn;
  final Value<int?> containerCount;
  final Value<DesiccantState?> desiccantState;
  final Value<String?> notes;
  final Value<int> rowid;
  const ConditionChecksCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.lotId = const Value.absent(),
    this.checkedOn = const Value.absent(),
    this.containerCount = const Value.absent(),
    this.desiccantState = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ConditionChecksCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String lotId,
    this.checkedOn = const Value.absent(),
    this.containerCount = const Value.absent(),
    this.desiccantState = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       lotId = Value(lotId);
  static Insertable<ConditionCheck> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? lotId,
    Expression<int>? checkedOn,
    Expression<int>? containerCount,
    Expression<String>? desiccantState,
    Expression<String>? notes,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (lotId != null) 'lot_id': lotId,
      if (checkedOn != null) 'checked_on': checkedOn,
      if (containerCount != null) 'container_count': containerCount,
      if (desiccantState != null) 'desiccant_state': desiccantState,
      if (notes != null) 'notes': notes,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ConditionChecksCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? lotId,
    Value<int?>? checkedOn,
    Value<int?>? containerCount,
    Value<DesiccantState?>? desiccantState,
    Value<String?>? notes,
    Value<int>? rowid,
  }) {
    return ConditionChecksCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      lotId: lotId ?? this.lotId,
      checkedOn: checkedOn ?? this.checkedOn,
      containerCount: containerCount ?? this.containerCount,
      desiccantState: desiccantState ?? this.desiccantState,
      notes: notes ?? this.notes,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (lotId.present) {
      map['lot_id'] = Variable<String>(lotId.value);
    }
    if (checkedOn.present) {
      map['checked_on'] = Variable<int>(checkedOn.value);
    }
    if (containerCount.present) {
      map['container_count'] = Variable<int>(containerCount.value);
    }
    if (desiccantState.present) {
      map['desiccant_state'] = Variable<String>(
        $ConditionChecksTable.$converterdesiccantStaten.toSql(
          desiccantState.value,
        ),
      );
    }
    if (notes.present) {
      map['notes'] = Variable<String>(notes.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ConditionChecksCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('checkedOn: $checkedOn, ')
          ..write('containerCount: $containerCount, ')
          ..write('desiccantState: $desiccantState, ')
          ..write('notes: $notes, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $MovementsTable extends Movements
    with TableInfo<$MovementsTable, Movement> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $MovementsTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _lotIdMeta = const VerificationMeta('lotId');
  @override
  late final GeneratedColumn<String> lotId = GeneratedColumn<String>(
    'lot_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  @override
  late final GeneratedColumnWithTypeConverter<MovementType, String> type =
      GeneratedColumn<String>(
        'type',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      ).withConverter<MovementType>($MovementsTable.$convertertype);
  static const VerificationMeta _occurredOnMeta = const VerificationMeta(
    'occurredOn',
  );
  @override
  late final GeneratedColumn<int> occurredOn = GeneratedColumn<int>(
    'occurred_on',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _counterpartyIdMeta = const VerificationMeta(
    'counterpartyId',
  );
  @override
  late final GeneratedColumn<String> counterpartyId = GeneratedColumn<String>(
    'counterparty_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityKindMeta = const VerificationMeta(
    'quantityKind',
  );
  @override
  late final GeneratedColumn<String> quantityKind = GeneratedColumn<String>(
    'quantity_kind',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityPreciseMeta = const VerificationMeta(
    'quantityPrecise',
  );
  @override
  late final GeneratedColumn<double> quantityPrecise = GeneratedColumn<double>(
    'quantity_precise',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _quantityLabelMeta = const VerificationMeta(
    'quantityLabel',
  );
  @override
  late final GeneratedColumn<String> quantityLabel = GeneratedColumn<String>(
    'quantity_label',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _parentMovementIdMeta = const VerificationMeta(
    'parentMovementId',
  );
  @override
  late final GeneratedColumn<String> parentMovementId = GeneratedColumn<String>(
    'parent_movement_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _plantareIdMeta = const VerificationMeta(
    'plantareId',
  );
  @override
  late final GeneratedColumn<String> plantareId = GeneratedColumn<String>(
    'plantare_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _notesMeta = const VerificationMeta('notes');
  @override
  late final GeneratedColumn<String> notes = GeneratedColumn<String>(
    'notes',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    lastAuthor,
    schemaRowVersion,
    lotId,
    type,
    occurredOn,
    counterpartyId,
    quantityKind,
    quantityPrecise,
    quantityLabel,
    parentMovementId,
    plantareId,
    notes,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'movements';
  @override
  VerificationContext validateIntegrity(
    Insertable<Movement> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('lot_id')) {
      context.handle(
        _lotIdMeta,
        lotId.isAcceptableOrUnknown(data['lot_id']!, _lotIdMeta),
      );
    } else if (isInserting) {
      context.missing(_lotIdMeta);
    }
    if (data.containsKey('occurred_on')) {
      context.handle(
        _occurredOnMeta,
        occurredOn.isAcceptableOrUnknown(data['occurred_on']!, _occurredOnMeta),
      );
    }
    if (data.containsKey('counterparty_id')) {
      context.handle(
        _counterpartyIdMeta,
        counterpartyId.isAcceptableOrUnknown(
          data['counterparty_id']!,
          _counterpartyIdMeta,
        ),
      );
    }
    if (data.containsKey('quantity_kind')) {
      context.handle(
        _quantityKindMeta,
        quantityKind.isAcceptableOrUnknown(
          data['quantity_kind']!,
          _quantityKindMeta,
        ),
      );
    }
    if (data.containsKey('quantity_precise')) {
      context.handle(
        _quantityPreciseMeta,
        quantityPrecise.isAcceptableOrUnknown(
          data['quantity_precise']!,
          _quantityPreciseMeta,
        ),
      );
    }
    if (data.containsKey('quantity_label')) {
      context.handle(
        _quantityLabelMeta,
        quantityLabel.isAcceptableOrUnknown(
          data['quantity_label']!,
          _quantityLabelMeta,
        ),
      );
    }
    if (data.containsKey('parent_movement_id')) {
      context.handle(
        _parentMovementIdMeta,
        parentMovementId.isAcceptableOrUnknown(
          data['parent_movement_id']!,
          _parentMovementIdMeta,
        ),
      );
    }
    if (data.containsKey('plantare_id')) {
      context.handle(
        _plantareIdMeta,
        plantareId.isAcceptableOrUnknown(data['plantare_id']!, _plantareIdMeta),
      );
    }
    if (data.containsKey('notes')) {
      context.handle(
        _notesMeta,
        notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Movement map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Movement(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      lotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}lot_id'],
      )!,
      type: $MovementsTable.$convertertype.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}type'],
        )!,
      ),
      occurredOn: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}occurred_on'],
      ),
      counterpartyId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}counterparty_id'],
      ),
      quantityKind: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}quantity_kind'],
      ),
      quantityPrecise: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}quantity_precise'],
      ),
      quantityLabel: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}quantity_label'],
      ),
      parentMovementId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}parent_movement_id'],
      ),
      plantareId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}plantare_id'],
      ),
      notes: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}notes'],
      ),
    );
  }

  @override
  $MovementsTable createAlias(String alias) {
    return $MovementsTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<MovementType, String, String> $convertertype =
      const EnumNameConverter<MovementType>(MovementType.values);
}

class Movement extends DataClass implements Insertable<Movement> {
  final String id;
  final int createdAt;
  final String lastAuthor;
  final int schemaRowVersion;
  final String lotId;
  final MovementType type;
  final int? occurredOn;
  final String? counterpartyId;
  final String? quantityKind;
  final double? quantityPrecise;
  final String? quantityLabel;
  final String? parentMovementId;
  final String? plantareId;
  final String? notes;
  const Movement({
    required this.id,
    required this.createdAt,
    required this.lastAuthor,
    required this.schemaRowVersion,
    required this.lotId,
    required this.type,
    this.occurredOn,
    this.counterpartyId,
    this.quantityKind,
    this.quantityPrecise,
    this.quantityLabel,
    this.parentMovementId,
    this.plantareId,
    this.notes,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['lot_id'] = Variable<String>(lotId);
    {
      map['type'] = Variable<String>(
        $MovementsTable.$convertertype.toSql(type),
      );
    }
    if (!nullToAbsent || occurredOn != null) {
      map['occurred_on'] = Variable<int>(occurredOn);
    }
    if (!nullToAbsent || counterpartyId != null) {
      map['counterparty_id'] = Variable<String>(counterpartyId);
    }
    if (!nullToAbsent || quantityKind != null) {
      map['quantity_kind'] = Variable<String>(quantityKind);
    }
    if (!nullToAbsent || quantityPrecise != null) {
      map['quantity_precise'] = Variable<double>(quantityPrecise);
    }
    if (!nullToAbsent || quantityLabel != null) {
      map['quantity_label'] = Variable<String>(quantityLabel);
    }
    if (!nullToAbsent || parentMovementId != null) {
      map['parent_movement_id'] = Variable<String>(parentMovementId);
    }
    if (!nullToAbsent || plantareId != null) {
      map['plantare_id'] = Variable<String>(plantareId);
    }
    if (!nullToAbsent || notes != null) {
      map['notes'] = Variable<String>(notes);
    }
    return map;
  }

  MovementsCompanion toCompanion(bool nullToAbsent) {
    return MovementsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      lastAuthor: Value(lastAuthor),
      schemaRowVersion: Value(schemaRowVersion),
      lotId: Value(lotId),
      type: Value(type),
      occurredOn: occurredOn == null && nullToAbsent
          ? const Value.absent()
          : Value(occurredOn),
      counterpartyId: counterpartyId == null && nullToAbsent
          ? const Value.absent()
          : Value(counterpartyId),
      quantityKind: quantityKind == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityKind),
      quantityPrecise: quantityPrecise == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityPrecise),
      quantityLabel: quantityLabel == null && nullToAbsent
          ? const Value.absent()
          : Value(quantityLabel),
      parentMovementId: parentMovementId == null && nullToAbsent
          ? const Value.absent()
          : Value(parentMovementId),
      plantareId: plantareId == null && nullToAbsent
          ? const Value.absent()
          : Value(plantareId),
      notes: notes == null && nullToAbsent
          ? const Value.absent()
          : Value(notes),
    );
  }

  factory Movement.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Movement(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      lotId: serializer.fromJson<String>(json['lotId']),
      type: $MovementsTable.$convertertype.fromJson(
        serializer.fromJson<String>(json['type']),
      ),
      occurredOn: serializer.fromJson<int?>(json['occurredOn']),
      counterpartyId: serializer.fromJson<String?>(json['counterpartyId']),
      quantityKind: serializer.fromJson<String?>(json['quantityKind']),
      quantityPrecise: serializer.fromJson<double?>(json['quantityPrecise']),
      quantityLabel: serializer.fromJson<String?>(json['quantityLabel']),
      parentMovementId: serializer.fromJson<String?>(json['parentMovementId']),
      plantareId: serializer.fromJson<String?>(json['plantareId']),
      notes: serializer.fromJson<String?>(json['notes']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'lotId': serializer.toJson<String>(lotId),
      'type': serializer.toJson<String>(
        $MovementsTable.$convertertype.toJson(type),
      ),
      'occurredOn': serializer.toJson<int?>(occurredOn),
      'counterpartyId': serializer.toJson<String?>(counterpartyId),
      'quantityKind': serializer.toJson<String?>(quantityKind),
      'quantityPrecise': serializer.toJson<double?>(quantityPrecise),
      'quantityLabel': serializer.toJson<String?>(quantityLabel),
      'parentMovementId': serializer.toJson<String?>(parentMovementId),
      'plantareId': serializer.toJson<String?>(plantareId),
      'notes': serializer.toJson<String?>(notes),
    };
  }

  Movement copyWith({
    String? id,
    int? createdAt,
    String? lastAuthor,
    int? schemaRowVersion,
    String? lotId,
    MovementType? type,
    Value<int?> occurredOn = const Value.absent(),
    Value<String?> counterpartyId = const Value.absent(),
    Value<String?> quantityKind = const Value.absent(),
    Value<double?> quantityPrecise = const Value.absent(),
    Value<String?> quantityLabel = const Value.absent(),
    Value<String?> parentMovementId = const Value.absent(),
    Value<String?> plantareId = const Value.absent(),
    Value<String?> notes = const Value.absent(),
  }) => Movement(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    lotId: lotId ?? this.lotId,
    type: type ?? this.type,
    occurredOn: occurredOn.present ? occurredOn.value : this.occurredOn,
    counterpartyId: counterpartyId.present
        ? counterpartyId.value
        : this.counterpartyId,
    quantityKind: quantityKind.present ? quantityKind.value : this.quantityKind,
    quantityPrecise: quantityPrecise.present
        ? quantityPrecise.value
        : this.quantityPrecise,
    quantityLabel: quantityLabel.present
        ? quantityLabel.value
        : this.quantityLabel,
    parentMovementId: parentMovementId.present
        ? parentMovementId.value
        : this.parentMovementId,
    plantareId: plantareId.present ? plantareId.value : this.plantareId,
    notes: notes.present ? notes.value : this.notes,
  );
  Movement copyWithCompanion(MovementsCompanion data) {
    return Movement(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      lotId: data.lotId.present ? data.lotId.value : this.lotId,
      type: data.type.present ? data.type.value : this.type,
      occurredOn: data.occurredOn.present
          ? data.occurredOn.value
          : this.occurredOn,
      counterpartyId: data.counterpartyId.present
          ? data.counterpartyId.value
          : this.counterpartyId,
      quantityKind: data.quantityKind.present
          ? data.quantityKind.value
          : this.quantityKind,
      quantityPrecise: data.quantityPrecise.present
          ? data.quantityPrecise.value
          : this.quantityPrecise,
      quantityLabel: data.quantityLabel.present
          ? data.quantityLabel.value
          : this.quantityLabel,
      parentMovementId: data.parentMovementId.present
          ? data.parentMovementId.value
          : this.parentMovementId,
      plantareId: data.plantareId.present
          ? data.plantareId.value
          : this.plantareId,
      notes: data.notes.present ? data.notes.value : this.notes,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Movement(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('type: $type, ')
          ..write('occurredOn: $occurredOn, ')
          ..write('counterpartyId: $counterpartyId, ')
          ..write('quantityKind: $quantityKind, ')
          ..write('quantityPrecise: $quantityPrecise, ')
          ..write('quantityLabel: $quantityLabel, ')
          ..write('parentMovementId: $parentMovementId, ')
          ..write('plantareId: $plantareId, ')
          ..write('notes: $notes')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    lastAuthor,
    schemaRowVersion,
    lotId,
    type,
    occurredOn,
    counterpartyId,
    quantityKind,
    quantityPrecise,
    quantityLabel,
    parentMovementId,
    plantareId,
    notes,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Movement &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.lastAuthor == this.lastAuthor &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.lotId == this.lotId &&
          other.type == this.type &&
          other.occurredOn == this.occurredOn &&
          other.counterpartyId == this.counterpartyId &&
          other.quantityKind == this.quantityKind &&
          other.quantityPrecise == this.quantityPrecise &&
          other.quantityLabel == this.quantityLabel &&
          other.parentMovementId == this.parentMovementId &&
          other.plantareId == this.plantareId &&
          other.notes == this.notes);
}

class MovementsCompanion extends UpdateCompanion<Movement> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> lastAuthor;
  final Value<int> schemaRowVersion;
  final Value<String> lotId;
  final Value<MovementType> type;
  final Value<int?> occurredOn;
  final Value<String?> counterpartyId;
  final Value<String?> quantityKind;
  final Value<double?> quantityPrecise;
  final Value<String?> quantityLabel;
  final Value<String?> parentMovementId;
  final Value<String?> plantareId;
  final Value<String?> notes;
  final Value<int> rowid;
  const MovementsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.lotId = const Value.absent(),
    this.type = const Value.absent(),
    this.occurredOn = const Value.absent(),
    this.counterpartyId = const Value.absent(),
    this.quantityKind = const Value.absent(),
    this.quantityPrecise = const Value.absent(),
    this.quantityLabel = const Value.absent(),
    this.parentMovementId = const Value.absent(),
    this.plantareId = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  MovementsCompanion.insert({
    required String id,
    required int createdAt,
    required String lastAuthor,
    this.schemaRowVersion = const Value.absent(),
    required String lotId,
    required MovementType type,
    this.occurredOn = const Value.absent(),
    this.counterpartyId = const Value.absent(),
    this.quantityKind = const Value.absent(),
    this.quantityPrecise = const Value.absent(),
    this.quantityLabel = const Value.absent(),
    this.parentMovementId = const Value.absent(),
    this.plantareId = const Value.absent(),
    this.notes = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       lastAuthor = Value(lastAuthor),
       lotId = Value(lotId),
       type = Value(type);
  static Insertable<Movement> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? lastAuthor,
    Expression<int>? schemaRowVersion,
    Expression<String>? lotId,
    Expression<String>? type,
    Expression<int>? occurredOn,
    Expression<String>? counterpartyId,
    Expression<String>? quantityKind,
    Expression<double>? quantityPrecise,
    Expression<String>? quantityLabel,
    Expression<String>? parentMovementId,
    Expression<String>? plantareId,
    Expression<String>? notes,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (lotId != null) 'lot_id': lotId,
      if (type != null) 'type': type,
      if (occurredOn != null) 'occurred_on': occurredOn,
      if (counterpartyId != null) 'counterparty_id': counterpartyId,
      if (quantityKind != null) 'quantity_kind': quantityKind,
      if (quantityPrecise != null) 'quantity_precise': quantityPrecise,
      if (quantityLabel != null) 'quantity_label': quantityLabel,
      if (parentMovementId != null) 'parent_movement_id': parentMovementId,
      if (plantareId != null) 'plantare_id': plantareId,
      if (notes != null) 'notes': notes,
      if (rowid != null) 'rowid': rowid,
    });
  }

  MovementsCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? lastAuthor,
    Value<int>? schemaRowVersion,
    Value<String>? lotId,
    Value<MovementType>? type,
    Value<int?>? occurredOn,
    Value<String?>? counterpartyId,
    Value<String?>? quantityKind,
    Value<double?>? quantityPrecise,
    Value<String?>? quantityLabel,
    Value<String?>? parentMovementId,
    Value<String?>? plantareId,
    Value<String?>? notes,
    Value<int>? rowid,
  }) {
    return MovementsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      lotId: lotId ?? this.lotId,
      type: type ?? this.type,
      occurredOn: occurredOn ?? this.occurredOn,
      counterpartyId: counterpartyId ?? this.counterpartyId,
      quantityKind: quantityKind ?? this.quantityKind,
      quantityPrecise: quantityPrecise ?? this.quantityPrecise,
      quantityLabel: quantityLabel ?? this.quantityLabel,
      parentMovementId: parentMovementId ?? this.parentMovementId,
      plantareId: plantareId ?? this.plantareId,
      notes: notes ?? this.notes,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (lotId.present) {
      map['lot_id'] = Variable<String>(lotId.value);
    }
    if (type.present) {
      map['type'] = Variable<String>(
        $MovementsTable.$convertertype.toSql(type.value),
      );
    }
    if (occurredOn.present) {
      map['occurred_on'] = Variable<int>(occurredOn.value);
    }
    if (counterpartyId.present) {
      map['counterparty_id'] = Variable<String>(counterpartyId.value);
    }
    if (quantityKind.present) {
      map['quantity_kind'] = Variable<String>(quantityKind.value);
    }
    if (quantityPrecise.present) {
      map['quantity_precise'] = Variable<double>(quantityPrecise.value);
    }
    if (quantityLabel.present) {
      map['quantity_label'] = Variable<String>(quantityLabel.value);
    }
    if (parentMovementId.present) {
      map['parent_movement_id'] = Variable<String>(parentMovementId.value);
    }
    if (plantareId.present) {
      map['plantare_id'] = Variable<String>(plantareId.value);
    }
    if (notes.present) {
      map['notes'] = Variable<String>(notes.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('MovementsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('lotId: $lotId, ')
          ..write('type: $type, ')
          ..write('occurredOn: $occurredOn, ')
          ..write('counterpartyId: $counterpartyId, ')
          ..write('quantityKind: $quantityKind, ')
          ..write('quantityPrecise: $quantityPrecise, ')
          ..write('quantityLabel: $quantityLabel, ')
          ..write('parentMovementId: $parentMovementId, ')
          ..write('plantareId: $plantareId, ')
          ..write('notes: $notes, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $PartiesTable extends Parties with TableInfo<$PartiesTable, Party> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $PartiesTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _displayNameMeta = const VerificationMeta(
    'displayName',
  );
  @override
  late final GeneratedColumn<String> displayName = GeneratedColumn<String>(
    'display_name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _publicKeyMeta = const VerificationMeta(
    'publicKey',
  );
  @override
  late final GeneratedColumn<String> publicKey = GeneratedColumn<String>(
    'public_key',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  late final GeneratedColumnWithTypeConverter<PartyKind, String> kind =
      GeneratedColumn<String>(
        'kind',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('person'),
      ).withConverter<PartyKind>($PartiesTable.$converterkind);
  static const VerificationMeta _noteMeta = const VerificationMeta('note');
  @override
  late final GeneratedColumn<String> note = GeneratedColumn<String>(
    'note',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    displayName,
    publicKey,
    kind,
    note,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'parties';
  @override
  VerificationContext validateIntegrity(
    Insertable<Party> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('display_name')) {
      context.handle(
        _displayNameMeta,
        displayName.isAcceptableOrUnknown(
          data['display_name']!,
          _displayNameMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_displayNameMeta);
    }
    if (data.containsKey('public_key')) {
      context.handle(
        _publicKeyMeta,
        publicKey.isAcceptableOrUnknown(data['public_key']!, _publicKeyMeta),
      );
    }
    if (data.containsKey('note')) {
      context.handle(
        _noteMeta,
        note.isAcceptableOrUnknown(data['note']!, _noteMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Party map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Party(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      displayName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}display_name'],
      )!,
      publicKey: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}public_key'],
      ),
      kind: $PartiesTable.$converterkind.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}kind'],
        )!,
      ),
      note: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}note'],
      ),
    );
  }

  @override
  $PartiesTable createAlias(String alias) {
    return $PartiesTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<PartyKind, String, String> $converterkind =
      const EnumNameConverter<PartyKind>(PartyKind.values);
}

class Party extends DataClass implements Insertable<Party> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final String displayName;
  final String? publicKey;
  final PartyKind kind;
  final String? note;
  const Party({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.displayName,
    this.publicKey,
    required this.kind,
    this.note,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    map['display_name'] = Variable<String>(displayName);
    if (!nullToAbsent || publicKey != null) {
      map['public_key'] = Variable<String>(publicKey);
    }
    {
      map['kind'] = Variable<String>($PartiesTable.$converterkind.toSql(kind));
    }
    if (!nullToAbsent || note != null) {
      map['note'] = Variable<String>(note);
    }
    return map;
  }

  PartiesCompanion toCompanion(bool nullToAbsent) {
    return PartiesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      displayName: Value(displayName),
      publicKey: publicKey == null && nullToAbsent
          ? const Value.absent()
          : Value(publicKey),
      kind: Value(kind),
      note: note == null && nullToAbsent ? const Value.absent() : Value(note),
    );
  }

  factory Party.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Party(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      displayName: serializer.fromJson<String>(json['displayName']),
      publicKey: serializer.fromJson<String?>(json['publicKey']),
      kind: $PartiesTable.$converterkind.fromJson(
        serializer.fromJson<String>(json['kind']),
      ),
      note: serializer.fromJson<String?>(json['note']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'displayName': serializer.toJson<String>(displayName),
      'publicKey': serializer.toJson<String?>(publicKey),
      'kind': serializer.toJson<String>(
        $PartiesTable.$converterkind.toJson(kind),
      ),
      'note': serializer.toJson<String?>(note),
    };
  }

  Party copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    String? displayName,
    Value<String?> publicKey = const Value.absent(),
    PartyKind? kind,
    Value<String?> note = const Value.absent(),
  }) => Party(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    displayName: displayName ?? this.displayName,
    publicKey: publicKey.present ? publicKey.value : this.publicKey,
    kind: kind ?? this.kind,
    note: note.present ? note.value : this.note,
  );
  Party copyWithCompanion(PartiesCompanion data) {
    return Party(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      displayName: data.displayName.present
          ? data.displayName.value
          : this.displayName,
      publicKey: data.publicKey.present ? data.publicKey.value : this.publicKey,
      kind: data.kind.present ? data.kind.value : this.kind,
      note: data.note.present ? data.note.value : this.note,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Party(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('displayName: $displayName, ')
          ..write('publicKey: $publicKey, ')
          ..write('kind: $kind, ')
          ..write('note: $note')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    displayName,
    publicKey,
    kind,
    note,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Party &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.displayName == this.displayName &&
          other.publicKey == this.publicKey &&
          other.kind == this.kind &&
          other.note == this.note);
}

class PartiesCompanion extends UpdateCompanion<Party> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<String> displayName;
  final Value<String?> publicKey;
  final Value<PartyKind> kind;
  final Value<String?> note;
  final Value<int> rowid;
  const PartiesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.displayName = const Value.absent(),
    this.publicKey = const Value.absent(),
    this.kind = const Value.absent(),
    this.note = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  PartiesCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required String displayName,
    this.publicKey = const Value.absent(),
    this.kind = const Value.absent(),
    this.note = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       displayName = Value(displayName);
  static Insertable<Party> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? displayName,
    Expression<String>? publicKey,
    Expression<String>? kind,
    Expression<String>? note,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (displayName != null) 'display_name': displayName,
      if (publicKey != null) 'public_key': publicKey,
      if (kind != null) 'kind': kind,
      if (note != null) 'note': note,
      if (rowid != null) 'rowid': rowid,
    });
  }

  PartiesCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<String>? displayName,
    Value<String?>? publicKey,
    Value<PartyKind>? kind,
    Value<String?>? note,
    Value<int>? rowid,
  }) {
    return PartiesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      displayName: displayName ?? this.displayName,
      publicKey: publicKey ?? this.publicKey,
      kind: kind ?? this.kind,
      note: note ?? this.note,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (displayName.present) {
      map['display_name'] = Variable<String>(displayName.value);
    }
    if (publicKey.present) {
      map['public_key'] = Variable<String>(publicKey.value);
    }
    if (kind.present) {
      map['kind'] = Variable<String>(
        $PartiesTable.$converterkind.toSql(kind.value),
      );
    }
    if (note.present) {
      map['note'] = Variable<String>(note.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('PartiesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('displayName: $displayName, ')
          ..write('publicKey: $publicKey, ')
          ..write('kind: $kind, ')
          ..write('note: $note, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $AttachmentsTable extends Attachments
    with TableInfo<$AttachmentsTable, Attachment> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $AttachmentsTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  @override
  late final GeneratedColumnWithTypeConverter<ParentType, String> parentType =
      GeneratedColumn<String>(
        'parent_type',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      ).withConverter<ParentType>($AttachmentsTable.$converterparentType);
  static const VerificationMeta _parentIdMeta = const VerificationMeta(
    'parentId',
  );
  @override
  late final GeneratedColumn<String> parentId = GeneratedColumn<String>(
    'parent_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  @override
  late final GeneratedColumnWithTypeConverter<AttachmentKind, String> kind =
      GeneratedColumn<String>(
        'kind',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      ).withConverter<AttachmentKind>($AttachmentsTable.$converterkind);
  static const VerificationMeta _uriMeta = const VerificationMeta('uri');
  @override
  late final GeneratedColumn<String> uri = GeneratedColumn<String>(
    'uri',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _bytesMeta = const VerificationMeta('bytes');
  @override
  late final GeneratedColumn<Uint8List> bytes = GeneratedColumn<Uint8List>(
    'bytes',
    aliasedName,
    true,
    type: DriftSqlType.blob,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _mimeTypeMeta = const VerificationMeta(
    'mimeType',
  );
  @override
  late final GeneratedColumn<String> mimeType = GeneratedColumn<String>(
    'mime_type',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _sortOrderMeta = const VerificationMeta(
    'sortOrder',
  );
  @override
  late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
    'sort_order',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(0),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    parentType,
    parentId,
    kind,
    uri,
    bytes,
    mimeType,
    sortOrder,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'attachments';
  @override
  VerificationContext validateIntegrity(
    Insertable<Attachment> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('parent_id')) {
      context.handle(
        _parentIdMeta,
        parentId.isAcceptableOrUnknown(data['parent_id']!, _parentIdMeta),
      );
    } else if (isInserting) {
      context.missing(_parentIdMeta);
    }
    if (data.containsKey('uri')) {
      context.handle(
        _uriMeta,
        uri.isAcceptableOrUnknown(data['uri']!, _uriMeta),
      );
    }
    if (data.containsKey('bytes')) {
      context.handle(
        _bytesMeta,
        bytes.isAcceptableOrUnknown(data['bytes']!, _bytesMeta),
      );
    }
    if (data.containsKey('mime_type')) {
      context.handle(
        _mimeTypeMeta,
        mimeType.isAcceptableOrUnknown(data['mime_type']!, _mimeTypeMeta),
      );
    }
    if (data.containsKey('sort_order')) {
      context.handle(
        _sortOrderMeta,
        sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Attachment map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Attachment(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      parentType: $AttachmentsTable.$converterparentType.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}parent_type'],
        )!,
      ),
      parentId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}parent_id'],
      )!,
      kind: $AttachmentsTable.$converterkind.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}kind'],
        )!,
      ),
      uri: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}uri'],
      ),
      bytes: attachedDatabase.typeMapping.read(
        DriftSqlType.blob,
        data['${effectivePrefix}bytes'],
      ),
      mimeType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}mime_type'],
      ),
      sortOrder: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sort_order'],
      )!,
    );
  }

  @override
  $AttachmentsTable createAlias(String alias) {
    return $AttachmentsTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<ParentType, String, String> $converterparentType =
      const EnumNameConverter<ParentType>(ParentType.values);
  static JsonTypeConverter2<AttachmentKind, String, String> $converterkind =
      const EnumNameConverter<AttachmentKind>(AttachmentKind.values);
}

class Attachment extends DataClass implements Insertable<Attachment> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final ParentType parentType;
  final String parentId;
  final AttachmentKind kind;
  final String? uri;
  final Uint8List? bytes;
  final String? mimeType;

  /// Display order among sibling attachments (lower first). The lowest-ordered
  /// photo is the "preferred"/cover — used as the variety avatar and shown
  /// first. New photos append at the end; "set as cover" moves one to the
  /// front. A plain int (not a bool flag) so it generalizes to full reordering.
  final int sortOrder;
  const Attachment({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.parentType,
    required this.parentId,
    required this.kind,
    this.uri,
    this.bytes,
    this.mimeType,
    required this.sortOrder,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    {
      map['parent_type'] = Variable<String>(
        $AttachmentsTable.$converterparentType.toSql(parentType),
      );
    }
    map['parent_id'] = Variable<String>(parentId);
    {
      map['kind'] = Variable<String>(
        $AttachmentsTable.$converterkind.toSql(kind),
      );
    }
    if (!nullToAbsent || uri != null) {
      map['uri'] = Variable<String>(uri);
    }
    if (!nullToAbsent || bytes != null) {
      map['bytes'] = Variable<Uint8List>(bytes);
    }
    if (!nullToAbsent || mimeType != null) {
      map['mime_type'] = Variable<String>(mimeType);
    }
    map['sort_order'] = Variable<int>(sortOrder);
    return map;
  }

  AttachmentsCompanion toCompanion(bool nullToAbsent) {
    return AttachmentsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      parentType: Value(parentType),
      parentId: Value(parentId),
      kind: Value(kind),
      uri: uri == null && nullToAbsent ? const Value.absent() : Value(uri),
      bytes: bytes == null && nullToAbsent
          ? const Value.absent()
          : Value(bytes),
      mimeType: mimeType == null && nullToAbsent
          ? const Value.absent()
          : Value(mimeType),
      sortOrder: Value(sortOrder),
    );
  }

  factory Attachment.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Attachment(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      parentType: $AttachmentsTable.$converterparentType.fromJson(
        serializer.fromJson<String>(json['parentType']),
      ),
      parentId: serializer.fromJson<String>(json['parentId']),
      kind: $AttachmentsTable.$converterkind.fromJson(
        serializer.fromJson<String>(json['kind']),
      ),
      uri: serializer.fromJson<String?>(json['uri']),
      bytes: serializer.fromJson<Uint8List?>(json['bytes']),
      mimeType: serializer.fromJson<String?>(json['mimeType']),
      sortOrder: serializer.fromJson<int>(json['sortOrder']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'parentType': serializer.toJson<String>(
        $AttachmentsTable.$converterparentType.toJson(parentType),
      ),
      'parentId': serializer.toJson<String>(parentId),
      'kind': serializer.toJson<String>(
        $AttachmentsTable.$converterkind.toJson(kind),
      ),
      'uri': serializer.toJson<String?>(uri),
      'bytes': serializer.toJson<Uint8List?>(bytes),
      'mimeType': serializer.toJson<String?>(mimeType),
      'sortOrder': serializer.toJson<int>(sortOrder),
    };
  }

  Attachment copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    ParentType? parentType,
    String? parentId,
    AttachmentKind? kind,
    Value<String?> uri = const Value.absent(),
    Value<Uint8List?> bytes = const Value.absent(),
    Value<String?> mimeType = const Value.absent(),
    int? sortOrder,
  }) => Attachment(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    parentType: parentType ?? this.parentType,
    parentId: parentId ?? this.parentId,
    kind: kind ?? this.kind,
    uri: uri.present ? uri.value : this.uri,
    bytes: bytes.present ? bytes.value : this.bytes,
    mimeType: mimeType.present ? mimeType.value : this.mimeType,
    sortOrder: sortOrder ?? this.sortOrder,
  );
  Attachment copyWithCompanion(AttachmentsCompanion data) {
    return Attachment(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      parentType: data.parentType.present
          ? data.parentType.value
          : this.parentType,
      parentId: data.parentId.present ? data.parentId.value : this.parentId,
      kind: data.kind.present ? data.kind.value : this.kind,
      uri: data.uri.present ? data.uri.value : this.uri,
      bytes: data.bytes.present ? data.bytes.value : this.bytes,
      mimeType: data.mimeType.present ? data.mimeType.value : this.mimeType,
      sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Attachment(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('parentType: $parentType, ')
          ..write('parentId: $parentId, ')
          ..write('kind: $kind, ')
          ..write('uri: $uri, ')
          ..write('bytes: $bytes, ')
          ..write('mimeType: $mimeType, ')
          ..write('sortOrder: $sortOrder')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    parentType,
    parentId,
    kind,
    uri,
    $driftBlobEquality.hash(bytes),
    mimeType,
    sortOrder,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Attachment &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.parentType == this.parentType &&
          other.parentId == this.parentId &&
          other.kind == this.kind &&
          other.uri == this.uri &&
          $driftBlobEquality.equals(other.bytes, this.bytes) &&
          other.mimeType == this.mimeType &&
          other.sortOrder == this.sortOrder);
}

class AttachmentsCompanion extends UpdateCompanion<Attachment> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<ParentType> parentType;
  final Value<String> parentId;
  final Value<AttachmentKind> kind;
  final Value<String?> uri;
  final Value<Uint8List?> bytes;
  final Value<String?> mimeType;
  final Value<int> sortOrder;
  final Value<int> rowid;
  const AttachmentsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.parentType = const Value.absent(),
    this.parentId = const Value.absent(),
    this.kind = const Value.absent(),
    this.uri = const Value.absent(),
    this.bytes = const Value.absent(),
    this.mimeType = const Value.absent(),
    this.sortOrder = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  AttachmentsCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required ParentType parentType,
    required String parentId,
    required AttachmentKind kind,
    this.uri = const Value.absent(),
    this.bytes = const Value.absent(),
    this.mimeType = const Value.absent(),
    this.sortOrder = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       parentType = Value(parentType),
       parentId = Value(parentId),
       kind = Value(kind);
  static Insertable<Attachment> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? parentType,
    Expression<String>? parentId,
    Expression<String>? kind,
    Expression<String>? uri,
    Expression<Uint8List>? bytes,
    Expression<String>? mimeType,
    Expression<int>? sortOrder,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (parentType != null) 'parent_type': parentType,
      if (parentId != null) 'parent_id': parentId,
      if (kind != null) 'kind': kind,
      if (uri != null) 'uri': uri,
      if (bytes != null) 'bytes': bytes,
      if (mimeType != null) 'mime_type': mimeType,
      if (sortOrder != null) 'sort_order': sortOrder,
      if (rowid != null) 'rowid': rowid,
    });
  }

  AttachmentsCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<ParentType>? parentType,
    Value<String>? parentId,
    Value<AttachmentKind>? kind,
    Value<String?>? uri,
    Value<Uint8List?>? bytes,
    Value<String?>? mimeType,
    Value<int>? sortOrder,
    Value<int>? rowid,
  }) {
    return AttachmentsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      parentType: parentType ?? this.parentType,
      parentId: parentId ?? this.parentId,
      kind: kind ?? this.kind,
      uri: uri ?? this.uri,
      bytes: bytes ?? this.bytes,
      mimeType: mimeType ?? this.mimeType,
      sortOrder: sortOrder ?? this.sortOrder,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (parentType.present) {
      map['parent_type'] = Variable<String>(
        $AttachmentsTable.$converterparentType.toSql(parentType.value),
      );
    }
    if (parentId.present) {
      map['parent_id'] = Variable<String>(parentId.value);
    }
    if (kind.present) {
      map['kind'] = Variable<String>(
        $AttachmentsTable.$converterkind.toSql(kind.value),
      );
    }
    if (uri.present) {
      map['uri'] = Variable<String>(uri.value);
    }
    if (bytes.present) {
      map['bytes'] = Variable<Uint8List>(bytes.value);
    }
    if (mimeType.present) {
      map['mime_type'] = Variable<String>(mimeType.value);
    }
    if (sortOrder.present) {
      map['sort_order'] = Variable<int>(sortOrder.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('AttachmentsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('parentType: $parentType, ')
          ..write('parentId: $parentId, ')
          ..write('kind: $kind, ')
          ..write('uri: $uri, ')
          ..write('bytes: $bytes, ')
          ..write('mimeType: $mimeType, ')
          ..write('sortOrder: $sortOrder, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ExternalLinksTable extends ExternalLinks
    with TableInfo<$ExternalLinksTable, ExternalLink> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ExternalLinksTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _idMeta = const VerificationMeta('id');
  @override
  late final GeneratedColumn<String> id = GeneratedColumn<String>(
    'id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<String> updatedAt = GeneratedColumn<String>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthorMeta = const VerificationMeta(
    'lastAuthor',
  );
  @override
  late final GeneratedColumn<String> lastAuthor = GeneratedColumn<String>(
    'last_author',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isDeletedMeta = const VerificationMeta(
    'isDeleted',
  );
  @override
  late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
    'is_deleted',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_deleted" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _schemaRowVersionMeta = const VerificationMeta(
    'schemaRowVersion',
  );
  @override
  late final GeneratedColumn<int> schemaRowVersion = GeneratedColumn<int>(
    'schema_row_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  @override
  late final GeneratedColumnWithTypeConverter<ParentType, String> parentType =
      GeneratedColumn<String>(
        'parent_type',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      ).withConverter<ParentType>($ExternalLinksTable.$converterparentType);
  static const VerificationMeta _parentIdMeta = const VerificationMeta(
    'parentId',
  );
  @override
  late final GeneratedColumn<String> parentId = GeneratedColumn<String>(
    'parent_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _urlMeta = const VerificationMeta('url');
  @override
  late final GeneratedColumn<String> url = GeneratedColumn<String>(
    'url',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _titleMeta = const VerificationMeta('title');
  @override
  late final GeneratedColumn<String> title = GeneratedColumn<String>(
    'title',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    parentType,
    parentId,
    url,
    title,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'external_links';
  @override
  VerificationContext validateIntegrity(
    Insertable<ExternalLink> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    } else if (isInserting) {
      context.missing(_idMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('updated_at')) {
      context.handle(
        _updatedAtMeta,
        updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_updatedAtMeta);
    }
    if (data.containsKey('last_author')) {
      context.handle(
        _lastAuthorMeta,
        lastAuthor.isAcceptableOrUnknown(data['last_author']!, _lastAuthorMeta),
      );
    } else if (isInserting) {
      context.missing(_lastAuthorMeta);
    }
    if (data.containsKey('is_deleted')) {
      context.handle(
        _isDeletedMeta,
        isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
      );
    }
    if (data.containsKey('schema_row_version')) {
      context.handle(
        _schemaRowVersionMeta,
        schemaRowVersion.isAcceptableOrUnknown(
          data['schema_row_version']!,
          _schemaRowVersionMeta,
        ),
      );
    }
    if (data.containsKey('parent_id')) {
      context.handle(
        _parentIdMeta,
        parentId.isAcceptableOrUnknown(data['parent_id']!, _parentIdMeta),
      );
    } else if (isInserting) {
      context.missing(_parentIdMeta);
    }
    if (data.containsKey('url')) {
      context.handle(
        _urlMeta,
        url.isAcceptableOrUnknown(data['url']!, _urlMeta),
      );
    } else if (isInserting) {
      context.missing(_urlMeta);
    }
    if (data.containsKey('title')) {
      context.handle(
        _titleMeta,
        title.isAcceptableOrUnknown(data['title']!, _titleMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ExternalLink map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ExternalLink(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}last_author'],
      )!,
      isDeleted: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_deleted'],
      )!,
      schemaRowVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_row_version'],
      )!,
      parentType: $ExternalLinksTable.$converterparentType.fromSql(
        attachedDatabase.typeMapping.read(
          DriftSqlType.string,
          data['${effectivePrefix}parent_type'],
        )!,
      ),
      parentId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}parent_id'],
      )!,
      url: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}url'],
      )!,
      title: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}title'],
      ),
    );
  }

  @override
  $ExternalLinksTable createAlias(String alias) {
    return $ExternalLinksTable(attachedDatabase, alias);
  }

  static JsonTypeConverter2<ParentType, String, String> $converterparentType =
      const EnumNameConverter<ParentType>(ParentType.values);
}

class ExternalLink extends DataClass implements Insertable<ExternalLink> {
  final String id;
  final int createdAt;
  final String updatedAt;
  final String lastAuthor;
  final bool isDeleted;
  final int schemaRowVersion;
  final ParentType parentType;
  final String parentId;
  final String url;
  final String? title;
  const ExternalLink({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    required this.lastAuthor,
    required this.isDeleted,
    required this.schemaRowVersion,
    required this.parentType,
    required this.parentId,
    required this.url,
    this.title,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<int>(createdAt);
    map['updated_at'] = Variable<String>(updatedAt);
    map['last_author'] = Variable<String>(lastAuthor);
    map['is_deleted'] = Variable<bool>(isDeleted);
    map['schema_row_version'] = Variable<int>(schemaRowVersion);
    {
      map['parent_type'] = Variable<String>(
        $ExternalLinksTable.$converterparentType.toSql(parentType),
      );
    }
    map['parent_id'] = Variable<String>(parentId);
    map['url'] = Variable<String>(url);
    if (!nullToAbsent || title != null) {
      map['title'] = Variable<String>(title);
    }
    return map;
  }

  ExternalLinksCompanion toCompanion(bool nullToAbsent) {
    return ExternalLinksCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthor: Value(lastAuthor),
      isDeleted: Value(isDeleted),
      schemaRowVersion: Value(schemaRowVersion),
      parentType: Value(parentType),
      parentId: Value(parentId),
      url: Value(url),
      title: title == null && nullToAbsent
          ? const Value.absent()
          : Value(title),
    );
  }

  factory ExternalLink.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ExternalLink(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
      updatedAt: serializer.fromJson<String>(json['updatedAt']),
      lastAuthor: serializer.fromJson<String>(json['lastAuthor']),
      isDeleted: serializer.fromJson<bool>(json['isDeleted']),
      schemaRowVersion: serializer.fromJson<int>(json['schemaRowVersion']),
      parentType: $ExternalLinksTable.$converterparentType.fromJson(
        serializer.fromJson<String>(json['parentType']),
      ),
      parentId: serializer.fromJson<String>(json['parentId']),
      url: serializer.fromJson<String>(json['url']),
      title: serializer.fromJson<String?>(json['title']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<int>(createdAt),
      'updatedAt': serializer.toJson<String>(updatedAt),
      'lastAuthor': serializer.toJson<String>(lastAuthor),
      'isDeleted': serializer.toJson<bool>(isDeleted),
      'schemaRowVersion': serializer.toJson<int>(schemaRowVersion),
      'parentType': serializer.toJson<String>(
        $ExternalLinksTable.$converterparentType.toJson(parentType),
      ),
      'parentId': serializer.toJson<String>(parentId),
      'url': serializer.toJson<String>(url),
      'title': serializer.toJson<String?>(title),
    };
  }

  ExternalLink copyWith({
    String? id,
    int? createdAt,
    String? updatedAt,
    String? lastAuthor,
    bool? isDeleted,
    int? schemaRowVersion,
    ParentType? parentType,
    String? parentId,
    String? url,
    Value<String?> title = const Value.absent(),
  }) => ExternalLink(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthor: lastAuthor ?? this.lastAuthor,
    isDeleted: isDeleted ?? this.isDeleted,
    schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
    parentType: parentType ?? this.parentType,
    parentId: parentId ?? this.parentId,
    url: url ?? this.url,
    title: title.present ? title.value : this.title,
  );
  ExternalLink copyWithCompanion(ExternalLinksCompanion data) {
    return ExternalLink(
      id: data.id.present ? data.id.value : this.id,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthor: data.lastAuthor.present
          ? data.lastAuthor.value
          : this.lastAuthor,
      isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
      schemaRowVersion: data.schemaRowVersion.present
          ? data.schemaRowVersion.value
          : this.schemaRowVersion,
      parentType: data.parentType.present
          ? data.parentType.value
          : this.parentType,
      parentId: data.parentId.present ? data.parentId.value : this.parentId,
      url: data.url.present ? data.url.value : this.url,
      title: data.title.present ? data.title.value : this.title,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ExternalLink(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('parentType: $parentType, ')
          ..write('parentId: $parentId, ')
          ..write('url: $url, ')
          ..write('title: $title')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    lastAuthor,
    isDeleted,
    schemaRowVersion,
    parentType,
    parentId,
    url,
    title,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ExternalLink &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthor == this.lastAuthor &&
          other.isDeleted == this.isDeleted &&
          other.schemaRowVersion == this.schemaRowVersion &&
          other.parentType == this.parentType &&
          other.parentId == this.parentId &&
          other.url == this.url &&
          other.title == this.title);
}

class ExternalLinksCompanion extends UpdateCompanion<ExternalLink> {
  final Value<String> id;
  final Value<int> createdAt;
  final Value<String> updatedAt;
  final Value<String> lastAuthor;
  final Value<bool> isDeleted;
  final Value<int> schemaRowVersion;
  final Value<ParentType> parentType;
  final Value<String> parentId;
  final Value<String> url;
  final Value<String?> title;
  final Value<int> rowid;
  const ExternalLinksCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthor = const Value.absent(),
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    this.parentType = const Value.absent(),
    this.parentId = const Value.absent(),
    this.url = const Value.absent(),
    this.title = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ExternalLinksCompanion.insert({
    required String id,
    required int createdAt,
    required String updatedAt,
    required String lastAuthor,
    this.isDeleted = const Value.absent(),
    this.schemaRowVersion = const Value.absent(),
    required ParentType parentType,
    required String parentId,
    required String url,
    this.title = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       lastAuthor = Value(lastAuthor),
       parentType = Value(parentType),
       parentId = Value(parentId),
       url = Value(url);
  static Insertable<ExternalLink> custom({
    Expression<String>? id,
    Expression<int>? createdAt,
    Expression<String>? updatedAt,
    Expression<String>? lastAuthor,
    Expression<bool>? isDeleted,
    Expression<int>? schemaRowVersion,
    Expression<String>? parentType,
    Expression<String>? parentId,
    Expression<String>? url,
    Expression<String>? title,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthor != null) 'last_author': lastAuthor,
      if (isDeleted != null) 'is_deleted': isDeleted,
      if (schemaRowVersion != null) 'schema_row_version': schemaRowVersion,
      if (parentType != null) 'parent_type': parentType,
      if (parentId != null) 'parent_id': parentId,
      if (url != null) 'url': url,
      if (title != null) 'title': title,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ExternalLinksCompanion copyWith({
    Value<String>? id,
    Value<int>? createdAt,
    Value<String>? updatedAt,
    Value<String>? lastAuthor,
    Value<bool>? isDeleted,
    Value<int>? schemaRowVersion,
    Value<ParentType>? parentType,
    Value<String>? parentId,
    Value<String>? url,
    Value<String?>? title,
    Value<int>? rowid,
  }) {
    return ExternalLinksCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthor: lastAuthor ?? this.lastAuthor,
      isDeleted: isDeleted ?? this.isDeleted,
      schemaRowVersion: schemaRowVersion ?? this.schemaRowVersion,
      parentType: parentType ?? this.parentType,
      parentId: parentId ?? this.parentId,
      url: url ?? this.url,
      title: title ?? this.title,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<String>(id.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<String>(updatedAt.value);
    }
    if (lastAuthor.present) {
      map['last_author'] = Variable<String>(lastAuthor.value);
    }
    if (isDeleted.present) {
      map['is_deleted'] = Variable<bool>(isDeleted.value);
    }
    if (schemaRowVersion.present) {
      map['schema_row_version'] = Variable<int>(schemaRowVersion.value);
    }
    if (parentType.present) {
      map['parent_type'] = Variable<String>(
        $ExternalLinksTable.$converterparentType.toSql(parentType.value),
      );
    }
    if (parentId.present) {
      map['parent_id'] = Variable<String>(parentId.value);
    }
    if (url.present) {
      map['url'] = Variable<String>(url.value);
    }
    if (title.present) {
      map['title'] = Variable<String>(title.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ExternalLinksCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthor: $lastAuthor, ')
          ..write('isDeleted: $isDeleted, ')
          ..write('schemaRowVersion: $schemaRowVersion, ')
          ..write('parentType: $parentType, ')
          ..write('parentId: $parentId, ')
          ..write('url: $url, ')
          ..write('title: $title, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

abstract class _$AppDatabase extends GeneratedDatabase {
  _$AppDatabase(QueryExecutor e) : super(e);
  $AppDatabaseManager get managers => $AppDatabaseManager(this);
  late final $VarietiesTable varieties = $VarietiesTable(this);
  late final $VarietyVernacularNamesTable varietyVernacularNames =
      $VarietyVernacularNamesTable(this);
  late final $SpeciesTable species = $SpeciesTable(this);
  late final $SpeciesCommonNamesTable speciesCommonNames =
      $SpeciesCommonNamesTable(this);
  late final $LotsTable lots = $LotsTable(this);
  late final $GerminationTestsTable germinationTests = $GerminationTestsTable(
    this,
  );
  late final $ConditionChecksTable conditionChecks = $ConditionChecksTable(
    this,
  );
  late final $MovementsTable movements = $MovementsTable(this);
  late final $PartiesTable parties = $PartiesTable(this);
  late final $AttachmentsTable attachments = $AttachmentsTable(this);
  late final $ExternalLinksTable externalLinks = $ExternalLinksTable(this);
  @override
  Iterable<TableInfo<Table, Object?>> get allTables =>
      allSchemaEntities.whereType<TableInfo<Table, Object?>>();
  @override
  List<DatabaseSchemaEntity> get allSchemaEntities => [
    varieties,
    varietyVernacularNames,
    species,
    speciesCommonNames,
    lots,
    germinationTests,
    conditionChecks,
    movements,
    parties,
    attachments,
    externalLinks,
  ];
}

typedef $$VarietiesTableCreateCompanionBuilder =
    VarietiesCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String label,
      Value<String?> speciesId,
      Value<String?> cultivarName,
      Value<String?> category,
      Value<String?> notes,
      Value<bool> isDraft,
      Value<bool> isOrganic,
      Value<bool> needsReproduction,
      Value<int?> sowMonths,
      Value<int?> transplantMonths,
      Value<int?> floweringMonths,
      Value<int?> fruitingMonths,
      Value<int?> seedHarvestMonths,
      Value<int> rowid,
    });
typedef $$VarietiesTableUpdateCompanionBuilder =
    VarietiesCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> label,
      Value<String?> speciesId,
      Value<String?> cultivarName,
      Value<String?> category,
      Value<String?> notes,
      Value<bool> isDraft,
      Value<bool> isOrganic,
      Value<bool> needsReproduction,
      Value<int?> sowMonths,
      Value<int?> transplantMonths,
      Value<int?> floweringMonths,
      Value<int?> fruitingMonths,
      Value<int?> seedHarvestMonths,
      Value<int> rowid,
    });

class $$VarietiesTableFilterComposer
    extends Composer<_$AppDatabase, $VarietiesTable> {
  $$VarietiesTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get label => $composableBuilder(
    column: $table.label,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get speciesId => $composableBuilder(
    column: $table.speciesId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get cultivarName => $composableBuilder(
    column: $table.cultivarName,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get category => $composableBuilder(
    column: $table.category,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDraft => $composableBuilder(
    column: $table.isDraft,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isOrganic => $composableBuilder(
    column: $table.isOrganic,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get needsReproduction => $composableBuilder(
    column: $table.needsReproduction,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get sowMonths => $composableBuilder(
    column: $table.sowMonths,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get transplantMonths => $composableBuilder(
    column: $table.transplantMonths,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get floweringMonths => $composableBuilder(
    column: $table.floweringMonths,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get fruitingMonths => $composableBuilder(
    column: $table.fruitingMonths,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get seedHarvestMonths => $composableBuilder(
    column: $table.seedHarvestMonths,
    builder: (column) => ColumnFilters(column),
  );
}

class $$VarietiesTableOrderingComposer
    extends Composer<_$AppDatabase, $VarietiesTable> {
  $$VarietiesTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get label => $composableBuilder(
    column: $table.label,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get speciesId => $composableBuilder(
    column: $table.speciesId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get cultivarName => $composableBuilder(
    column: $table.cultivarName,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get category => $composableBuilder(
    column: $table.category,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDraft => $composableBuilder(
    column: $table.isDraft,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isOrganic => $composableBuilder(
    column: $table.isOrganic,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get needsReproduction => $composableBuilder(
    column: $table.needsReproduction,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get sowMonths => $composableBuilder(
    column: $table.sowMonths,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get transplantMonths => $composableBuilder(
    column: $table.transplantMonths,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get floweringMonths => $composableBuilder(
    column: $table.floweringMonths,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get fruitingMonths => $composableBuilder(
    column: $table.fruitingMonths,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get seedHarvestMonths => $composableBuilder(
    column: $table.seedHarvestMonths,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$VarietiesTableAnnotationComposer
    extends Composer<_$AppDatabase, $VarietiesTable> {
  $$VarietiesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get label =>
      $composableBuilder(column: $table.label, builder: (column) => column);

  GeneratedColumn<String> get speciesId =>
      $composableBuilder(column: $table.speciesId, builder: (column) => column);

  GeneratedColumn<String> get cultivarName => $composableBuilder(
    column: $table.cultivarName,
    builder: (column) => column,
  );

  GeneratedColumn<String> get category =>
      $composableBuilder(column: $table.category, builder: (column) => column);

  GeneratedColumn<String> get notes =>
      $composableBuilder(column: $table.notes, builder: (column) => column);

  GeneratedColumn<bool> get isDraft =>
      $composableBuilder(column: $table.isDraft, builder: (column) => column);

  GeneratedColumn<bool> get isOrganic =>
      $composableBuilder(column: $table.isOrganic, builder: (column) => column);

  GeneratedColumn<bool> get needsReproduction => $composableBuilder(
    column: $table.needsReproduction,
    builder: (column) => column,
  );

  GeneratedColumn<int> get sowMonths =>
      $composableBuilder(column: $table.sowMonths, builder: (column) => column);

  GeneratedColumn<int> get transplantMonths => $composableBuilder(
    column: $table.transplantMonths,
    builder: (column) => column,
  );

  GeneratedColumn<int> get floweringMonths => $composableBuilder(
    column: $table.floweringMonths,
    builder: (column) => column,
  );

  GeneratedColumn<int> get fruitingMonths => $composableBuilder(
    column: $table.fruitingMonths,
    builder: (column) => column,
  );

  GeneratedColumn<int> get seedHarvestMonths => $composableBuilder(
    column: $table.seedHarvestMonths,
    builder: (column) => column,
  );
}

class $$VarietiesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $VarietiesTable,
          Variety,
          $$VarietiesTableFilterComposer,
          $$VarietiesTableOrderingComposer,
          $$VarietiesTableAnnotationComposer,
          $$VarietiesTableCreateCompanionBuilder,
          $$VarietiesTableUpdateCompanionBuilder,
          (Variety, BaseReferences<_$AppDatabase, $VarietiesTable, Variety>),
          Variety,
          PrefetchHooks Function()
        > {
  $$VarietiesTableTableManager(_$AppDatabase db, $VarietiesTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$VarietiesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$VarietiesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$VarietiesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> label = const Value.absent(),
                Value<String?> speciesId = const Value.absent(),
                Value<String?> cultivarName = const Value.absent(),
                Value<String?> category = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<bool> isDraft = const Value.absent(),
                Value<bool> isOrganic = const Value.absent(),
                Value<bool> needsReproduction = const Value.absent(),
                Value<int?> sowMonths = const Value.absent(),
                Value<int?> transplantMonths = const Value.absent(),
                Value<int?> floweringMonths = const Value.absent(),
                Value<int?> fruitingMonths = const Value.absent(),
                Value<int?> seedHarvestMonths = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => VarietiesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                label: label,
                speciesId: speciesId,
                cultivarName: cultivarName,
                category: category,
                notes: notes,
                isDraft: isDraft,
                isOrganic: isOrganic,
                needsReproduction: needsReproduction,
                sowMonths: sowMonths,
                transplantMonths: transplantMonths,
                floweringMonths: floweringMonths,
                fruitingMonths: fruitingMonths,
                seedHarvestMonths: seedHarvestMonths,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String label,
                Value<String?> speciesId = const Value.absent(),
                Value<String?> cultivarName = const Value.absent(),
                Value<String?> category = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<bool> isDraft = const Value.absent(),
                Value<bool> isOrganic = const Value.absent(),
                Value<bool> needsReproduction = const Value.absent(),
                Value<int?> sowMonths = const Value.absent(),
                Value<int?> transplantMonths = const Value.absent(),
                Value<int?> floweringMonths = const Value.absent(),
                Value<int?> fruitingMonths = const Value.absent(),
                Value<int?> seedHarvestMonths = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => VarietiesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                label: label,
                speciesId: speciesId,
                cultivarName: cultivarName,
                category: category,
                notes: notes,
                isDraft: isDraft,
                isOrganic: isOrganic,
                needsReproduction: needsReproduction,
                sowMonths: sowMonths,
                transplantMonths: transplantMonths,
                floweringMonths: floweringMonths,
                fruitingMonths: fruitingMonths,
                seedHarvestMonths: seedHarvestMonths,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$VarietiesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $VarietiesTable,
      Variety,
      $$VarietiesTableFilterComposer,
      $$VarietiesTableOrderingComposer,
      $$VarietiesTableAnnotationComposer,
      $$VarietiesTableCreateCompanionBuilder,
      $$VarietiesTableUpdateCompanionBuilder,
      (Variety, BaseReferences<_$AppDatabase, $VarietiesTable, Variety>),
      Variety,
      PrefetchHooks Function()
    >;
typedef $$VarietyVernacularNamesTableCreateCompanionBuilder =
    VarietyVernacularNamesCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String varietyId,
      required String name,
      Value<String?> language,
      Value<String?> region,
      Value<int> rowid,
    });
typedef $$VarietyVernacularNamesTableUpdateCompanionBuilder =
    VarietyVernacularNamesCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> varietyId,
      Value<String> name,
      Value<String?> language,
      Value<String?> region,
      Value<int> rowid,
    });

class $$VarietyVernacularNamesTableFilterComposer
    extends Composer<_$AppDatabase, $VarietyVernacularNamesTable> {
  $$VarietyVernacularNamesTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get varietyId => $composableBuilder(
    column: $table.varietyId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get language => $composableBuilder(
    column: $table.language,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get region => $composableBuilder(
    column: $table.region,
    builder: (column) => ColumnFilters(column),
  );
}

class $$VarietyVernacularNamesTableOrderingComposer
    extends Composer<_$AppDatabase, $VarietyVernacularNamesTable> {
  $$VarietyVernacularNamesTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get varietyId => $composableBuilder(
    column: $table.varietyId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get language => $composableBuilder(
    column: $table.language,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get region => $composableBuilder(
    column: $table.region,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$VarietyVernacularNamesTableAnnotationComposer
    extends Composer<_$AppDatabase, $VarietyVernacularNamesTable> {
  $$VarietyVernacularNamesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get varietyId =>
      $composableBuilder(column: $table.varietyId, builder: (column) => column);

  GeneratedColumn<String> get name =>
      $composableBuilder(column: $table.name, builder: (column) => column);

  GeneratedColumn<String> get language =>
      $composableBuilder(column: $table.language, builder: (column) => column);

  GeneratedColumn<String> get region =>
      $composableBuilder(column: $table.region, builder: (column) => column);
}

class $$VarietyVernacularNamesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $VarietyVernacularNamesTable,
          VarietyVernacularName,
          $$VarietyVernacularNamesTableFilterComposer,
          $$VarietyVernacularNamesTableOrderingComposer,
          $$VarietyVernacularNamesTableAnnotationComposer,
          $$VarietyVernacularNamesTableCreateCompanionBuilder,
          $$VarietyVernacularNamesTableUpdateCompanionBuilder,
          (
            VarietyVernacularName,
            BaseReferences<
              _$AppDatabase,
              $VarietyVernacularNamesTable,
              VarietyVernacularName
            >,
          ),
          VarietyVernacularName,
          PrefetchHooks Function()
        > {
  $$VarietyVernacularNamesTableTableManager(
    _$AppDatabase db,
    $VarietyVernacularNamesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$VarietyVernacularNamesTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$VarietyVernacularNamesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$VarietyVernacularNamesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> varietyId = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<String?> language = const Value.absent(),
                Value<String?> region = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => VarietyVernacularNamesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                varietyId: varietyId,
                name: name,
                language: language,
                region: region,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String varietyId,
                required String name,
                Value<String?> language = const Value.absent(),
                Value<String?> region = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => VarietyVernacularNamesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                varietyId: varietyId,
                name: name,
                language: language,
                region: region,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$VarietyVernacularNamesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $VarietyVernacularNamesTable,
      VarietyVernacularName,
      $$VarietyVernacularNamesTableFilterComposer,
      $$VarietyVernacularNamesTableOrderingComposer,
      $$VarietyVernacularNamesTableAnnotationComposer,
      $$VarietyVernacularNamesTableCreateCompanionBuilder,
      $$VarietyVernacularNamesTableUpdateCompanionBuilder,
      (
        VarietyVernacularName,
        BaseReferences<
          _$AppDatabase,
          $VarietyVernacularNamesTable,
          VarietyVernacularName
        >,
      ),
      VarietyVernacularName,
      PrefetchHooks Function()
    >;
typedef $$SpeciesTableCreateCompanionBuilder =
    SpeciesCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String scientificName,
      Value<String?> wikidataQid,
      Value<int?> gbifKey,
      Value<String?> family,
      Value<bool> isBundled,
      Value<int?> viabilityYears,
      Value<int> rowid,
    });
typedef $$SpeciesTableUpdateCompanionBuilder =
    SpeciesCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> scientificName,
      Value<String?> wikidataQid,
      Value<int?> gbifKey,
      Value<String?> family,
      Value<bool> isBundled,
      Value<int?> viabilityYears,
      Value<int> rowid,
    });

class $$SpeciesTableFilterComposer
    extends Composer<_$AppDatabase, $SpeciesTable> {
  $$SpeciesTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scientificName => $composableBuilder(
    column: $table.scientificName,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get wikidataQid => $composableBuilder(
    column: $table.wikidataQid,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get gbifKey => $composableBuilder(
    column: $table.gbifKey,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get family => $composableBuilder(
    column: $table.family,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isBundled => $composableBuilder(
    column: $table.isBundled,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get viabilityYears => $composableBuilder(
    column: $table.viabilityYears,
    builder: (column) => ColumnFilters(column),
  );
}

class $$SpeciesTableOrderingComposer
    extends Composer<_$AppDatabase, $SpeciesTable> {
  $$SpeciesTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scientificName => $composableBuilder(
    column: $table.scientificName,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get wikidataQid => $composableBuilder(
    column: $table.wikidataQid,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get gbifKey => $composableBuilder(
    column: $table.gbifKey,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get family => $composableBuilder(
    column: $table.family,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isBundled => $composableBuilder(
    column: $table.isBundled,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get viabilityYears => $composableBuilder(
    column: $table.viabilityYears,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$SpeciesTableAnnotationComposer
    extends Composer<_$AppDatabase, $SpeciesTable> {
  $$SpeciesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scientificName => $composableBuilder(
    column: $table.scientificName,
    builder: (column) => column,
  );

  GeneratedColumn<String> get wikidataQid => $composableBuilder(
    column: $table.wikidataQid,
    builder: (column) => column,
  );

  GeneratedColumn<int> get gbifKey =>
      $composableBuilder(column: $table.gbifKey, builder: (column) => column);

  GeneratedColumn<String> get family =>
      $composableBuilder(column: $table.family, builder: (column) => column);

  GeneratedColumn<bool> get isBundled =>
      $composableBuilder(column: $table.isBundled, builder: (column) => column);

  GeneratedColumn<int> get viabilityYears => $composableBuilder(
    column: $table.viabilityYears,
    builder: (column) => column,
  );
}

class $$SpeciesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $SpeciesTable,
          Specy,
          $$SpeciesTableFilterComposer,
          $$SpeciesTableOrderingComposer,
          $$SpeciesTableAnnotationComposer,
          $$SpeciesTableCreateCompanionBuilder,
          $$SpeciesTableUpdateCompanionBuilder,
          (Specy, BaseReferences<_$AppDatabase, $SpeciesTable, Specy>),
          Specy,
          PrefetchHooks Function()
        > {
  $$SpeciesTableTableManager(_$AppDatabase db, $SpeciesTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$SpeciesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$SpeciesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$SpeciesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> scientificName = const Value.absent(),
                Value<String?> wikidataQid = const Value.absent(),
                Value<int?> gbifKey = const Value.absent(),
                Value<String?> family = const Value.absent(),
                Value<bool> isBundled = const Value.absent(),
                Value<int?> viabilityYears = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SpeciesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                scientificName: scientificName,
                wikidataQid: wikidataQid,
                gbifKey: gbifKey,
                family: family,
                isBundled: isBundled,
                viabilityYears: viabilityYears,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String scientificName,
                Value<String?> wikidataQid = const Value.absent(),
                Value<int?> gbifKey = const Value.absent(),
                Value<String?> family = const Value.absent(),
                Value<bool> isBundled = const Value.absent(),
                Value<int?> viabilityYears = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SpeciesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                scientificName: scientificName,
                wikidataQid: wikidataQid,
                gbifKey: gbifKey,
                family: family,
                isBundled: isBundled,
                viabilityYears: viabilityYears,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$SpeciesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $SpeciesTable,
      Specy,
      $$SpeciesTableFilterComposer,
      $$SpeciesTableOrderingComposer,
      $$SpeciesTableAnnotationComposer,
      $$SpeciesTableCreateCompanionBuilder,
      $$SpeciesTableUpdateCompanionBuilder,
      (Specy, BaseReferences<_$AppDatabase, $SpeciesTable, Specy>),
      Specy,
      PrefetchHooks Function()
    >;
typedef $$SpeciesCommonNamesTableCreateCompanionBuilder =
    SpeciesCommonNamesCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String speciesId,
      required String name,
      Value<String?> language,
      Value<int> rowid,
    });
typedef $$SpeciesCommonNamesTableUpdateCompanionBuilder =
    SpeciesCommonNamesCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> speciesId,
      Value<String> name,
      Value<String?> language,
      Value<int> rowid,
    });

class $$SpeciesCommonNamesTableFilterComposer
    extends Composer<_$AppDatabase, $SpeciesCommonNamesTable> {
  $$SpeciesCommonNamesTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get speciesId => $composableBuilder(
    column: $table.speciesId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get language => $composableBuilder(
    column: $table.language,
    builder: (column) => ColumnFilters(column),
  );
}

class $$SpeciesCommonNamesTableOrderingComposer
    extends Composer<_$AppDatabase, $SpeciesCommonNamesTable> {
  $$SpeciesCommonNamesTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get speciesId => $composableBuilder(
    column: $table.speciesId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get language => $composableBuilder(
    column: $table.language,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$SpeciesCommonNamesTableAnnotationComposer
    extends Composer<_$AppDatabase, $SpeciesCommonNamesTable> {
  $$SpeciesCommonNamesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get speciesId =>
      $composableBuilder(column: $table.speciesId, builder: (column) => column);

  GeneratedColumn<String> get name =>
      $composableBuilder(column: $table.name, builder: (column) => column);

  GeneratedColumn<String> get language =>
      $composableBuilder(column: $table.language, builder: (column) => column);
}

class $$SpeciesCommonNamesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $SpeciesCommonNamesTable,
          SpeciesCommonName,
          $$SpeciesCommonNamesTableFilterComposer,
          $$SpeciesCommonNamesTableOrderingComposer,
          $$SpeciesCommonNamesTableAnnotationComposer,
          $$SpeciesCommonNamesTableCreateCompanionBuilder,
          $$SpeciesCommonNamesTableUpdateCompanionBuilder,
          (
            SpeciesCommonName,
            BaseReferences<
              _$AppDatabase,
              $SpeciesCommonNamesTable,
              SpeciesCommonName
            >,
          ),
          SpeciesCommonName,
          PrefetchHooks Function()
        > {
  $$SpeciesCommonNamesTableTableManager(
    _$AppDatabase db,
    $SpeciesCommonNamesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$SpeciesCommonNamesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$SpeciesCommonNamesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$SpeciesCommonNamesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> speciesId = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<String?> language = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SpeciesCommonNamesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                speciesId: speciesId,
                name: name,
                language: language,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String speciesId,
                required String name,
                Value<String?> language = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SpeciesCommonNamesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                speciesId: speciesId,
                name: name,
                language: language,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$SpeciesCommonNamesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $SpeciesCommonNamesTable,
      SpeciesCommonName,
      $$SpeciesCommonNamesTableFilterComposer,
      $$SpeciesCommonNamesTableOrderingComposer,
      $$SpeciesCommonNamesTableAnnotationComposer,
      $$SpeciesCommonNamesTableCreateCompanionBuilder,
      $$SpeciesCommonNamesTableUpdateCompanionBuilder,
      (
        SpeciesCommonName,
        BaseReferences<
          _$AppDatabase,
          $SpeciesCommonNamesTable,
          SpeciesCommonName
        >,
      ),
      SpeciesCommonName,
      PrefetchHooks Function()
    >;
typedef $$LotsTableCreateCompanionBuilder =
    LotsCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String varietyId,
      Value<LotType> type,
      Value<int?> harvestYear,
      Value<int?> harvestMonth,
      Value<String?> quantityKind,
      Value<double?> quantityPrecise,
      Value<String?> quantityLabel,
      Value<Presentation?> presentation,
      Value<String?> storageLocation,
      Value<OfferStatus> offerStatus,
      Value<String?> seedbankId,
      Value<String?> originName,
      Value<String?> originPlace,
      Value<Abundance?> abundance,
      Value<PreservationFormat?> preservationFormat,
      Value<int> rowid,
    });
typedef $$LotsTableUpdateCompanionBuilder =
    LotsCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> varietyId,
      Value<LotType> type,
      Value<int?> harvestYear,
      Value<int?> harvestMonth,
      Value<String?> quantityKind,
      Value<double?> quantityPrecise,
      Value<String?> quantityLabel,
      Value<Presentation?> presentation,
      Value<String?> storageLocation,
      Value<OfferStatus> offerStatus,
      Value<String?> seedbankId,
      Value<String?> originName,
      Value<String?> originPlace,
      Value<Abundance?> abundance,
      Value<PreservationFormat?> preservationFormat,
      Value<int> rowid,
    });

class $$LotsTableFilterComposer extends Composer<_$AppDatabase, $LotsTable> {
  $$LotsTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get varietyId => $composableBuilder(
    column: $table.varietyId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<LotType, LotType, String> get type =>
      $composableBuilder(
        column: $table.type,
        builder: (column) => ColumnWithTypeConverterFilters(column),
      );

  ColumnFilters<int> get harvestYear => $composableBuilder(
    column: $table.harvestYear,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get harvestMonth => $composableBuilder(
    column: $table.harvestMonth,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<Presentation?, Presentation, String>
  get presentation => $composableBuilder(
    column: $table.presentation,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get storageLocation => $composableBuilder(
    column: $table.storageLocation,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<OfferStatus, OfferStatus, String>
  get offerStatus => $composableBuilder(
    column: $table.offerStatus,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get seedbankId => $composableBuilder(
    column: $table.seedbankId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originName => $composableBuilder(
    column: $table.originName,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originPlace => $composableBuilder(
    column: $table.originPlace,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<Abundance?, Abundance, String> get abundance =>
      $composableBuilder(
        column: $table.abundance,
        builder: (column) => ColumnWithTypeConverterFilters(column),
      );

  ColumnWithTypeConverterFilters<
    PreservationFormat?,
    PreservationFormat,
    String
  >
  get preservationFormat => $composableBuilder(
    column: $table.preservationFormat,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );
}

class $$LotsTableOrderingComposer extends Composer<_$AppDatabase, $LotsTable> {
  $$LotsTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get varietyId => $composableBuilder(
    column: $table.varietyId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get type => $composableBuilder(
    column: $table.type,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get harvestYear => $composableBuilder(
    column: $table.harvestYear,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get harvestMonth => $composableBuilder(
    column: $table.harvestMonth,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get presentation => $composableBuilder(
    column: $table.presentation,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get storageLocation => $composableBuilder(
    column: $table.storageLocation,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get offerStatus => $composableBuilder(
    column: $table.offerStatus,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get seedbankId => $composableBuilder(
    column: $table.seedbankId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originName => $composableBuilder(
    column: $table.originName,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originPlace => $composableBuilder(
    column: $table.originPlace,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get abundance => $composableBuilder(
    column: $table.abundance,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get preservationFormat => $composableBuilder(
    column: $table.preservationFormat,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$LotsTableAnnotationComposer
    extends Composer<_$AppDatabase, $LotsTable> {
  $$LotsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get varietyId =>
      $composableBuilder(column: $table.varietyId, builder: (column) => column);

  GeneratedColumnWithTypeConverter<LotType, String> get type =>
      $composableBuilder(column: $table.type, builder: (column) => column);

  GeneratedColumn<int> get harvestYear => $composableBuilder(
    column: $table.harvestYear,
    builder: (column) => column,
  );

  GeneratedColumn<int> get harvestMonth => $composableBuilder(
    column: $table.harvestMonth,
    builder: (column) => column,
  );

  GeneratedColumn<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => column,
  );

  GeneratedColumn<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => column,
  );

  GeneratedColumn<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<Presentation?, String> get presentation =>
      $composableBuilder(
        column: $table.presentation,
        builder: (column) => column,
      );

  GeneratedColumn<String> get storageLocation => $composableBuilder(
    column: $table.storageLocation,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<OfferStatus, String> get offerStatus =>
      $composableBuilder(
        column: $table.offerStatus,
        builder: (column) => column,
      );

  GeneratedColumn<String> get seedbankId => $composableBuilder(
    column: $table.seedbankId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originName => $composableBuilder(
    column: $table.originName,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originPlace => $composableBuilder(
    column: $table.originPlace,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<Abundance?, String> get abundance =>
      $composableBuilder(column: $table.abundance, builder: (column) => column);

  GeneratedColumnWithTypeConverter<PreservationFormat?, String>
  get preservationFormat => $composableBuilder(
    column: $table.preservationFormat,
    builder: (column) => column,
  );
}

class $$LotsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $LotsTable,
          Lot,
          $$LotsTableFilterComposer,
          $$LotsTableOrderingComposer,
          $$LotsTableAnnotationComposer,
          $$LotsTableCreateCompanionBuilder,
          $$LotsTableUpdateCompanionBuilder,
          (Lot, BaseReferences<_$AppDatabase, $LotsTable, Lot>),
          Lot,
          PrefetchHooks Function()
        > {
  $$LotsTableTableManager(_$AppDatabase db, $LotsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$LotsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$LotsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$LotsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> varietyId = const Value.absent(),
                Value<LotType> type = const Value.absent(),
                Value<int?> harvestYear = const Value.absent(),
                Value<int?> harvestMonth = const Value.absent(),
                Value<String?> quantityKind = const Value.absent(),
                Value<double?> quantityPrecise = const Value.absent(),
                Value<String?> quantityLabel = const Value.absent(),
                Value<Presentation?> presentation = const Value.absent(),
                Value<String?> storageLocation = const Value.absent(),
                Value<OfferStatus> offerStatus = const Value.absent(),
                Value<String?> seedbankId = const Value.absent(),
                Value<String?> originName = const Value.absent(),
                Value<String?> originPlace = const Value.absent(),
                Value<Abundance?> abundance = const Value.absent(),
                Value<PreservationFormat?> preservationFormat =
                    const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => LotsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                varietyId: varietyId,
                type: type,
                harvestYear: harvestYear,
                harvestMonth: harvestMonth,
                quantityKind: quantityKind,
                quantityPrecise: quantityPrecise,
                quantityLabel: quantityLabel,
                presentation: presentation,
                storageLocation: storageLocation,
                offerStatus: offerStatus,
                seedbankId: seedbankId,
                originName: originName,
                originPlace: originPlace,
                abundance: abundance,
                preservationFormat: preservationFormat,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String varietyId,
                Value<LotType> type = const Value.absent(),
                Value<int?> harvestYear = const Value.absent(),
                Value<int?> harvestMonth = const Value.absent(),
                Value<String?> quantityKind = const Value.absent(),
                Value<double?> quantityPrecise = const Value.absent(),
                Value<String?> quantityLabel = const Value.absent(),
                Value<Presentation?> presentation = const Value.absent(),
                Value<String?> storageLocation = const Value.absent(),
                Value<OfferStatus> offerStatus = const Value.absent(),
                Value<String?> seedbankId = const Value.absent(),
                Value<String?> originName = const Value.absent(),
                Value<String?> originPlace = const Value.absent(),
                Value<Abundance?> abundance = const Value.absent(),
                Value<PreservationFormat?> preservationFormat =
                    const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => LotsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                varietyId: varietyId,
                type: type,
                harvestYear: harvestYear,
                harvestMonth: harvestMonth,
                quantityKind: quantityKind,
                quantityPrecise: quantityPrecise,
                quantityLabel: quantityLabel,
                presentation: presentation,
                storageLocation: storageLocation,
                offerStatus: offerStatus,
                seedbankId: seedbankId,
                originName: originName,
                originPlace: originPlace,
                abundance: abundance,
                preservationFormat: preservationFormat,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$LotsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $LotsTable,
      Lot,
      $$LotsTableFilterComposer,
      $$LotsTableOrderingComposer,
      $$LotsTableAnnotationComposer,
      $$LotsTableCreateCompanionBuilder,
      $$LotsTableUpdateCompanionBuilder,
      (Lot, BaseReferences<_$AppDatabase, $LotsTable, Lot>),
      Lot,
      PrefetchHooks Function()
    >;
typedef $$GerminationTestsTableCreateCompanionBuilder =
    GerminationTestsCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String lotId,
      Value<int?> testedOn,
      Value<int?> sampleSize,
      Value<int?> germinatedCount,
      Value<String?> notes,
      Value<int> rowid,
    });
typedef $$GerminationTestsTableUpdateCompanionBuilder =
    GerminationTestsCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> lotId,
      Value<int?> testedOn,
      Value<int?> sampleSize,
      Value<int?> germinatedCount,
      Value<String?> notes,
      Value<int> rowid,
    });

class $$GerminationTestsTableFilterComposer
    extends Composer<_$AppDatabase, $GerminationTestsTable> {
  $$GerminationTestsTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get testedOn => $composableBuilder(
    column: $table.testedOn,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get sampleSize => $composableBuilder(
    column: $table.sampleSize,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get germinatedCount => $composableBuilder(
    column: $table.germinatedCount,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnFilters(column),
  );
}

class $$GerminationTestsTableOrderingComposer
    extends Composer<_$AppDatabase, $GerminationTestsTable> {
  $$GerminationTestsTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get testedOn => $composableBuilder(
    column: $table.testedOn,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get sampleSize => $composableBuilder(
    column: $table.sampleSize,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get germinatedCount => $composableBuilder(
    column: $table.germinatedCount,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$GerminationTestsTableAnnotationComposer
    extends Composer<_$AppDatabase, $GerminationTestsTable> {
  $$GerminationTestsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get lotId =>
      $composableBuilder(column: $table.lotId, builder: (column) => column);

  GeneratedColumn<int> get testedOn =>
      $composableBuilder(column: $table.testedOn, builder: (column) => column);

  GeneratedColumn<int> get sampleSize => $composableBuilder(
    column: $table.sampleSize,
    builder: (column) => column,
  );

  GeneratedColumn<int> get germinatedCount => $composableBuilder(
    column: $table.germinatedCount,
    builder: (column) => column,
  );

  GeneratedColumn<String> get notes =>
      $composableBuilder(column: $table.notes, builder: (column) => column);
}

class $$GerminationTestsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $GerminationTestsTable,
          GerminationTest,
          $$GerminationTestsTableFilterComposer,
          $$GerminationTestsTableOrderingComposer,
          $$GerminationTestsTableAnnotationComposer,
          $$GerminationTestsTableCreateCompanionBuilder,
          $$GerminationTestsTableUpdateCompanionBuilder,
          (
            GerminationTest,
            BaseReferences<
              _$AppDatabase,
              $GerminationTestsTable,
              GerminationTest
            >,
          ),
          GerminationTest,
          PrefetchHooks Function()
        > {
  $$GerminationTestsTableTableManager(
    _$AppDatabase db,
    $GerminationTestsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$GerminationTestsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$GerminationTestsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$GerminationTestsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> lotId = const Value.absent(),
                Value<int?> testedOn = const Value.absent(),
                Value<int?> sampleSize = const Value.absent(),
                Value<int?> germinatedCount = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => GerminationTestsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                testedOn: testedOn,
                sampleSize: sampleSize,
                germinatedCount: germinatedCount,
                notes: notes,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String lotId,
                Value<int?> testedOn = const Value.absent(),
                Value<int?> sampleSize = const Value.absent(),
                Value<int?> germinatedCount = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => GerminationTestsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                testedOn: testedOn,
                sampleSize: sampleSize,
                germinatedCount: germinatedCount,
                notes: notes,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$GerminationTestsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $GerminationTestsTable,
      GerminationTest,
      $$GerminationTestsTableFilterComposer,
      $$GerminationTestsTableOrderingComposer,
      $$GerminationTestsTableAnnotationComposer,
      $$GerminationTestsTableCreateCompanionBuilder,
      $$GerminationTestsTableUpdateCompanionBuilder,
      (
        GerminationTest,
        BaseReferences<_$AppDatabase, $GerminationTestsTable, GerminationTest>,
      ),
      GerminationTest,
      PrefetchHooks Function()
    >;
typedef $$ConditionChecksTableCreateCompanionBuilder =
    ConditionChecksCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String lotId,
      Value<int?> checkedOn,
      Value<int?> containerCount,
      Value<DesiccantState?> desiccantState,
      Value<String?> notes,
      Value<int> rowid,
    });
typedef $$ConditionChecksTableUpdateCompanionBuilder =
    ConditionChecksCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> lotId,
      Value<int?> checkedOn,
      Value<int?> containerCount,
      Value<DesiccantState?> desiccantState,
      Value<String?> notes,
      Value<int> rowid,
    });

class $$ConditionChecksTableFilterComposer
    extends Composer<_$AppDatabase, $ConditionChecksTable> {
  $$ConditionChecksTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get checkedOn => $composableBuilder(
    column: $table.checkedOn,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get containerCount => $composableBuilder(
    column: $table.containerCount,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<DesiccantState?, DesiccantState, String>
  get desiccantState => $composableBuilder(
    column: $table.desiccantState,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnFilters(column),
  );
}

class $$ConditionChecksTableOrderingComposer
    extends Composer<_$AppDatabase, $ConditionChecksTable> {
  $$ConditionChecksTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get checkedOn => $composableBuilder(
    column: $table.checkedOn,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get containerCount => $composableBuilder(
    column: $table.containerCount,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get desiccantState => $composableBuilder(
    column: $table.desiccantState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$ConditionChecksTableAnnotationComposer
    extends Composer<_$AppDatabase, $ConditionChecksTable> {
  $$ConditionChecksTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get lotId =>
      $composableBuilder(column: $table.lotId, builder: (column) => column);

  GeneratedColumn<int> get checkedOn =>
      $composableBuilder(column: $table.checkedOn, builder: (column) => column);

  GeneratedColumn<int> get containerCount => $composableBuilder(
    column: $table.containerCount,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<DesiccantState?, String>
  get desiccantState => $composableBuilder(
    column: $table.desiccantState,
    builder: (column) => column,
  );

  GeneratedColumn<String> get notes =>
      $composableBuilder(column: $table.notes, builder: (column) => column);
}

class $$ConditionChecksTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ConditionChecksTable,
          ConditionCheck,
          $$ConditionChecksTableFilterComposer,
          $$ConditionChecksTableOrderingComposer,
          $$ConditionChecksTableAnnotationComposer,
          $$ConditionChecksTableCreateCompanionBuilder,
          $$ConditionChecksTableUpdateCompanionBuilder,
          (
            ConditionCheck,
            BaseReferences<
              _$AppDatabase,
              $ConditionChecksTable,
              ConditionCheck
            >,
          ),
          ConditionCheck,
          PrefetchHooks Function()
        > {
  $$ConditionChecksTableTableManager(
    _$AppDatabase db,
    $ConditionChecksTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ConditionChecksTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ConditionChecksTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ConditionChecksTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> lotId = const Value.absent(),
                Value<int?> checkedOn = const Value.absent(),
                Value<int?> containerCount = const Value.absent(),
                Value<DesiccantState?> desiccantState = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ConditionChecksCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                checkedOn: checkedOn,
                containerCount: containerCount,
                desiccantState: desiccantState,
                notes: notes,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String lotId,
                Value<int?> checkedOn = const Value.absent(),
                Value<int?> containerCount = const Value.absent(),
                Value<DesiccantState?> desiccantState = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ConditionChecksCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                checkedOn: checkedOn,
                containerCount: containerCount,
                desiccantState: desiccantState,
                notes: notes,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$ConditionChecksTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ConditionChecksTable,
      ConditionCheck,
      $$ConditionChecksTableFilterComposer,
      $$ConditionChecksTableOrderingComposer,
      $$ConditionChecksTableAnnotationComposer,
      $$ConditionChecksTableCreateCompanionBuilder,
      $$ConditionChecksTableUpdateCompanionBuilder,
      (
        ConditionCheck,
        BaseReferences<_$AppDatabase, $ConditionChecksTable, ConditionCheck>,
      ),
      ConditionCheck,
      PrefetchHooks Function()
    >;
typedef $$MovementsTableCreateCompanionBuilder =
    MovementsCompanion Function({
      required String id,
      required int createdAt,
      required String lastAuthor,
      Value<int> schemaRowVersion,
      required String lotId,
      required MovementType type,
      Value<int?> occurredOn,
      Value<String?> counterpartyId,
      Value<String?> quantityKind,
      Value<double?> quantityPrecise,
      Value<String?> quantityLabel,
      Value<String?> parentMovementId,
      Value<String?> plantareId,
      Value<String?> notes,
      Value<int> rowid,
    });
typedef $$MovementsTableUpdateCompanionBuilder =
    MovementsCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> lastAuthor,
      Value<int> schemaRowVersion,
      Value<String> lotId,
      Value<MovementType> type,
      Value<int?> occurredOn,
      Value<String?> counterpartyId,
      Value<String?> quantityKind,
      Value<double?> quantityPrecise,
      Value<String?> quantityLabel,
      Value<String?> parentMovementId,
      Value<String?> plantareId,
      Value<String?> notes,
      Value<int> rowid,
    });

class $$MovementsTableFilterComposer
    extends Composer<_$AppDatabase, $MovementsTable> {
  $$MovementsTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<MovementType, MovementType, String> get type =>
      $composableBuilder(
        column: $table.type,
        builder: (column) => ColumnWithTypeConverterFilters(column),
      );

  ColumnFilters<int> get occurredOn => $composableBuilder(
    column: $table.occurredOn,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get counterpartyId => $composableBuilder(
    column: $table.counterpartyId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get parentMovementId => $composableBuilder(
    column: $table.parentMovementId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get plantareId => $composableBuilder(
    column: $table.plantareId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnFilters(column),
  );
}

class $$MovementsTableOrderingComposer
    extends Composer<_$AppDatabase, $MovementsTable> {
  $$MovementsTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lotId => $composableBuilder(
    column: $table.lotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get type => $composableBuilder(
    column: $table.type,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get occurredOn => $composableBuilder(
    column: $table.occurredOn,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get counterpartyId => $composableBuilder(
    column: $table.counterpartyId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get parentMovementId => $composableBuilder(
    column: $table.parentMovementId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get plantareId => $composableBuilder(
    column: $table.plantareId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get notes => $composableBuilder(
    column: $table.notes,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$MovementsTableAnnotationComposer
    extends Composer<_$AppDatabase, $MovementsTable> {
  $$MovementsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get lotId =>
      $composableBuilder(column: $table.lotId, builder: (column) => column);

  GeneratedColumnWithTypeConverter<MovementType, String> get type =>
      $composableBuilder(column: $table.type, builder: (column) => column);

  GeneratedColumn<int> get occurredOn => $composableBuilder(
    column: $table.occurredOn,
    builder: (column) => column,
  );

  GeneratedColumn<String> get counterpartyId => $composableBuilder(
    column: $table.counterpartyId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get quantityKind => $composableBuilder(
    column: $table.quantityKind,
    builder: (column) => column,
  );

  GeneratedColumn<double> get quantityPrecise => $composableBuilder(
    column: $table.quantityPrecise,
    builder: (column) => column,
  );

  GeneratedColumn<String> get quantityLabel => $composableBuilder(
    column: $table.quantityLabel,
    builder: (column) => column,
  );

  GeneratedColumn<String> get parentMovementId => $composableBuilder(
    column: $table.parentMovementId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get plantareId => $composableBuilder(
    column: $table.plantareId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get notes =>
      $composableBuilder(column: $table.notes, builder: (column) => column);
}

class $$MovementsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $MovementsTable,
          Movement,
          $$MovementsTableFilterComposer,
          $$MovementsTableOrderingComposer,
          $$MovementsTableAnnotationComposer,
          $$MovementsTableCreateCompanionBuilder,
          $$MovementsTableUpdateCompanionBuilder,
          (Movement, BaseReferences<_$AppDatabase, $MovementsTable, Movement>),
          Movement,
          PrefetchHooks Function()
        > {
  $$MovementsTableTableManager(_$AppDatabase db, $MovementsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$MovementsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$MovementsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$MovementsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> lotId = const Value.absent(),
                Value<MovementType> type = const Value.absent(),
                Value<int?> occurredOn = const Value.absent(),
                Value<String?> counterpartyId = const Value.absent(),
                Value<String?> quantityKind = const Value.absent(),
                Value<double?> quantityPrecise = const Value.absent(),
                Value<String?> quantityLabel = const Value.absent(),
                Value<String?> parentMovementId = const Value.absent(),
                Value<String?> plantareId = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => MovementsCompanion(
                id: id,
                createdAt: createdAt,
                lastAuthor: lastAuthor,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                type: type,
                occurredOn: occurredOn,
                counterpartyId: counterpartyId,
                quantityKind: quantityKind,
                quantityPrecise: quantityPrecise,
                quantityLabel: quantityLabel,
                parentMovementId: parentMovementId,
                plantareId: plantareId,
                notes: notes,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String lastAuthor,
                Value<int> schemaRowVersion = const Value.absent(),
                required String lotId,
                required MovementType type,
                Value<int?> occurredOn = const Value.absent(),
                Value<String?> counterpartyId = const Value.absent(),
                Value<String?> quantityKind = const Value.absent(),
                Value<double?> quantityPrecise = const Value.absent(),
                Value<String?> quantityLabel = const Value.absent(),
                Value<String?> parentMovementId = const Value.absent(),
                Value<String?> plantareId = const Value.absent(),
                Value<String?> notes = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => MovementsCompanion.insert(
                id: id,
                createdAt: createdAt,
                lastAuthor: lastAuthor,
                schemaRowVersion: schemaRowVersion,
                lotId: lotId,
                type: type,
                occurredOn: occurredOn,
                counterpartyId: counterpartyId,
                quantityKind: quantityKind,
                quantityPrecise: quantityPrecise,
                quantityLabel: quantityLabel,
                parentMovementId: parentMovementId,
                plantareId: plantareId,
                notes: notes,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$MovementsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $MovementsTable,
      Movement,
      $$MovementsTableFilterComposer,
      $$MovementsTableOrderingComposer,
      $$MovementsTableAnnotationComposer,
      $$MovementsTableCreateCompanionBuilder,
      $$MovementsTableUpdateCompanionBuilder,
      (Movement, BaseReferences<_$AppDatabase, $MovementsTable, Movement>),
      Movement,
      PrefetchHooks Function()
    >;
typedef $$PartiesTableCreateCompanionBuilder =
    PartiesCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required String displayName,
      Value<String?> publicKey,
      Value<PartyKind> kind,
      Value<String?> note,
      Value<int> rowid,
    });
typedef $$PartiesTableUpdateCompanionBuilder =
    PartiesCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<String> displayName,
      Value<String?> publicKey,
      Value<PartyKind> kind,
      Value<String?> note,
      Value<int> rowid,
    });

class $$PartiesTableFilterComposer
    extends Composer<_$AppDatabase, $PartiesTable> {
  $$PartiesTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get displayName => $composableBuilder(
    column: $table.displayName,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get publicKey => $composableBuilder(
    column: $table.publicKey,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<PartyKind, PartyKind, String> get kind =>
      $composableBuilder(
        column: $table.kind,
        builder: (column) => ColumnWithTypeConverterFilters(column),
      );

  ColumnFilters<String> get note => $composableBuilder(
    column: $table.note,
    builder: (column) => ColumnFilters(column),
  );
}

class $$PartiesTableOrderingComposer
    extends Composer<_$AppDatabase, $PartiesTable> {
  $$PartiesTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get displayName => $composableBuilder(
    column: $table.displayName,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get publicKey => $composableBuilder(
    column: $table.publicKey,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get kind => $composableBuilder(
    column: $table.kind,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get note => $composableBuilder(
    column: $table.note,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$PartiesTableAnnotationComposer
    extends Composer<_$AppDatabase, $PartiesTable> {
  $$PartiesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get displayName => $composableBuilder(
    column: $table.displayName,
    builder: (column) => column,
  );

  GeneratedColumn<String> get publicKey =>
      $composableBuilder(column: $table.publicKey, builder: (column) => column);

  GeneratedColumnWithTypeConverter<PartyKind, String> get kind =>
      $composableBuilder(column: $table.kind, builder: (column) => column);

  GeneratedColumn<String> get note =>
      $composableBuilder(column: $table.note, builder: (column) => column);
}

class $$PartiesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $PartiesTable,
          Party,
          $$PartiesTableFilterComposer,
          $$PartiesTableOrderingComposer,
          $$PartiesTableAnnotationComposer,
          $$PartiesTableCreateCompanionBuilder,
          $$PartiesTableUpdateCompanionBuilder,
          (Party, BaseReferences<_$AppDatabase, $PartiesTable, Party>),
          Party,
          PrefetchHooks Function()
        > {
  $$PartiesTableTableManager(_$AppDatabase db, $PartiesTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$PartiesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$PartiesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$PartiesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<String> displayName = const Value.absent(),
                Value<String?> publicKey = const Value.absent(),
                Value<PartyKind> kind = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => PartiesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                displayName: displayName,
                publicKey: publicKey,
                kind: kind,
                note: note,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required String displayName,
                Value<String?> publicKey = const Value.absent(),
                Value<PartyKind> kind = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => PartiesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                displayName: displayName,
                publicKey: publicKey,
                kind: kind,
                note: note,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$PartiesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $PartiesTable,
      Party,
      $$PartiesTableFilterComposer,
      $$PartiesTableOrderingComposer,
      $$PartiesTableAnnotationComposer,
      $$PartiesTableCreateCompanionBuilder,
      $$PartiesTableUpdateCompanionBuilder,
      (Party, BaseReferences<_$AppDatabase, $PartiesTable, Party>),
      Party,
      PrefetchHooks Function()
    >;
typedef $$AttachmentsTableCreateCompanionBuilder =
    AttachmentsCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required ParentType parentType,
      required String parentId,
      required AttachmentKind kind,
      Value<String?> uri,
      Value<Uint8List?> bytes,
      Value<String?> mimeType,
      Value<int> sortOrder,
      Value<int> rowid,
    });
typedef $$AttachmentsTableUpdateCompanionBuilder =
    AttachmentsCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<ParentType> parentType,
      Value<String> parentId,
      Value<AttachmentKind> kind,
      Value<String?> uri,
      Value<Uint8List?> bytes,
      Value<String?> mimeType,
      Value<int> sortOrder,
      Value<int> rowid,
    });

class $$AttachmentsTableFilterComposer
    extends Composer<_$AppDatabase, $AttachmentsTable> {
  $$AttachmentsTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<ParentType, ParentType, String>
  get parentType => $composableBuilder(
    column: $table.parentType,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get parentId => $composableBuilder(
    column: $table.parentId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<AttachmentKind, AttachmentKind, String>
  get kind => $composableBuilder(
    column: $table.kind,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get uri => $composableBuilder(
    column: $table.uri,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<Uint8List> get bytes => $composableBuilder(
    column: $table.bytes,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get mimeType => $composableBuilder(
    column: $table.mimeType,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get sortOrder => $composableBuilder(
    column: $table.sortOrder,
    builder: (column) => ColumnFilters(column),
  );
}

class $$AttachmentsTableOrderingComposer
    extends Composer<_$AppDatabase, $AttachmentsTable> {
  $$AttachmentsTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get parentType => $composableBuilder(
    column: $table.parentType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get parentId => $composableBuilder(
    column: $table.parentId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get kind => $composableBuilder(
    column: $table.kind,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get uri => $composableBuilder(
    column: $table.uri,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<Uint8List> get bytes => $composableBuilder(
    column: $table.bytes,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get mimeType => $composableBuilder(
    column: $table.mimeType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get sortOrder => $composableBuilder(
    column: $table.sortOrder,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$AttachmentsTableAnnotationComposer
    extends Composer<_$AppDatabase, $AttachmentsTable> {
  $$AttachmentsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<ParentType, String> get parentType =>
      $composableBuilder(
        column: $table.parentType,
        builder: (column) => column,
      );

  GeneratedColumn<String> get parentId =>
      $composableBuilder(column: $table.parentId, builder: (column) => column);

  GeneratedColumnWithTypeConverter<AttachmentKind, String> get kind =>
      $composableBuilder(column: $table.kind, builder: (column) => column);

  GeneratedColumn<String> get uri =>
      $composableBuilder(column: $table.uri, builder: (column) => column);

  GeneratedColumn<Uint8List> get bytes =>
      $composableBuilder(column: $table.bytes, builder: (column) => column);

  GeneratedColumn<String> get mimeType =>
      $composableBuilder(column: $table.mimeType, builder: (column) => column);

  GeneratedColumn<int> get sortOrder =>
      $composableBuilder(column: $table.sortOrder, builder: (column) => column);
}

class $$AttachmentsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $AttachmentsTable,
          Attachment,
          $$AttachmentsTableFilterComposer,
          $$AttachmentsTableOrderingComposer,
          $$AttachmentsTableAnnotationComposer,
          $$AttachmentsTableCreateCompanionBuilder,
          $$AttachmentsTableUpdateCompanionBuilder,
          (
            Attachment,
            BaseReferences<_$AppDatabase, $AttachmentsTable, Attachment>,
          ),
          Attachment,
          PrefetchHooks Function()
        > {
  $$AttachmentsTableTableManager(_$AppDatabase db, $AttachmentsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$AttachmentsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$AttachmentsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$AttachmentsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<ParentType> parentType = const Value.absent(),
                Value<String> parentId = const Value.absent(),
                Value<AttachmentKind> kind = const Value.absent(),
                Value<String?> uri = const Value.absent(),
                Value<Uint8List?> bytes = const Value.absent(),
                Value<String?> mimeType = const Value.absent(),
                Value<int> sortOrder = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => AttachmentsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                parentType: parentType,
                parentId: parentId,
                kind: kind,
                uri: uri,
                bytes: bytes,
                mimeType: mimeType,
                sortOrder: sortOrder,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required ParentType parentType,
                required String parentId,
                required AttachmentKind kind,
                Value<String?> uri = const Value.absent(),
                Value<Uint8List?> bytes = const Value.absent(),
                Value<String?> mimeType = const Value.absent(),
                Value<int> sortOrder = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => AttachmentsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                parentType: parentType,
                parentId: parentId,
                kind: kind,
                uri: uri,
                bytes: bytes,
                mimeType: mimeType,
                sortOrder: sortOrder,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$AttachmentsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $AttachmentsTable,
      Attachment,
      $$AttachmentsTableFilterComposer,
      $$AttachmentsTableOrderingComposer,
      $$AttachmentsTableAnnotationComposer,
      $$AttachmentsTableCreateCompanionBuilder,
      $$AttachmentsTableUpdateCompanionBuilder,
      (
        Attachment,
        BaseReferences<_$AppDatabase, $AttachmentsTable, Attachment>,
      ),
      Attachment,
      PrefetchHooks Function()
    >;
typedef $$ExternalLinksTableCreateCompanionBuilder =
    ExternalLinksCompanion Function({
      required String id,
      required int createdAt,
      required String updatedAt,
      required String lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      required ParentType parentType,
      required String parentId,
      required String url,
      Value<String?> title,
      Value<int> rowid,
    });
typedef $$ExternalLinksTableUpdateCompanionBuilder =
    ExternalLinksCompanion Function({
      Value<String> id,
      Value<int> createdAt,
      Value<String> updatedAt,
      Value<String> lastAuthor,
      Value<bool> isDeleted,
      Value<int> schemaRowVersion,
      Value<ParentType> parentType,
      Value<String> parentId,
      Value<String> url,
      Value<String?> title,
      Value<int> rowid,
    });

class $$ExternalLinksTableFilterComposer
    extends Composer<_$AppDatabase, $ExternalLinksTable> {
  $$ExternalLinksTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnWithTypeConverterFilters<ParentType, ParentType, String>
  get parentType => $composableBuilder(
    column: $table.parentType,
    builder: (column) => ColumnWithTypeConverterFilters(column),
  );

  ColumnFilters<String> get parentId => $composableBuilder(
    column: $table.parentId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get url => $composableBuilder(
    column: $table.url,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get title => $composableBuilder(
    column: $table.title,
    builder: (column) => ColumnFilters(column),
  );
}

class $$ExternalLinksTableOrderingComposer
    extends Composer<_$AppDatabase, $ExternalLinksTable> {
  $$ExternalLinksTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get id => $composableBuilder(
    column: $table.id,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isDeleted => $composableBuilder(
    column: $table.isDeleted,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get parentType => $composableBuilder(
    column: $table.parentType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get parentId => $composableBuilder(
    column: $table.parentId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get url => $composableBuilder(
    column: $table.url,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get title => $composableBuilder(
    column: $table.title,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$ExternalLinksTableAnnotationComposer
    extends Composer<_$AppDatabase, $ExternalLinksTable> {
  $$ExternalLinksTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<int> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<String> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<String> get lastAuthor => $composableBuilder(
    column: $table.lastAuthor,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isDeleted =>
      $composableBuilder(column: $table.isDeleted, builder: (column) => column);

  GeneratedColumn<int> get schemaRowVersion => $composableBuilder(
    column: $table.schemaRowVersion,
    builder: (column) => column,
  );

  GeneratedColumnWithTypeConverter<ParentType, String> get parentType =>
      $composableBuilder(
        column: $table.parentType,
        builder: (column) => column,
      );

  GeneratedColumn<String> get parentId =>
      $composableBuilder(column: $table.parentId, builder: (column) => column);

  GeneratedColumn<String> get url =>
      $composableBuilder(column: $table.url, builder: (column) => column);

  GeneratedColumn<String> get title =>
      $composableBuilder(column: $table.title, builder: (column) => column);
}

class $$ExternalLinksTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ExternalLinksTable,
          ExternalLink,
          $$ExternalLinksTableFilterComposer,
          $$ExternalLinksTableOrderingComposer,
          $$ExternalLinksTableAnnotationComposer,
          $$ExternalLinksTableCreateCompanionBuilder,
          $$ExternalLinksTableUpdateCompanionBuilder,
          (
            ExternalLink,
            BaseReferences<_$AppDatabase, $ExternalLinksTable, ExternalLink>,
          ),
          ExternalLink,
          PrefetchHooks Function()
        > {
  $$ExternalLinksTableTableManager(_$AppDatabase db, $ExternalLinksTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ExternalLinksTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ExternalLinksTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ExternalLinksTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<int> createdAt = const Value.absent(),
                Value<String> updatedAt = const Value.absent(),
                Value<String> lastAuthor = const Value.absent(),
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                Value<ParentType> parentType = const Value.absent(),
                Value<String> parentId = const Value.absent(),
                Value<String> url = const Value.absent(),
                Value<String?> title = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExternalLinksCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                parentType: parentType,
                parentId: parentId,
                url: url,
                title: title,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required int createdAt,
                required String updatedAt,
                required String lastAuthor,
                Value<bool> isDeleted = const Value.absent(),
                Value<int> schemaRowVersion = const Value.absent(),
                required ParentType parentType,
                required String parentId,
                required String url,
                Value<String?> title = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExternalLinksCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthor: lastAuthor,
                isDeleted: isDeleted,
                schemaRowVersion: schemaRowVersion,
                parentType: parentType,
                parentId: parentId,
                url: url,
                title: title,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$ExternalLinksTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ExternalLinksTable,
      ExternalLink,
      $$ExternalLinksTableFilterComposer,
      $$ExternalLinksTableOrderingComposer,
      $$ExternalLinksTableAnnotationComposer,
      $$ExternalLinksTableCreateCompanionBuilder,
      $$ExternalLinksTableUpdateCompanionBuilder,
      (
        ExternalLink,
        BaseReferences<_$AppDatabase, $ExternalLinksTable, ExternalLink>,
      ),
      ExternalLink,
      PrefetchHooks Function()
    >;

class $AppDatabaseManager {
  final _$AppDatabase _db;
  $AppDatabaseManager(this._db);
  $$VarietiesTableTableManager get varieties =>
      $$VarietiesTableTableManager(_db, _db.varieties);
  $$VarietyVernacularNamesTableTableManager get varietyVernacularNames =>
      $$VarietyVernacularNamesTableTableManager(
        _db,
        _db.varietyVernacularNames,
      );
  $$SpeciesTableTableManager get species =>
      $$SpeciesTableTableManager(_db, _db.species);
  $$SpeciesCommonNamesTableTableManager get speciesCommonNames =>
      $$SpeciesCommonNamesTableTableManager(_db, _db.speciesCommonNames);
  $$LotsTableTableManager get lots => $$LotsTableTableManager(_db, _db.lots);
  $$GerminationTestsTableTableManager get germinationTests =>
      $$GerminationTestsTableTableManager(_db, _db.germinationTests);
  $$ConditionChecksTableTableManager get conditionChecks =>
      $$ConditionChecksTableTableManager(_db, _db.conditionChecks);
  $$MovementsTableTableManager get movements =>
      $$MovementsTableTableManager(_db, _db.movements);
  $$PartiesTableTableManager get parties =>
      $$PartiesTableTableManager(_db, _db.parties);
  $$AttachmentsTableTableManager get attachments =>
      $$AttachmentsTableTableManager(_db, _db.attachments);
  $$ExternalLinksTableTableManager get externalLinks =>
      $$ExternalLinksTableTableManager(_db, _db.externalLinks);
}
