// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'app_database.dart';

// ignore_for_file: type=lint
class $WorkoutTemplatesTable extends WorkoutTemplates
    with TableInfo<$WorkoutTemplatesTable, WorkoutTemplate> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutTemplatesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastStartedAtMeta = const VerificationMeta(
    'lastStartedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastStartedAt =
      GeneratedColumn<DateTime>(
        'last_started_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _isExampleMeta = const VerificationMeta(
    'isExample',
  );
  @override
  late final GeneratedColumn<bool> isExample = GeneratedColumn<bool>(
    'is_example',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_example" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _tagsJsonMeta = const VerificationMeta(
    'tagsJson',
  );
  @override
  late final GeneratedColumn<String> tagsJson = GeneratedColumn<String>(
    'tags_json',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('[]'),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    lastStartedAt,
    isExample,
    tagsJson,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_templates';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutTemplate> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('last_started_at')) {
      context.handle(
        _lastStartedAtMeta,
        lastStartedAt.isAcceptableOrUnknown(
          data['last_started_at']!,
          _lastStartedAtMeta,
        ),
      );
    }
    if (data.containsKey('is_example')) {
      context.handle(
        _isExampleMeta,
        isExample.isAcceptableOrUnknown(data['is_example']!, _isExampleMeta),
      );
    }
    if (data.containsKey('tags_json')) {
      context.handle(
        _tagsJsonMeta,
        tagsJson.isAcceptableOrUnknown(data['tags_json']!, _tagsJsonMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutTemplate map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutTemplate(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      lastStartedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_started_at'],
      ),
      isExample: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_example'],
      )!,
      tagsJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}tags_json'],
      )!,
    );
  }

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

class WorkoutTemplate extends DataClass implements Insertable<WorkoutTemplate> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String name;
  final DateTime? lastStartedAt;
  final bool isExample;
  final String tagsJson;
  const WorkoutTemplate({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.name,
    this.lastStartedAt,
    required this.isExample,
    required this.tagsJson,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['name'] = Variable<String>(name);
    if (!nullToAbsent || lastStartedAt != null) {
      map['last_started_at'] = Variable<DateTime>(lastStartedAt);
    }
    map['is_example'] = Variable<bool>(isExample);
    map['tags_json'] = Variable<String>(tagsJson);
    return map;
  }

  WorkoutTemplatesCompanion toCompanion(bool nullToAbsent) {
    return WorkoutTemplatesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      name: Value(name),
      lastStartedAt: lastStartedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastStartedAt),
      isExample: Value(isExample),
      tagsJson: Value(tagsJson),
    );
  }

  factory WorkoutTemplate.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutTemplate(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      name: serializer.fromJson<String>(json['name']),
      lastStartedAt: serializer.fromJson<DateTime?>(json['lastStartedAt']),
      isExample: serializer.fromJson<bool>(json['isExample']),
      tagsJson: serializer.fromJson<String>(json['tagsJson']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'name': serializer.toJson<String>(name),
      'lastStartedAt': serializer.toJson<DateTime?>(lastStartedAt),
      'isExample': serializer.toJson<bool>(isExample),
      'tagsJson': serializer.toJson<String>(tagsJson),
    };
  }

  WorkoutTemplate copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? name,
    Value<DateTime?> lastStartedAt = const Value.absent(),
    bool? isExample,
    String? tagsJson,
  }) => WorkoutTemplate(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    name: name ?? this.name,
    lastStartedAt: lastStartedAt.present
        ? lastStartedAt.value
        : this.lastStartedAt,
    isExample: isExample ?? this.isExample,
    tagsJson: tagsJson ?? this.tagsJson,
  );
  WorkoutTemplate copyWithCompanion(WorkoutTemplatesCompanion data) {
    return WorkoutTemplate(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      name: data.name.present ? data.name.value : this.name,
      lastStartedAt: data.lastStartedAt.present
          ? data.lastStartedAt.value
          : this.lastStartedAt,
      isExample: data.isExample.present ? data.isExample.value : this.isExample,
      tagsJson: data.tagsJson.present ? data.tagsJson.value : this.tagsJson,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplate(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('lastStartedAt: $lastStartedAt, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    lastStartedAt,
    isExample,
    tagsJson,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutTemplate &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.name == this.name &&
          other.lastStartedAt == this.lastStartedAt &&
          other.isExample == this.isExample &&
          other.tagsJson == this.tagsJson);
}

class WorkoutTemplatesCompanion extends UpdateCompanion<WorkoutTemplate> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> name;
  final Value<DateTime?> lastStartedAt;
  final Value<bool> isExample;
  final Value<String> tagsJson;
  final Value<int> rowid;
  const WorkoutTemplatesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.name = const Value.absent(),
    this.lastStartedAt = const Value.absent(),
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutTemplatesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String name,
    this.lastStartedAt = const Value.absent(),
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       name = Value(name);
  static Insertable<WorkoutTemplate> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? name,
    Expression<DateTime>? lastStartedAt,
    Expression<bool>? isExample,
    Expression<String>? tagsJson,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (name != null) 'name': name,
      if (lastStartedAt != null) 'last_started_at': lastStartedAt,
      if (isExample != null) 'is_example': isExample,
      if (tagsJson != null) 'tags_json': tagsJson,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutTemplatesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? name,
    Value<DateTime?>? lastStartedAt,
    Value<bool>? isExample,
    Value<String>? tagsJson,
    Value<int>? rowid,
  }) {
    return WorkoutTemplatesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      name: name ?? this.name,
      lastStartedAt: lastStartedAt ?? this.lastStartedAt,
      isExample: isExample ?? this.isExample,
      tagsJson: tagsJson ?? this.tagsJson,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (lastStartedAt.present) {
      map['last_started_at'] = Variable<DateTime>(lastStartedAt.value);
    }
    if (isExample.present) {
      map['is_example'] = Variable<bool>(isExample.value);
    }
    if (tagsJson.present) {
      map['tags_json'] = Variable<String>(tagsJson.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplatesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('lastStartedAt: $lastStartedAt, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveWorkoutSessionsTable extends ActiveWorkoutSessions
    with TableInfo<$ActiveWorkoutSessionsTable, ActiveWorkoutSession> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveWorkoutSessionsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _sourceWorkoutTemplateIdMeta =
      const VerificationMeta('sourceWorkoutTemplateId');
  @override
  late final GeneratedColumn<String> sourceWorkoutTemplateId =
      GeneratedColumn<String>(
        'source_workout_template_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES workout_templates (id)',
        ),
      );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _pausedAtMeta = const VerificationMeta(
    'pausedAt',
  );
  @override
  late final GeneratedColumn<DateTime> pausedAt = GeneratedColumn<DateTime>(
    'paused_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _endedAtMeta = const VerificationMeta(
    'endedAt',
  );
  @override
  late final GeneratedColumn<DateTime> endedAt = GeneratedColumn<DateTime>(
    'ended_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _lastPersistedAtMeta = const VerificationMeta(
    'lastPersistedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastPersistedAt =
      GeneratedColumn<DateTime>(
        'last_persisted_at',
        aliasedName,
        false,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _elapsedActiveMsMeta = const VerificationMeta(
    'elapsedActiveMs',
  );
  @override
  late final GeneratedColumn<int> elapsedActiveMs = GeneratedColumn<int>(
    'elapsed_active_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentProgramIndexMeta =
      const VerificationMeta('currentProgramIndex');
  @override
  late final GeneratedColumn<int> currentProgramIndex = GeneratedColumn<int>(
    'current_program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentExerciseIndexMeta =
      const VerificationMeta('currentExerciseIndex');
  @override
  late final GeneratedColumn<int> currentExerciseIndex = GeneratedColumn<int>(
    'current_exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentSetIndexMeta = const VerificationMeta(
    'currentSetIndex',
  );
  @override
  late final GeneratedColumn<int> currentSetIndex = GeneratedColumn<int>(
    'current_set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _resolvedTemplateSnapshotJsonMeta =
      const VerificationMeta('resolvedTemplateSnapshotJson');
  @override
  late final GeneratedColumn<String> resolvedTemplateSnapshotJson =
      GeneratedColumn<String>(
        'resolved_template_snapshot_json',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    sourceWorkoutTemplateId,
    status,
    startedAt,
    pausedAt,
    endedAt,
    lastPersistedAt,
    elapsedActiveMs,
    currentProgramIndex,
    currentExerciseIndex,
    currentSetIndex,
    resolvedTemplateSnapshotJson,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_workout_sessions';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveWorkoutSession> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('source_workout_template_id')) {
      context.handle(
        _sourceWorkoutTemplateIdMeta,
        sourceWorkoutTemplateId.isAcceptableOrUnknown(
          data['source_workout_template_id']!,
          _sourceWorkoutTemplateIdMeta,
        ),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_startedAtMeta);
    }
    if (data.containsKey('paused_at')) {
      context.handle(
        _pausedAtMeta,
        pausedAt.isAcceptableOrUnknown(data['paused_at']!, _pausedAtMeta),
      );
    }
    if (data.containsKey('ended_at')) {
      context.handle(
        _endedAtMeta,
        endedAt.isAcceptableOrUnknown(data['ended_at']!, _endedAtMeta),
      );
    }
    if (data.containsKey('last_persisted_at')) {
      context.handle(
        _lastPersistedAtMeta,
        lastPersistedAt.isAcceptableOrUnknown(
          data['last_persisted_at']!,
          _lastPersistedAtMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_lastPersistedAtMeta);
    }
    if (data.containsKey('elapsed_active_ms')) {
      context.handle(
        _elapsedActiveMsMeta,
        elapsedActiveMs.isAcceptableOrUnknown(
          data['elapsed_active_ms']!,
          _elapsedActiveMsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_elapsedActiveMsMeta);
    }
    if (data.containsKey('current_program_index')) {
      context.handle(
        _currentProgramIndexMeta,
        currentProgramIndex.isAcceptableOrUnknown(
          data['current_program_index']!,
          _currentProgramIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentProgramIndexMeta);
    }
    if (data.containsKey('current_exercise_index')) {
      context.handle(
        _currentExerciseIndexMeta,
        currentExerciseIndex.isAcceptableOrUnknown(
          data['current_exercise_index']!,
          _currentExerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentExerciseIndexMeta);
    }
    if (data.containsKey('current_set_index')) {
      context.handle(
        _currentSetIndexMeta,
        currentSetIndex.isAcceptableOrUnknown(
          data['current_set_index']!,
          _currentSetIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentSetIndexMeta);
    }
    if (data.containsKey('resolved_template_snapshot_json')) {
      context.handle(
        _resolvedTemplateSnapshotJsonMeta,
        resolvedTemplateSnapshotJson.isAcceptableOrUnknown(
          data['resolved_template_snapshot_json']!,
          _resolvedTemplateSnapshotJsonMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_resolvedTemplateSnapshotJsonMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveWorkoutSession map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveWorkoutSession(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      sourceWorkoutTemplateId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_workout_template_id'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      )!,
      pausedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}paused_at'],
      ),
      endedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}ended_at'],
      ),
      lastPersistedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_persisted_at'],
      )!,
      elapsedActiveMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}elapsed_active_ms'],
      )!,
      currentProgramIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}current_program_index'],
      )!,
      currentExerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}current_exercise_index'],
      )!,
      currentSetIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}current_set_index'],
      )!,
      resolvedTemplateSnapshotJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}resolved_template_snapshot_json'],
      )!,
    );
  }

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

class ActiveWorkoutSession extends DataClass
    implements Insertable<ActiveWorkoutSession> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String? sourceWorkoutTemplateId;
  final String status;
  final DateTime startedAt;
  final DateTime? pausedAt;
  final DateTime? endedAt;
  final DateTime lastPersistedAt;
  final int elapsedActiveMs;
  final int currentProgramIndex;
  final int currentExerciseIndex;
  final int currentSetIndex;
  final String resolvedTemplateSnapshotJson;
  const ActiveWorkoutSession({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    this.sourceWorkoutTemplateId,
    required this.status,
    required this.startedAt,
    this.pausedAt,
    this.endedAt,
    required this.lastPersistedAt,
    required this.elapsedActiveMs,
    required this.currentProgramIndex,
    required this.currentExerciseIndex,
    required this.currentSetIndex,
    required this.resolvedTemplateSnapshotJson,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    if (!nullToAbsent || sourceWorkoutTemplateId != null) {
      map['source_workout_template_id'] = Variable<String>(
        sourceWorkoutTemplateId,
      );
    }
    map['status'] = Variable<String>(status);
    map['started_at'] = Variable<DateTime>(startedAt);
    if (!nullToAbsent || pausedAt != null) {
      map['paused_at'] = Variable<DateTime>(pausedAt);
    }
    if (!nullToAbsent || endedAt != null) {
      map['ended_at'] = Variable<DateTime>(endedAt);
    }
    map['last_persisted_at'] = Variable<DateTime>(lastPersistedAt);
    map['elapsed_active_ms'] = Variable<int>(elapsedActiveMs);
    map['current_program_index'] = Variable<int>(currentProgramIndex);
    map['current_exercise_index'] = Variable<int>(currentExerciseIndex);
    map['current_set_index'] = Variable<int>(currentSetIndex);
    map['resolved_template_snapshot_json'] = Variable<String>(
      resolvedTemplateSnapshotJson,
    );
    return map;
  }

  ActiveWorkoutSessionsCompanion toCompanion(bool nullToAbsent) {
    return ActiveWorkoutSessionsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      sourceWorkoutTemplateId: sourceWorkoutTemplateId == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceWorkoutTemplateId),
      status: Value(status),
      startedAt: Value(startedAt),
      pausedAt: pausedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(pausedAt),
      endedAt: endedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(endedAt),
      lastPersistedAt: Value(lastPersistedAt),
      elapsedActiveMs: Value(elapsedActiveMs),
      currentProgramIndex: Value(currentProgramIndex),
      currentExerciseIndex: Value(currentExerciseIndex),
      currentSetIndex: Value(currentSetIndex),
      resolvedTemplateSnapshotJson: Value(resolvedTemplateSnapshotJson),
    );
  }

  factory ActiveWorkoutSession.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveWorkoutSession(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      sourceWorkoutTemplateId: serializer.fromJson<String?>(
        json['sourceWorkoutTemplateId'],
      ),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime>(json['startedAt']),
      pausedAt: serializer.fromJson<DateTime?>(json['pausedAt']),
      endedAt: serializer.fromJson<DateTime?>(json['endedAt']),
      lastPersistedAt: serializer.fromJson<DateTime>(json['lastPersistedAt']),
      elapsedActiveMs: serializer.fromJson<int>(json['elapsedActiveMs']),
      currentProgramIndex: serializer.fromJson<int>(
        json['currentProgramIndex'],
      ),
      currentExerciseIndex: serializer.fromJson<int>(
        json['currentExerciseIndex'],
      ),
      currentSetIndex: serializer.fromJson<int>(json['currentSetIndex']),
      resolvedTemplateSnapshotJson: serializer.fromJson<String>(
        json['resolvedTemplateSnapshotJson'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'sourceWorkoutTemplateId': serializer.toJson<String?>(
        sourceWorkoutTemplateId,
      ),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime>(startedAt),
      'pausedAt': serializer.toJson<DateTime?>(pausedAt),
      'endedAt': serializer.toJson<DateTime?>(endedAt),
      'lastPersistedAt': serializer.toJson<DateTime>(lastPersistedAt),
      'elapsedActiveMs': serializer.toJson<int>(elapsedActiveMs),
      'currentProgramIndex': serializer.toJson<int>(currentProgramIndex),
      'currentExerciseIndex': serializer.toJson<int>(currentExerciseIndex),
      'currentSetIndex': serializer.toJson<int>(currentSetIndex),
      'resolvedTemplateSnapshotJson': serializer.toJson<String>(
        resolvedTemplateSnapshotJson,
      ),
    };
  }

  ActiveWorkoutSession copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    Value<String?> sourceWorkoutTemplateId = const Value.absent(),
    String? status,
    DateTime? startedAt,
    Value<DateTime?> pausedAt = const Value.absent(),
    Value<DateTime?> endedAt = const Value.absent(),
    DateTime? lastPersistedAt,
    int? elapsedActiveMs,
    int? currentProgramIndex,
    int? currentExerciseIndex,
    int? currentSetIndex,
    String? resolvedTemplateSnapshotJson,
  }) => ActiveWorkoutSession(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    sourceWorkoutTemplateId: sourceWorkoutTemplateId.present
        ? sourceWorkoutTemplateId.value
        : this.sourceWorkoutTemplateId,
    status: status ?? this.status,
    startedAt: startedAt ?? this.startedAt,
    pausedAt: pausedAt.present ? pausedAt.value : this.pausedAt,
    endedAt: endedAt.present ? endedAt.value : this.endedAt,
    lastPersistedAt: lastPersistedAt ?? this.lastPersistedAt,
    elapsedActiveMs: elapsedActiveMs ?? this.elapsedActiveMs,
    currentProgramIndex: currentProgramIndex ?? this.currentProgramIndex,
    currentExerciseIndex: currentExerciseIndex ?? this.currentExerciseIndex,
    currentSetIndex: currentSetIndex ?? this.currentSetIndex,
    resolvedTemplateSnapshotJson:
        resolvedTemplateSnapshotJson ?? this.resolvedTemplateSnapshotJson,
  );
  ActiveWorkoutSession copyWithCompanion(ActiveWorkoutSessionsCompanion data) {
    return ActiveWorkoutSession(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      sourceWorkoutTemplateId: data.sourceWorkoutTemplateId.present
          ? data.sourceWorkoutTemplateId.value
          : this.sourceWorkoutTemplateId,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      pausedAt: data.pausedAt.present ? data.pausedAt.value : this.pausedAt,
      endedAt: data.endedAt.present ? data.endedAt.value : this.endedAt,
      lastPersistedAt: data.lastPersistedAt.present
          ? data.lastPersistedAt.value
          : this.lastPersistedAt,
      elapsedActiveMs: data.elapsedActiveMs.present
          ? data.elapsedActiveMs.value
          : this.elapsedActiveMs,
      currentProgramIndex: data.currentProgramIndex.present
          ? data.currentProgramIndex.value
          : this.currentProgramIndex,
      currentExerciseIndex: data.currentExerciseIndex.present
          ? data.currentExerciseIndex.value
          : this.currentExerciseIndex,
      currentSetIndex: data.currentSetIndex.present
          ? data.currentSetIndex.value
          : this.currentSetIndex,
      resolvedTemplateSnapshotJson: data.resolvedTemplateSnapshotJson.present
          ? data.resolvedTemplateSnapshotJson.value
          : this.resolvedTemplateSnapshotJson,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveWorkoutSession(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('sourceWorkoutTemplateId: $sourceWorkoutTemplateId, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('pausedAt: $pausedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('lastPersistedAt: $lastPersistedAt, ')
          ..write('elapsedActiveMs: $elapsedActiveMs, ')
          ..write('currentProgramIndex: $currentProgramIndex, ')
          ..write('currentExerciseIndex: $currentExerciseIndex, ')
          ..write('currentSetIndex: $currentSetIndex, ')
          ..write('resolvedTemplateSnapshotJson: $resolvedTemplateSnapshotJson')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    sourceWorkoutTemplateId,
    status,
    startedAt,
    pausedAt,
    endedAt,
    lastPersistedAt,
    elapsedActiveMs,
    currentProgramIndex,
    currentExerciseIndex,
    currentSetIndex,
    resolvedTemplateSnapshotJson,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveWorkoutSession &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.sourceWorkoutTemplateId == this.sourceWorkoutTemplateId &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.pausedAt == this.pausedAt &&
          other.endedAt == this.endedAt &&
          other.lastPersistedAt == this.lastPersistedAt &&
          other.elapsedActiveMs == this.elapsedActiveMs &&
          other.currentProgramIndex == this.currentProgramIndex &&
          other.currentExerciseIndex == this.currentExerciseIndex &&
          other.currentSetIndex == this.currentSetIndex &&
          other.resolvedTemplateSnapshotJson ==
              this.resolvedTemplateSnapshotJson);
}

class ActiveWorkoutSessionsCompanion
    extends UpdateCompanion<ActiveWorkoutSession> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String?> sourceWorkoutTemplateId;
  final Value<String> status;
  final Value<DateTime> startedAt;
  final Value<DateTime?> pausedAt;
  final Value<DateTime?> endedAt;
  final Value<DateTime> lastPersistedAt;
  final Value<int> elapsedActiveMs;
  final Value<int> currentProgramIndex;
  final Value<int> currentExerciseIndex;
  final Value<int> currentSetIndex;
  final Value<String> resolvedTemplateSnapshotJson;
  final Value<int> rowid;
  const ActiveWorkoutSessionsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.sourceWorkoutTemplateId = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.pausedAt = const Value.absent(),
    this.endedAt = const Value.absent(),
    this.lastPersistedAt = const Value.absent(),
    this.elapsedActiveMs = const Value.absent(),
    this.currentProgramIndex = const Value.absent(),
    this.currentExerciseIndex = const Value.absent(),
    this.currentSetIndex = const Value.absent(),
    this.resolvedTemplateSnapshotJson = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveWorkoutSessionsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.sourceWorkoutTemplateId = const Value.absent(),
    required String status,
    required DateTime startedAt,
    this.pausedAt = const Value.absent(),
    this.endedAt = const Value.absent(),
    required DateTime lastPersistedAt,
    required int elapsedActiveMs,
    required int currentProgramIndex,
    required int currentExerciseIndex,
    required int currentSetIndex,
    required String resolvedTemplateSnapshotJson,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       status = Value(status),
       startedAt = Value(startedAt),
       lastPersistedAt = Value(lastPersistedAt),
       elapsedActiveMs = Value(elapsedActiveMs),
       currentProgramIndex = Value(currentProgramIndex),
       currentExerciseIndex = Value(currentExerciseIndex),
       currentSetIndex = Value(currentSetIndex),
       resolvedTemplateSnapshotJson = Value(resolvedTemplateSnapshotJson);
  static Insertable<ActiveWorkoutSession> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? sourceWorkoutTemplateId,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? pausedAt,
    Expression<DateTime>? endedAt,
    Expression<DateTime>? lastPersistedAt,
    Expression<int>? elapsedActiveMs,
    Expression<int>? currentProgramIndex,
    Expression<int>? currentExerciseIndex,
    Expression<int>? currentSetIndex,
    Expression<String>? resolvedTemplateSnapshotJson,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (sourceWorkoutTemplateId != null)
        'source_workout_template_id': sourceWorkoutTemplateId,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (pausedAt != null) 'paused_at': pausedAt,
      if (endedAt != null) 'ended_at': endedAt,
      if (lastPersistedAt != null) 'last_persisted_at': lastPersistedAt,
      if (elapsedActiveMs != null) 'elapsed_active_ms': elapsedActiveMs,
      if (currentProgramIndex != null)
        'current_program_index': currentProgramIndex,
      if (currentExerciseIndex != null)
        'current_exercise_index': currentExerciseIndex,
      if (currentSetIndex != null) 'current_set_index': currentSetIndex,
      if (resolvedTemplateSnapshotJson != null)
        'resolved_template_snapshot_json': resolvedTemplateSnapshotJson,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveWorkoutSessionsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String?>? sourceWorkoutTemplateId,
    Value<String>? status,
    Value<DateTime>? startedAt,
    Value<DateTime?>? pausedAt,
    Value<DateTime?>? endedAt,
    Value<DateTime>? lastPersistedAt,
    Value<int>? elapsedActiveMs,
    Value<int>? currentProgramIndex,
    Value<int>? currentExerciseIndex,
    Value<int>? currentSetIndex,
    Value<String>? resolvedTemplateSnapshotJson,
    Value<int>? rowid,
  }) {
    return ActiveWorkoutSessionsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      sourceWorkoutTemplateId:
          sourceWorkoutTemplateId ?? this.sourceWorkoutTemplateId,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      pausedAt: pausedAt ?? this.pausedAt,
      endedAt: endedAt ?? this.endedAt,
      lastPersistedAt: lastPersistedAt ?? this.lastPersistedAt,
      elapsedActiveMs: elapsedActiveMs ?? this.elapsedActiveMs,
      currentProgramIndex: currentProgramIndex ?? this.currentProgramIndex,
      currentExerciseIndex: currentExerciseIndex ?? this.currentExerciseIndex,
      currentSetIndex: currentSetIndex ?? this.currentSetIndex,
      resolvedTemplateSnapshotJson:
          resolvedTemplateSnapshotJson ?? this.resolvedTemplateSnapshotJson,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (sourceWorkoutTemplateId.present) {
      map['source_workout_template_id'] = Variable<String>(
        sourceWorkoutTemplateId.value,
      );
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (pausedAt.present) {
      map['paused_at'] = Variable<DateTime>(pausedAt.value);
    }
    if (endedAt.present) {
      map['ended_at'] = Variable<DateTime>(endedAt.value);
    }
    if (lastPersistedAt.present) {
      map['last_persisted_at'] = Variable<DateTime>(lastPersistedAt.value);
    }
    if (elapsedActiveMs.present) {
      map['elapsed_active_ms'] = Variable<int>(elapsedActiveMs.value);
    }
    if (currentProgramIndex.present) {
      map['current_program_index'] = Variable<int>(currentProgramIndex.value);
    }
    if (currentExerciseIndex.present) {
      map['current_exercise_index'] = Variable<int>(currentExerciseIndex.value);
    }
    if (currentSetIndex.present) {
      map['current_set_index'] = Variable<int>(currentSetIndex.value);
    }
    if (resolvedTemplateSnapshotJson.present) {
      map['resolved_template_snapshot_json'] = Variable<String>(
        resolvedTemplateSnapshotJson.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveWorkoutSessionsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('sourceWorkoutTemplateId: $sourceWorkoutTemplateId, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('pausedAt: $pausedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('lastPersistedAt: $lastPersistedAt, ')
          ..write('elapsedActiveMs: $elapsedActiveMs, ')
          ..write('currentProgramIndex: $currentProgramIndex, ')
          ..write('currentExerciseIndex: $currentExerciseIndex, ')
          ..write('currentSetIndex: $currentSetIndex, ')
          ..write(
            'resolvedTemplateSnapshotJson: $resolvedTemplateSnapshotJson, ',
          )
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveExerciseStepProgressStatesTable
    extends ActiveExerciseStepProgressStates
    with
        TableInfo<
          $ActiveExerciseStepProgressStatesTable,
          ActiveExerciseStepProgressState
        > {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveExerciseStepProgressStatesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentPassageIndexMeta =
      const VerificationMeta('currentPassageIndex');
  @override
  late final GeneratedColumn<int> currentPassageIndex = GeneratedColumn<int>(
    'current_passage_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentStepIndexMeta = const VerificationMeta(
    'currentStepIndex',
  );
  @override
  late final GeneratedColumn<int> currentStepIndex = GeneratedColumn<int>(
    'current_step_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _currentStepSnapshotIdMeta =
      const VerificationMeta('currentStepSnapshotId');
  @override
  late final GeneratedColumn<String> currentStepSnapshotId =
      GeneratedColumn<String>(
        'current_step_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _accumulatedMsMeta = const VerificationMeta(
    'accumulatedMs',
  );
  @override
  late final GeneratedColumn<int> accumulatedMs = GeneratedColumn<int>(
    'accumulated_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastTransitionAtMeta = const VerificationMeta(
    'lastTransitionAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastTransitionAt =
      GeneratedColumn<DateTime>(
        'last_transition_at',
        aliasedName,
        false,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: true,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    currentPassageIndex,
    currentStepIndex,
    currentStepSnapshotId,
    status,
    startedAt,
    accumulatedMs,
    lastTransitionAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_exercise_step_progress_states';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveExerciseStepProgressState> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('current_passage_index')) {
      context.handle(
        _currentPassageIndexMeta,
        currentPassageIndex.isAcceptableOrUnknown(
          data['current_passage_index']!,
          _currentPassageIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentPassageIndexMeta);
    }
    if (data.containsKey('current_step_index')) {
      context.handle(
        _currentStepIndexMeta,
        currentStepIndex.isAcceptableOrUnknown(
          data['current_step_index']!,
          _currentStepIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentStepIndexMeta);
    }
    if (data.containsKey('current_step_snapshot_id')) {
      context.handle(
        _currentStepSnapshotIdMeta,
        currentStepSnapshotId.isAcceptableOrUnknown(
          data['current_step_snapshot_id']!,
          _currentStepSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_currentStepSnapshotIdMeta);
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('accumulated_ms')) {
      context.handle(
        _accumulatedMsMeta,
        accumulatedMs.isAcceptableOrUnknown(
          data['accumulated_ms']!,
          _accumulatedMsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_accumulatedMsMeta);
    }
    if (data.containsKey('last_transition_at')) {
      context.handle(
        _lastTransitionAtMeta,
        lastTransitionAt.isAcceptableOrUnknown(
          data['last_transition_at']!,
          _lastTransitionAtMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_lastTransitionAtMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveExerciseStepProgressState map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveExerciseStepProgressState(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      currentPassageIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}current_passage_index'],
      )!,
      currentStepIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}current_step_index'],
      )!,
      currentStepSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}current_step_snapshot_id'],
      )!,
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      accumulatedMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}accumulated_ms'],
      )!,
      lastTransitionAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_transition_at'],
      )!,
    );
  }

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

class ActiveExerciseStepProgressState extends DataClass
    implements Insertable<ActiveExerciseStepProgressState> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final int currentPassageIndex;
  final int currentStepIndex;
  final String currentStepSnapshotId;
  final String status;
  final DateTime? startedAt;
  final int accumulatedMs;
  final DateTime lastTransitionAt;
  const ActiveExerciseStepProgressState({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.currentPassageIndex,
    required this.currentStepIndex,
    required this.currentStepSnapshotId,
    required this.status,
    this.startedAt,
    required this.accumulatedMs,
    required this.lastTransitionAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['current_passage_index'] = Variable<int>(currentPassageIndex);
    map['current_step_index'] = Variable<int>(currentStepIndex);
    map['current_step_snapshot_id'] = Variable<String>(currentStepSnapshotId);
    map['status'] = Variable<String>(status);
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    map['accumulated_ms'] = Variable<int>(accumulatedMs);
    map['last_transition_at'] = Variable<DateTime>(lastTransitionAt);
    return map;
  }

  ActiveExerciseStepProgressStatesCompanion toCompanion(bool nullToAbsent) {
    return ActiveExerciseStepProgressStatesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      currentPassageIndex: Value(currentPassageIndex),
      currentStepIndex: Value(currentStepIndex),
      currentStepSnapshotId: Value(currentStepSnapshotId),
      status: Value(status),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      accumulatedMs: Value(accumulatedMs),
      lastTransitionAt: Value(lastTransitionAt),
    );
  }

  factory ActiveExerciseStepProgressState.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveExerciseStepProgressState(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      currentPassageIndex: serializer.fromJson<int>(
        json['currentPassageIndex'],
      ),
      currentStepIndex: serializer.fromJson<int>(json['currentStepIndex']),
      currentStepSnapshotId: serializer.fromJson<String>(
        json['currentStepSnapshotId'],
      ),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      accumulatedMs: serializer.fromJson<int>(json['accumulatedMs']),
      lastTransitionAt: serializer.fromJson<DateTime>(json['lastTransitionAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'currentPassageIndex': serializer.toJson<int>(currentPassageIndex),
      'currentStepIndex': serializer.toJson<int>(currentStepIndex),
      'currentStepSnapshotId': serializer.toJson<String>(currentStepSnapshotId),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'accumulatedMs': serializer.toJson<int>(accumulatedMs),
      'lastTransitionAt': serializer.toJson<DateTime>(lastTransitionAt),
    };
  }

  ActiveExerciseStepProgressState copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    int? currentPassageIndex,
    int? currentStepIndex,
    String? currentStepSnapshotId,
    String? status,
    Value<DateTime?> startedAt = const Value.absent(),
    int? accumulatedMs,
    DateTime? lastTransitionAt,
  }) => ActiveExerciseStepProgressState(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    currentPassageIndex: currentPassageIndex ?? this.currentPassageIndex,
    currentStepIndex: currentStepIndex ?? this.currentStepIndex,
    currentStepSnapshotId: currentStepSnapshotId ?? this.currentStepSnapshotId,
    status: status ?? this.status,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    accumulatedMs: accumulatedMs ?? this.accumulatedMs,
    lastTransitionAt: lastTransitionAt ?? this.lastTransitionAt,
  );
  ActiveExerciseStepProgressState copyWithCompanion(
    ActiveExerciseStepProgressStatesCompanion data,
  ) {
    return ActiveExerciseStepProgressState(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      currentPassageIndex: data.currentPassageIndex.present
          ? data.currentPassageIndex.value
          : this.currentPassageIndex,
      currentStepIndex: data.currentStepIndex.present
          ? data.currentStepIndex.value
          : this.currentStepIndex,
      currentStepSnapshotId: data.currentStepSnapshotId.present
          ? data.currentStepSnapshotId.value
          : this.currentStepSnapshotId,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      accumulatedMs: data.accumulatedMs.present
          ? data.accumulatedMs.value
          : this.accumulatedMs,
      lastTransitionAt: data.lastTransitionAt.present
          ? data.lastTransitionAt.value
          : this.lastTransitionAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveExerciseStepProgressState(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('currentPassageIndex: $currentPassageIndex, ')
          ..write('currentStepIndex: $currentStepIndex, ')
          ..write('currentStepSnapshotId: $currentStepSnapshotId, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('lastTransitionAt: $lastTransitionAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    currentPassageIndex,
    currentStepIndex,
    currentStepSnapshotId,
    status,
    startedAt,
    accumulatedMs,
    lastTransitionAt,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveExerciseStepProgressState &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.currentPassageIndex == this.currentPassageIndex &&
          other.currentStepIndex == this.currentStepIndex &&
          other.currentStepSnapshotId == this.currentStepSnapshotId &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.accumulatedMs == this.accumulatedMs &&
          other.lastTransitionAt == this.lastTransitionAt);
}

class ActiveExerciseStepProgressStatesCompanion
    extends UpdateCompanion<ActiveExerciseStepProgressState> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<int> currentPassageIndex;
  final Value<int> currentStepIndex;
  final Value<String> currentStepSnapshotId;
  final Value<String> status;
  final Value<DateTime?> startedAt;
  final Value<int> accumulatedMs;
  final Value<DateTime> lastTransitionAt;
  final Value<int> rowid;
  const ActiveExerciseStepProgressStatesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.currentPassageIndex = const Value.absent(),
    this.currentStepIndex = const Value.absent(),
    this.currentStepSnapshotId = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.accumulatedMs = const Value.absent(),
    this.lastTransitionAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveExerciseStepProgressStatesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required int currentPassageIndex,
    required int currentStepIndex,
    required String currentStepSnapshotId,
    required String status,
    this.startedAt = const Value.absent(),
    required int accumulatedMs,
    required DateTime lastTransitionAt,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       currentPassageIndex = Value(currentPassageIndex),
       currentStepIndex = Value(currentStepIndex),
       currentStepSnapshotId = Value(currentStepSnapshotId),
       status = Value(status),
       accumulatedMs = Value(accumulatedMs),
       lastTransitionAt = Value(lastTransitionAt);
  static Insertable<ActiveExerciseStepProgressState> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<int>? currentPassageIndex,
    Expression<int>? currentStepIndex,
    Expression<String>? currentStepSnapshotId,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<int>? accumulatedMs,
    Expression<DateTime>? lastTransitionAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (currentPassageIndex != null)
        'current_passage_index': currentPassageIndex,
      if (currentStepIndex != null) 'current_step_index': currentStepIndex,
      if (currentStepSnapshotId != null)
        'current_step_snapshot_id': currentStepSnapshotId,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (accumulatedMs != null) 'accumulated_ms': accumulatedMs,
      if (lastTransitionAt != null) 'last_transition_at': lastTransitionAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveExerciseStepProgressStatesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<int>? currentPassageIndex,
    Value<int>? currentStepIndex,
    Value<String>? currentStepSnapshotId,
    Value<String>? status,
    Value<DateTime?>? startedAt,
    Value<int>? accumulatedMs,
    Value<DateTime>? lastTransitionAt,
    Value<int>? rowid,
  }) {
    return ActiveExerciseStepProgressStatesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      currentPassageIndex: currentPassageIndex ?? this.currentPassageIndex,
      currentStepIndex: currentStepIndex ?? this.currentStepIndex,
      currentStepSnapshotId:
          currentStepSnapshotId ?? this.currentStepSnapshotId,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      accumulatedMs: accumulatedMs ?? this.accumulatedMs,
      lastTransitionAt: lastTransitionAt ?? this.lastTransitionAt,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (currentPassageIndex.present) {
      map['current_passage_index'] = Variable<int>(currentPassageIndex.value);
    }
    if (currentStepIndex.present) {
      map['current_step_index'] = Variable<int>(currentStepIndex.value);
    }
    if (currentStepSnapshotId.present) {
      map['current_step_snapshot_id'] = Variable<String>(
        currentStepSnapshotId.value,
      );
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (accumulatedMs.present) {
      map['accumulated_ms'] = Variable<int>(accumulatedMs.value);
    }
    if (lastTransitionAt.present) {
      map['last_transition_at'] = Variable<DateTime>(lastTransitionAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveExerciseStepProgressStatesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('currentPassageIndex: $currentPassageIndex, ')
          ..write('currentStepIndex: $currentStepIndex, ')
          ..write('currentStepSnapshotId: $currentStepSnapshotId, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('lastTransitionAt: $lastTransitionAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveExerciseStepResultsTable extends ActiveExerciseStepResults
    with TableInfo<$ActiveExerciseStepResultsTable, ActiveExerciseStepResult> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveExerciseStepResultsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _programSnapshotIdMeta = const VerificationMeta(
    'programSnapshotId',
  );
  @override
  late final GeneratedColumn<String> programSnapshotId =
      GeneratedColumn<String>(
        'program_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseSnapshotIdMeta =
      const VerificationMeta('exerciseSnapshotId');
  @override
  late final GeneratedColumn<String> exerciseSnapshotId =
      GeneratedColumn<String>(
        'exercise_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _passageIndexMeta = const VerificationMeta(
    'passageIndex',
  );
  @override
  late final GeneratedColumn<int> passageIndex = GeneratedColumn<int>(
    'passage_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepIndexMeta = const VerificationMeta(
    'stepIndex',
  );
  @override
  late final GeneratedColumn<int> stepIndex = GeneratedColumn<int>(
    'step_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepSnapshotIdMeta = const VerificationMeta(
    'stepSnapshotId',
  );
  @override
  late final GeneratedColumn<String> stepSnapshotId = GeneratedColumn<String>(
    'step_snapshot_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepNameSnapshotMeta = const VerificationMeta(
    'stepNameSnapshot',
  );
  @override
  late final GeneratedColumn<String> stepNameSnapshot = GeneratedColumn<String>(
    'step_name_snapshot',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepTypeSnapshotMeta = const VerificationMeta(
    'stepTypeSnapshot',
  );
  @override
  late final GeneratedColumn<String> stepTypeSnapshot = GeneratedColumn<String>(
    'step_type_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _targetValueSnapshotMeta =
      const VerificationMeta('targetValueSnapshot');
  @override
  late final GeneratedColumn<int> targetValueSnapshot = GeneratedColumn<int>(
    'target_value_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _hasScoreSnapshotMeta = const VerificationMeta(
    'hasScoreSnapshot',
  );
  @override
  late final GeneratedColumn<bool> hasScoreSnapshot = GeneratedColumn<bool>(
    'has_score_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_score_snapshot" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreInputModeSnapshotMeta =
      const VerificationMeta('scoreInputModeSnapshot');
  @override
  late final GeneratedColumn<String> scoreInputModeSnapshot =
      GeneratedColumn<String>(
        'score_input_mode_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreLabelSnapshotMeta =
      const VerificationMeta('scoreLabelSnapshot');
  @override
  late final GeneratedColumn<String> scoreLabelSnapshot =
      GeneratedColumn<String>(
        'score_label_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreUnitSnapshotMeta = const VerificationMeta(
    'scoreUnitSnapshot',
  );
  @override
  late final GeneratedColumn<String> scoreUnitSnapshot =
      GeneratedColumn<String>(
        'score_unit_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreSnapshotMeta =
      const VerificationMeta('targetScoreSnapshot');
  @override
  late final GeneratedColumn<double> targetScoreSnapshot =
      GeneratedColumn<double>(
        'target_score_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreTimeMsSnapshotMeta =
      const VerificationMeta('targetScoreTimeMsSnapshot');
  @override
  late final GeneratedColumn<int> targetScoreTimeMsSnapshot =
      GeneratedColumn<int>(
        'target_score_time_ms_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _completedAtMeta = const VerificationMeta(
    'completedAt',
  );
  @override
  late final GeneratedColumn<DateTime> completedAt = GeneratedColumn<DateTime>(
    'completed_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualTimeMsMeta = const VerificationMeta(
    'actualTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualTimeMs = GeneratedColumn<int>(
    'actual_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualRepsMeta = const VerificationMeta(
    'actualReps',
  );
  @override
  late final GeneratedColumn<int> actualReps = GeneratedColumn<int>(
    'actual_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreMeta = const VerificationMeta(
    'actualScore',
  );
  @override
  late final GeneratedColumn<double> actualScore = GeneratedColumn<double>(
    'actual_score',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreTimeMsMeta = const VerificationMeta(
    'actualScoreTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualScoreTimeMs = GeneratedColumn<int>(
    'actual_score_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  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,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    passageIndex,
    stepIndex,
    stepSnapshotId,
    stepNameSnapshot,
    stepTypeSnapshot,
    targetValueSnapshot,
    hasScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    status,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    note,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_exercise_step_results';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveExerciseStepResult> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('program_snapshot_id')) {
      context.handle(
        _programSnapshotIdMeta,
        programSnapshotId.isAcceptableOrUnknown(
          data['program_snapshot_id']!,
          _programSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programSnapshotIdMeta);
    }
    if (data.containsKey('exercise_snapshot_id')) {
      context.handle(
        _exerciseSnapshotIdMeta,
        exerciseSnapshotId.isAcceptableOrUnknown(
          data['exercise_snapshot_id']!,
          _exerciseSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseSnapshotIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('passage_index')) {
      context.handle(
        _passageIndexMeta,
        passageIndex.isAcceptableOrUnknown(
          data['passage_index']!,
          _passageIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_passageIndexMeta);
    }
    if (data.containsKey('step_index')) {
      context.handle(
        _stepIndexMeta,
        stepIndex.isAcceptableOrUnknown(data['step_index']!, _stepIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_stepIndexMeta);
    }
    if (data.containsKey('step_snapshot_id')) {
      context.handle(
        _stepSnapshotIdMeta,
        stepSnapshotId.isAcceptableOrUnknown(
          data['step_snapshot_id']!,
          _stepSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepSnapshotIdMeta);
    }
    if (data.containsKey('step_name_snapshot')) {
      context.handle(
        _stepNameSnapshotMeta,
        stepNameSnapshot.isAcceptableOrUnknown(
          data['step_name_snapshot']!,
          _stepNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepNameSnapshotMeta);
    }
    if (data.containsKey('step_type_snapshot')) {
      context.handle(
        _stepTypeSnapshotMeta,
        stepTypeSnapshot.isAcceptableOrUnknown(
          data['step_type_snapshot']!,
          _stepTypeSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepTypeSnapshotMeta);
    }
    if (data.containsKey('target_value_snapshot')) {
      context.handle(
        _targetValueSnapshotMeta,
        targetValueSnapshot.isAcceptableOrUnknown(
          data['target_value_snapshot']!,
          _targetValueSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_targetValueSnapshotMeta);
    }
    if (data.containsKey('has_score_snapshot')) {
      context.handle(
        _hasScoreSnapshotMeta,
        hasScoreSnapshot.isAcceptableOrUnknown(
          data['has_score_snapshot']!,
          _hasScoreSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_hasScoreSnapshotMeta);
    }
    if (data.containsKey('score_input_mode_snapshot')) {
      context.handle(
        _scoreInputModeSnapshotMeta,
        scoreInputModeSnapshot.isAcceptableOrUnknown(
          data['score_input_mode_snapshot']!,
          _scoreInputModeSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_label_snapshot')) {
      context.handle(
        _scoreLabelSnapshotMeta,
        scoreLabelSnapshot.isAcceptableOrUnknown(
          data['score_label_snapshot']!,
          _scoreLabelSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_unit_snapshot')) {
      context.handle(
        _scoreUnitSnapshotMeta,
        scoreUnitSnapshot.isAcceptableOrUnknown(
          data['score_unit_snapshot']!,
          _scoreUnitSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_snapshot')) {
      context.handle(
        _targetScoreSnapshotMeta,
        targetScoreSnapshot.isAcceptableOrUnknown(
          data['target_score_snapshot']!,
          _targetScoreSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_time_ms_snapshot')) {
      context.handle(
        _targetScoreTimeMsSnapshotMeta,
        targetScoreTimeMsSnapshot.isAcceptableOrUnknown(
          data['target_score_time_ms_snapshot']!,
          _targetScoreTimeMsSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('completed_at')) {
      context.handle(
        _completedAtMeta,
        completedAt.isAcceptableOrUnknown(
          data['completed_at']!,
          _completedAtMeta,
        ),
      );
    }
    if (data.containsKey('actual_time_ms')) {
      context.handle(
        _actualTimeMsMeta,
        actualTimeMs.isAcceptableOrUnknown(
          data['actual_time_ms']!,
          _actualTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('actual_reps')) {
      context.handle(
        _actualRepsMeta,
        actualReps.isAcceptableOrUnknown(data['actual_reps']!, _actualRepsMeta),
      );
    }
    if (data.containsKey('actual_score')) {
      context.handle(
        _actualScoreMeta,
        actualScore.isAcceptableOrUnknown(
          data['actual_score']!,
          _actualScoreMeta,
        ),
      );
    }
    if (data.containsKey('actual_score_time_ms')) {
      context.handle(
        _actualScoreTimeMsMeta,
        actualScoreTimeMs.isAcceptableOrUnknown(
          data['actual_score_time_ms']!,
          _actualScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('note')) {
      context.handle(
        _noteMeta,
        note.isAcceptableOrUnknown(data['note']!, _noteMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveExerciseStepResult map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveExerciseStepResult(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      programSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_snapshot_id'],
      )!,
      exerciseSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_snapshot_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      passageIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}passage_index'],
      )!,
      stepIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}step_index'],
      )!,
      stepSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_snapshot_id'],
      )!,
      stepNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_name_snapshot'],
      )!,
      stepTypeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_type_snapshot'],
      )!,
      targetValueSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_value_snapshot'],
      )!,
      hasScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_score_snapshot'],
      )!,
      scoreInputModeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode_snapshot'],
      ),
      scoreLabelSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label_snapshot'],
      ),
      scoreUnitSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit_snapshot'],
      ),
      targetScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}target_score_snapshot'],
      ),
      targetScoreTimeMsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_score_time_ms_snapshot'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      completedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}completed_at'],
      ),
      actualTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_time_ms'],
      ),
      actualReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_reps'],
      ),
      actualScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}actual_score'],
      ),
      actualScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_score_time_ms'],
      ),
      note: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}note'],
      ),
    );
  }

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

class ActiveExerciseStepResult extends DataClass
    implements Insertable<ActiveExerciseStepResult> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final String programSnapshotId;
  final String exerciseSnapshotId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final int passageIndex;
  final int stepIndex;
  final String stepSnapshotId;
  final String stepNameSnapshot;
  final String stepTypeSnapshot;
  final int targetValueSnapshot;
  final bool hasScoreSnapshot;
  final String? scoreInputModeSnapshot;
  final String? scoreLabelSnapshot;
  final String? scoreUnitSnapshot;
  final double? targetScoreSnapshot;
  final int? targetScoreTimeMsSnapshot;
  final String status;
  final DateTime? startedAt;
  final DateTime? completedAt;
  final int? actualTimeMs;
  final int? actualReps;
  final double? actualScore;
  final int? actualScoreTimeMs;
  final String? note;
  const ActiveExerciseStepResult({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.programSnapshotId,
    required this.exerciseSnapshotId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.passageIndex,
    required this.stepIndex,
    required this.stepSnapshotId,
    required this.stepNameSnapshot,
    required this.stepTypeSnapshot,
    required this.targetValueSnapshot,
    required this.hasScoreSnapshot,
    this.scoreInputModeSnapshot,
    this.scoreLabelSnapshot,
    this.scoreUnitSnapshot,
    this.targetScoreSnapshot,
    this.targetScoreTimeMsSnapshot,
    required this.status,
    this.startedAt,
    this.completedAt,
    this.actualTimeMs,
    this.actualReps,
    this.actualScore,
    this.actualScoreTimeMs,
    this.note,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['program_snapshot_id'] = Variable<String>(programSnapshotId);
    map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['passage_index'] = Variable<int>(passageIndex);
    map['step_index'] = Variable<int>(stepIndex);
    map['step_snapshot_id'] = Variable<String>(stepSnapshotId);
    map['step_name_snapshot'] = Variable<String>(stepNameSnapshot);
    map['step_type_snapshot'] = Variable<String>(stepTypeSnapshot);
    map['target_value_snapshot'] = Variable<int>(targetValueSnapshot);
    map['has_score_snapshot'] = Variable<bool>(hasScoreSnapshot);
    if (!nullToAbsent || scoreInputModeSnapshot != null) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot,
      );
    }
    if (!nullToAbsent || scoreLabelSnapshot != null) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot);
    }
    if (!nullToAbsent || scoreUnitSnapshot != null) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot);
    }
    if (!nullToAbsent || targetScoreSnapshot != null) {
      map['target_score_snapshot'] = Variable<double>(targetScoreSnapshot);
    }
    if (!nullToAbsent || targetScoreTimeMsSnapshot != null) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot,
      );
    }
    map['status'] = Variable<String>(status);
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    if (!nullToAbsent || completedAt != null) {
      map['completed_at'] = Variable<DateTime>(completedAt);
    }
    if (!nullToAbsent || actualTimeMs != null) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs);
    }
    if (!nullToAbsent || actualReps != null) {
      map['actual_reps'] = Variable<int>(actualReps);
    }
    if (!nullToAbsent || actualScore != null) {
      map['actual_score'] = Variable<double>(actualScore);
    }
    if (!nullToAbsent || actualScoreTimeMs != null) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs);
    }
    if (!nullToAbsent || note != null) {
      map['note'] = Variable<String>(note);
    }
    return map;
  }

  ActiveExerciseStepResultsCompanion toCompanion(bool nullToAbsent) {
    return ActiveExerciseStepResultsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      programSnapshotId: Value(programSnapshotId),
      exerciseSnapshotId: Value(exerciseSnapshotId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      passageIndex: Value(passageIndex),
      stepIndex: Value(stepIndex),
      stepSnapshotId: Value(stepSnapshotId),
      stepNameSnapshot: Value(stepNameSnapshot),
      stepTypeSnapshot: Value(stepTypeSnapshot),
      targetValueSnapshot: Value(targetValueSnapshot),
      hasScoreSnapshot: Value(hasScoreSnapshot),
      scoreInputModeSnapshot: scoreInputModeSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreInputModeSnapshot),
      scoreLabelSnapshot: scoreLabelSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabelSnapshot),
      scoreUnitSnapshot: scoreUnitSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnitSnapshot),
      targetScoreSnapshot: targetScoreSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreSnapshot),
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreTimeMsSnapshot),
      status: Value(status),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      completedAt: completedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(completedAt),
      actualTimeMs: actualTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualTimeMs),
      actualReps: actualReps == null && nullToAbsent
          ? const Value.absent()
          : Value(actualReps),
      actualScore: actualScore == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScore),
      actualScoreTimeMs: actualScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScoreTimeMs),
      note: note == null && nullToAbsent ? const Value.absent() : Value(note),
    );
  }

  factory ActiveExerciseStepResult.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveExerciseStepResult(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      programSnapshotId: serializer.fromJson<String>(json['programSnapshotId']),
      exerciseSnapshotId: serializer.fromJson<String>(
        json['exerciseSnapshotId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      passageIndex: serializer.fromJson<int>(json['passageIndex']),
      stepIndex: serializer.fromJson<int>(json['stepIndex']),
      stepSnapshotId: serializer.fromJson<String>(json['stepSnapshotId']),
      stepNameSnapshot: serializer.fromJson<String>(json['stepNameSnapshot']),
      stepTypeSnapshot: serializer.fromJson<String>(json['stepTypeSnapshot']),
      targetValueSnapshot: serializer.fromJson<int>(
        json['targetValueSnapshot'],
      ),
      hasScoreSnapshot: serializer.fromJson<bool>(json['hasScoreSnapshot']),
      scoreInputModeSnapshot: serializer.fromJson<String?>(
        json['scoreInputModeSnapshot'],
      ),
      scoreLabelSnapshot: serializer.fromJson<String?>(
        json['scoreLabelSnapshot'],
      ),
      scoreUnitSnapshot: serializer.fromJson<String?>(
        json['scoreUnitSnapshot'],
      ),
      targetScoreSnapshot: serializer.fromJson<double?>(
        json['targetScoreSnapshot'],
      ),
      targetScoreTimeMsSnapshot: serializer.fromJson<int?>(
        json['targetScoreTimeMsSnapshot'],
      ),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      completedAt: serializer.fromJson<DateTime?>(json['completedAt']),
      actualTimeMs: serializer.fromJson<int?>(json['actualTimeMs']),
      actualReps: serializer.fromJson<int?>(json['actualReps']),
      actualScore: serializer.fromJson<double?>(json['actualScore']),
      actualScoreTimeMs: serializer.fromJson<int?>(json['actualScoreTimeMs']),
      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<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'programSnapshotId': serializer.toJson<String>(programSnapshotId),
      'exerciseSnapshotId': serializer.toJson<String>(exerciseSnapshotId),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'passageIndex': serializer.toJson<int>(passageIndex),
      'stepIndex': serializer.toJson<int>(stepIndex),
      'stepSnapshotId': serializer.toJson<String>(stepSnapshotId),
      'stepNameSnapshot': serializer.toJson<String>(stepNameSnapshot),
      'stepTypeSnapshot': serializer.toJson<String>(stepTypeSnapshot),
      'targetValueSnapshot': serializer.toJson<int>(targetValueSnapshot),
      'hasScoreSnapshot': serializer.toJson<bool>(hasScoreSnapshot),
      'scoreInputModeSnapshot': serializer.toJson<String?>(
        scoreInputModeSnapshot,
      ),
      'scoreLabelSnapshot': serializer.toJson<String?>(scoreLabelSnapshot),
      'scoreUnitSnapshot': serializer.toJson<String?>(scoreUnitSnapshot),
      'targetScoreSnapshot': serializer.toJson<double?>(targetScoreSnapshot),
      'targetScoreTimeMsSnapshot': serializer.toJson<int?>(
        targetScoreTimeMsSnapshot,
      ),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'completedAt': serializer.toJson<DateTime?>(completedAt),
      'actualTimeMs': serializer.toJson<int?>(actualTimeMs),
      'actualReps': serializer.toJson<int?>(actualReps),
      'actualScore': serializer.toJson<double?>(actualScore),
      'actualScoreTimeMs': serializer.toJson<int?>(actualScoreTimeMs),
      'note': serializer.toJson<String?>(note),
    };
  }

  ActiveExerciseStepResult copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    String? programSnapshotId,
    String? exerciseSnapshotId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    int? passageIndex,
    int? stepIndex,
    String? stepSnapshotId,
    String? stepNameSnapshot,
    String? stepTypeSnapshot,
    int? targetValueSnapshot,
    bool? hasScoreSnapshot,
    Value<String?> scoreInputModeSnapshot = const Value.absent(),
    Value<String?> scoreLabelSnapshot = const Value.absent(),
    Value<String?> scoreUnitSnapshot = const Value.absent(),
    Value<double?> targetScoreSnapshot = const Value.absent(),
    Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
    String? status,
    Value<DateTime?> startedAt = const Value.absent(),
    Value<DateTime?> completedAt = const Value.absent(),
    Value<int?> actualTimeMs = const Value.absent(),
    Value<int?> actualReps = const Value.absent(),
    Value<double?> actualScore = const Value.absent(),
    Value<int?> actualScoreTimeMs = const Value.absent(),
    Value<String?> note = const Value.absent(),
  }) => ActiveExerciseStepResult(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    programSnapshotId: programSnapshotId ?? this.programSnapshotId,
    exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    passageIndex: passageIndex ?? this.passageIndex,
    stepIndex: stepIndex ?? this.stepIndex,
    stepSnapshotId: stepSnapshotId ?? this.stepSnapshotId,
    stepNameSnapshot: stepNameSnapshot ?? this.stepNameSnapshot,
    stepTypeSnapshot: stepTypeSnapshot ?? this.stepTypeSnapshot,
    targetValueSnapshot: targetValueSnapshot ?? this.targetValueSnapshot,
    hasScoreSnapshot: hasScoreSnapshot ?? this.hasScoreSnapshot,
    scoreInputModeSnapshot: scoreInputModeSnapshot.present
        ? scoreInputModeSnapshot.value
        : this.scoreInputModeSnapshot,
    scoreLabelSnapshot: scoreLabelSnapshot.present
        ? scoreLabelSnapshot.value
        : this.scoreLabelSnapshot,
    scoreUnitSnapshot: scoreUnitSnapshot.present
        ? scoreUnitSnapshot.value
        : this.scoreUnitSnapshot,
    targetScoreSnapshot: targetScoreSnapshot.present
        ? targetScoreSnapshot.value
        : this.targetScoreSnapshot,
    targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot.present
        ? targetScoreTimeMsSnapshot.value
        : this.targetScoreTimeMsSnapshot,
    status: status ?? this.status,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    completedAt: completedAt.present ? completedAt.value : this.completedAt,
    actualTimeMs: actualTimeMs.present ? actualTimeMs.value : this.actualTimeMs,
    actualReps: actualReps.present ? actualReps.value : this.actualReps,
    actualScore: actualScore.present ? actualScore.value : this.actualScore,
    actualScoreTimeMs: actualScoreTimeMs.present
        ? actualScoreTimeMs.value
        : this.actualScoreTimeMs,
    note: note.present ? note.value : this.note,
  );
  ActiveExerciseStepResult copyWithCompanion(
    ActiveExerciseStepResultsCompanion data,
  ) {
    return ActiveExerciseStepResult(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      programSnapshotId: data.programSnapshotId.present
          ? data.programSnapshotId.value
          : this.programSnapshotId,
      exerciseSnapshotId: data.exerciseSnapshotId.present
          ? data.exerciseSnapshotId.value
          : this.exerciseSnapshotId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      passageIndex: data.passageIndex.present
          ? data.passageIndex.value
          : this.passageIndex,
      stepIndex: data.stepIndex.present ? data.stepIndex.value : this.stepIndex,
      stepSnapshotId: data.stepSnapshotId.present
          ? data.stepSnapshotId.value
          : this.stepSnapshotId,
      stepNameSnapshot: data.stepNameSnapshot.present
          ? data.stepNameSnapshot.value
          : this.stepNameSnapshot,
      stepTypeSnapshot: data.stepTypeSnapshot.present
          ? data.stepTypeSnapshot.value
          : this.stepTypeSnapshot,
      targetValueSnapshot: data.targetValueSnapshot.present
          ? data.targetValueSnapshot.value
          : this.targetValueSnapshot,
      hasScoreSnapshot: data.hasScoreSnapshot.present
          ? data.hasScoreSnapshot.value
          : this.hasScoreSnapshot,
      scoreInputModeSnapshot: data.scoreInputModeSnapshot.present
          ? data.scoreInputModeSnapshot.value
          : this.scoreInputModeSnapshot,
      scoreLabelSnapshot: data.scoreLabelSnapshot.present
          ? data.scoreLabelSnapshot.value
          : this.scoreLabelSnapshot,
      scoreUnitSnapshot: data.scoreUnitSnapshot.present
          ? data.scoreUnitSnapshot.value
          : this.scoreUnitSnapshot,
      targetScoreSnapshot: data.targetScoreSnapshot.present
          ? data.targetScoreSnapshot.value
          : this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot: data.targetScoreTimeMsSnapshot.present
          ? data.targetScoreTimeMsSnapshot.value
          : this.targetScoreTimeMsSnapshot,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      completedAt: data.completedAt.present
          ? data.completedAt.value
          : this.completedAt,
      actualTimeMs: data.actualTimeMs.present
          ? data.actualTimeMs.value
          : this.actualTimeMs,
      actualReps: data.actualReps.present
          ? data.actualReps.value
          : this.actualReps,
      actualScore: data.actualScore.present
          ? data.actualScore.value
          : this.actualScore,
      actualScoreTimeMs: data.actualScoreTimeMs.present
          ? data.actualScoreTimeMs.value
          : this.actualScoreTimeMs,
      note: data.note.present ? data.note.value : this.note,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveExerciseStepResult(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('passageIndex: $passageIndex, ')
          ..write('stepIndex: $stepIndex, ')
          ..write('stepSnapshotId: $stepSnapshotId, ')
          ..write('stepNameSnapshot: $stepNameSnapshot, ')
          ..write('stepTypeSnapshot: $stepTypeSnapshot, ')
          ..write('targetValueSnapshot: $targetValueSnapshot, ')
          ..write('hasScoreSnapshot: $hasScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('note: $note')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    passageIndex,
    stepIndex,
    stepSnapshotId,
    stepNameSnapshot,
    stepTypeSnapshot,
    targetValueSnapshot,
    hasScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    status,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    note,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveExerciseStepResult &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.programSnapshotId == this.programSnapshotId &&
          other.exerciseSnapshotId == this.exerciseSnapshotId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.passageIndex == this.passageIndex &&
          other.stepIndex == this.stepIndex &&
          other.stepSnapshotId == this.stepSnapshotId &&
          other.stepNameSnapshot == this.stepNameSnapshot &&
          other.stepTypeSnapshot == this.stepTypeSnapshot &&
          other.targetValueSnapshot == this.targetValueSnapshot &&
          other.hasScoreSnapshot == this.hasScoreSnapshot &&
          other.scoreInputModeSnapshot == this.scoreInputModeSnapshot &&
          other.scoreLabelSnapshot == this.scoreLabelSnapshot &&
          other.scoreUnitSnapshot == this.scoreUnitSnapshot &&
          other.targetScoreSnapshot == this.targetScoreSnapshot &&
          other.targetScoreTimeMsSnapshot == this.targetScoreTimeMsSnapshot &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.completedAt == this.completedAt &&
          other.actualTimeMs == this.actualTimeMs &&
          other.actualReps == this.actualReps &&
          other.actualScore == this.actualScore &&
          other.actualScoreTimeMs == this.actualScoreTimeMs &&
          other.note == this.note);
}

class ActiveExerciseStepResultsCompanion
    extends UpdateCompanion<ActiveExerciseStepResult> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<String> programSnapshotId;
  final Value<String> exerciseSnapshotId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<int> passageIndex;
  final Value<int> stepIndex;
  final Value<String> stepSnapshotId;
  final Value<String> stepNameSnapshot;
  final Value<String> stepTypeSnapshot;
  final Value<int> targetValueSnapshot;
  final Value<bool> hasScoreSnapshot;
  final Value<String?> scoreInputModeSnapshot;
  final Value<String?> scoreLabelSnapshot;
  final Value<String?> scoreUnitSnapshot;
  final Value<double?> targetScoreSnapshot;
  final Value<int?> targetScoreTimeMsSnapshot;
  final Value<String> status;
  final Value<DateTime?> startedAt;
  final Value<DateTime?> completedAt;
  final Value<int?> actualTimeMs;
  final Value<int?> actualReps;
  final Value<double?> actualScore;
  final Value<int?> actualScoreTimeMs;
  final Value<String?> note;
  final Value<int> rowid;
  const ActiveExerciseStepResultsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.programSnapshotId = const Value.absent(),
    this.exerciseSnapshotId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.passageIndex = const Value.absent(),
    this.stepIndex = const Value.absent(),
    this.stepSnapshotId = const Value.absent(),
    this.stepNameSnapshot = const Value.absent(),
    this.stepTypeSnapshot = const Value.absent(),
    this.targetValueSnapshot = const Value.absent(),
    this.hasScoreSnapshot = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.note = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveExerciseStepResultsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required String programSnapshotId,
    required String exerciseSnapshotId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required int passageIndex,
    required int stepIndex,
    required String stepSnapshotId,
    required String stepNameSnapshot,
    required String stepTypeSnapshot,
    required int targetValueSnapshot,
    required bool hasScoreSnapshot,
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    required String status,
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.note = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       programSnapshotId = Value(programSnapshotId),
       exerciseSnapshotId = Value(exerciseSnapshotId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       passageIndex = Value(passageIndex),
       stepIndex = Value(stepIndex),
       stepSnapshotId = Value(stepSnapshotId),
       stepNameSnapshot = Value(stepNameSnapshot),
       stepTypeSnapshot = Value(stepTypeSnapshot),
       targetValueSnapshot = Value(targetValueSnapshot),
       hasScoreSnapshot = Value(hasScoreSnapshot),
       status = Value(status);
  static Insertable<ActiveExerciseStepResult> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<String>? programSnapshotId,
    Expression<String>? exerciseSnapshotId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<int>? passageIndex,
    Expression<int>? stepIndex,
    Expression<String>? stepSnapshotId,
    Expression<String>? stepNameSnapshot,
    Expression<String>? stepTypeSnapshot,
    Expression<int>? targetValueSnapshot,
    Expression<bool>? hasScoreSnapshot,
    Expression<String>? scoreInputModeSnapshot,
    Expression<String>? scoreLabelSnapshot,
    Expression<String>? scoreUnitSnapshot,
    Expression<double>? targetScoreSnapshot,
    Expression<int>? targetScoreTimeMsSnapshot,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? completedAt,
    Expression<int>? actualTimeMs,
    Expression<int>? actualReps,
    Expression<double>? actualScore,
    Expression<int>? actualScoreTimeMs,
    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 (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (programSnapshotId != null) 'program_snapshot_id': programSnapshotId,
      if (exerciseSnapshotId != null)
        'exercise_snapshot_id': exerciseSnapshotId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (passageIndex != null) 'passage_index': passageIndex,
      if (stepIndex != null) 'step_index': stepIndex,
      if (stepSnapshotId != null) 'step_snapshot_id': stepSnapshotId,
      if (stepNameSnapshot != null) 'step_name_snapshot': stepNameSnapshot,
      if (stepTypeSnapshot != null) 'step_type_snapshot': stepTypeSnapshot,
      if (targetValueSnapshot != null)
        'target_value_snapshot': targetValueSnapshot,
      if (hasScoreSnapshot != null) 'has_score_snapshot': hasScoreSnapshot,
      if (scoreInputModeSnapshot != null)
        'score_input_mode_snapshot': scoreInputModeSnapshot,
      if (scoreLabelSnapshot != null)
        'score_label_snapshot': scoreLabelSnapshot,
      if (scoreUnitSnapshot != null) 'score_unit_snapshot': scoreUnitSnapshot,
      if (targetScoreSnapshot != null)
        'target_score_snapshot': targetScoreSnapshot,
      if (targetScoreTimeMsSnapshot != null)
        'target_score_time_ms_snapshot': targetScoreTimeMsSnapshot,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (completedAt != null) 'completed_at': completedAt,
      if (actualTimeMs != null) 'actual_time_ms': actualTimeMs,
      if (actualReps != null) 'actual_reps': actualReps,
      if (actualScore != null) 'actual_score': actualScore,
      if (actualScoreTimeMs != null) 'actual_score_time_ms': actualScoreTimeMs,
      if (note != null) 'note': note,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveExerciseStepResultsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<String>? programSnapshotId,
    Value<String>? exerciseSnapshotId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<int>? passageIndex,
    Value<int>? stepIndex,
    Value<String>? stepSnapshotId,
    Value<String>? stepNameSnapshot,
    Value<String>? stepTypeSnapshot,
    Value<int>? targetValueSnapshot,
    Value<bool>? hasScoreSnapshot,
    Value<String?>? scoreInputModeSnapshot,
    Value<String?>? scoreLabelSnapshot,
    Value<String?>? scoreUnitSnapshot,
    Value<double?>? targetScoreSnapshot,
    Value<int?>? targetScoreTimeMsSnapshot,
    Value<String>? status,
    Value<DateTime?>? startedAt,
    Value<DateTime?>? completedAt,
    Value<int?>? actualTimeMs,
    Value<int?>? actualReps,
    Value<double?>? actualScore,
    Value<int?>? actualScoreTimeMs,
    Value<String?>? note,
    Value<int>? rowid,
  }) {
    return ActiveExerciseStepResultsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      programSnapshotId: programSnapshotId ?? this.programSnapshotId,
      exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      passageIndex: passageIndex ?? this.passageIndex,
      stepIndex: stepIndex ?? this.stepIndex,
      stepSnapshotId: stepSnapshotId ?? this.stepSnapshotId,
      stepNameSnapshot: stepNameSnapshot ?? this.stepNameSnapshot,
      stepTypeSnapshot: stepTypeSnapshot ?? this.stepTypeSnapshot,
      targetValueSnapshot: targetValueSnapshot ?? this.targetValueSnapshot,
      hasScoreSnapshot: hasScoreSnapshot ?? this.hasScoreSnapshot,
      scoreInputModeSnapshot:
          scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
      scoreLabelSnapshot: scoreLabelSnapshot ?? this.scoreLabelSnapshot,
      scoreUnitSnapshot: scoreUnitSnapshot ?? this.scoreUnitSnapshot,
      targetScoreSnapshot: targetScoreSnapshot ?? this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot ?? this.targetScoreTimeMsSnapshot,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      completedAt: completedAt ?? this.completedAt,
      actualTimeMs: actualTimeMs ?? this.actualTimeMs,
      actualReps: actualReps ?? this.actualReps,
      actualScore: actualScore ?? this.actualScore,
      actualScoreTimeMs: actualScoreTimeMs ?? this.actualScoreTimeMs,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (programSnapshotId.present) {
      map['program_snapshot_id'] = Variable<String>(programSnapshotId.value);
    }
    if (exerciseSnapshotId.present) {
      map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId.value);
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (passageIndex.present) {
      map['passage_index'] = Variable<int>(passageIndex.value);
    }
    if (stepIndex.present) {
      map['step_index'] = Variable<int>(stepIndex.value);
    }
    if (stepSnapshotId.present) {
      map['step_snapshot_id'] = Variable<String>(stepSnapshotId.value);
    }
    if (stepNameSnapshot.present) {
      map['step_name_snapshot'] = Variable<String>(stepNameSnapshot.value);
    }
    if (stepTypeSnapshot.present) {
      map['step_type_snapshot'] = Variable<String>(stepTypeSnapshot.value);
    }
    if (targetValueSnapshot.present) {
      map['target_value_snapshot'] = Variable<int>(targetValueSnapshot.value);
    }
    if (hasScoreSnapshot.present) {
      map['has_score_snapshot'] = Variable<bool>(hasScoreSnapshot.value);
    }
    if (scoreInputModeSnapshot.present) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot.value,
      );
    }
    if (scoreLabelSnapshot.present) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot.value);
    }
    if (scoreUnitSnapshot.present) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot.value);
    }
    if (targetScoreSnapshot.present) {
      map['target_score_snapshot'] = Variable<double>(
        targetScoreSnapshot.value,
      );
    }
    if (targetScoreTimeMsSnapshot.present) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot.value,
      );
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (completedAt.present) {
      map['completed_at'] = Variable<DateTime>(completedAt.value);
    }
    if (actualTimeMs.present) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs.value);
    }
    if (actualReps.present) {
      map['actual_reps'] = Variable<int>(actualReps.value);
    }
    if (actualScore.present) {
      map['actual_score'] = Variable<double>(actualScore.value);
    }
    if (actualScoreTimeMs.present) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs.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('ActiveExerciseStepResultsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('passageIndex: $passageIndex, ')
          ..write('stepIndex: $stepIndex, ')
          ..write('stepSnapshotId: $stepSnapshotId, ')
          ..write('stepNameSnapshot: $stepNameSnapshot, ')
          ..write('stepTypeSnapshot: $stepTypeSnapshot, ')
          ..write('targetValueSnapshot: $targetValueSnapshot, ')
          ..write('hasScoreSnapshot: $hasScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('note: $note, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveRestStatesTable extends ActiveRestStates
    with TableInfo<$ActiveRestStatesTable, ActiveRestState> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveRestStatesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _afterProgramIndexMeta = const VerificationMeta(
    'afterProgramIndex',
  );
  @override
  late final GeneratedColumn<int> afterProgramIndex = GeneratedColumn<int>(
    'after_program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _afterExerciseIndexMeta =
      const VerificationMeta('afterExerciseIndex');
  @override
  late final GeneratedColumn<int> afterExerciseIndex = GeneratedColumn<int>(
    'after_exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _afterSetIndexMeta = const VerificationMeta(
    'afterSetIndex',
  );
  @override
  late final GeneratedColumn<int> afterSetIndex = GeneratedColumn<int>(
    'after_set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _plannedRestSecondsMeta =
      const VerificationMeta('plannedRestSeconds');
  @override
  late final GeneratedColumn<int> plannedRestSeconds = GeneratedColumn<int>(
    'planned_rest_seconds',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _adjustedRestSecondsMeta =
      const VerificationMeta('adjustedRestSeconds');
  @override
  late final GeneratedColumn<int> adjustedRestSeconds = GeneratedColumn<int>(
    'adjusted_rest_seconds',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _endedAtMeta = const VerificationMeta(
    'endedAt',
  );
  @override
  late final GeneratedColumn<DateTime> endedAt = GeneratedColumn<DateTime>(
    'ended_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _skippedAtMeta = const VerificationMeta(
    'skippedAt',
  );
  @override
  late final GeneratedColumn<DateTime> skippedAt = GeneratedColumn<DateTime>(
    'skipped_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _pausedAtMeta = const VerificationMeta(
    'pausedAt',
  );
  @override
  late final GeneratedColumn<DateTime> pausedAt = GeneratedColumn<DateTime>(
    'paused_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _accumulatedPausedMsMeta =
      const VerificationMeta('accumulatedPausedMs');
  @override
  late final GeneratedColumn<int> accumulatedPausedMs = GeneratedColumn<int>(
    'accumulated_paused_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(0),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    afterProgramIndex,
    afterExerciseIndex,
    afterSetIndex,
    plannedRestSeconds,
    adjustedRestSeconds,
    startedAt,
    endedAt,
    skippedAt,
    pausedAt,
    accumulatedPausedMs,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_rest_states';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveRestState> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('after_program_index')) {
      context.handle(
        _afterProgramIndexMeta,
        afterProgramIndex.isAcceptableOrUnknown(
          data['after_program_index']!,
          _afterProgramIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_afterProgramIndexMeta);
    }
    if (data.containsKey('after_exercise_index')) {
      context.handle(
        _afterExerciseIndexMeta,
        afterExerciseIndex.isAcceptableOrUnknown(
          data['after_exercise_index']!,
          _afterExerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_afterExerciseIndexMeta);
    }
    if (data.containsKey('after_set_index')) {
      context.handle(
        _afterSetIndexMeta,
        afterSetIndex.isAcceptableOrUnknown(
          data['after_set_index']!,
          _afterSetIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_afterSetIndexMeta);
    }
    if (data.containsKey('planned_rest_seconds')) {
      context.handle(
        _plannedRestSecondsMeta,
        plannedRestSeconds.isAcceptableOrUnknown(
          data['planned_rest_seconds']!,
          _plannedRestSecondsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_plannedRestSecondsMeta);
    }
    if (data.containsKey('adjusted_rest_seconds')) {
      context.handle(
        _adjustedRestSecondsMeta,
        adjustedRestSeconds.isAcceptableOrUnknown(
          data['adjusted_rest_seconds']!,
          _adjustedRestSecondsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_adjustedRestSecondsMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_startedAtMeta);
    }
    if (data.containsKey('ended_at')) {
      context.handle(
        _endedAtMeta,
        endedAt.isAcceptableOrUnknown(data['ended_at']!, _endedAtMeta),
      );
    }
    if (data.containsKey('skipped_at')) {
      context.handle(
        _skippedAtMeta,
        skippedAt.isAcceptableOrUnknown(data['skipped_at']!, _skippedAtMeta),
      );
    }
    if (data.containsKey('paused_at')) {
      context.handle(
        _pausedAtMeta,
        pausedAt.isAcceptableOrUnknown(data['paused_at']!, _pausedAtMeta),
      );
    }
    if (data.containsKey('accumulated_paused_ms')) {
      context.handle(
        _accumulatedPausedMsMeta,
        accumulatedPausedMs.isAcceptableOrUnknown(
          data['accumulated_paused_ms']!,
          _accumulatedPausedMsMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveRestState map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveRestState(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      afterProgramIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}after_program_index'],
      )!,
      afterExerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}after_exercise_index'],
      )!,
      afterSetIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}after_set_index'],
      )!,
      plannedRestSeconds: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}planned_rest_seconds'],
      )!,
      adjustedRestSeconds: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}adjusted_rest_seconds'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      )!,
      endedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}ended_at'],
      ),
      skippedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}skipped_at'],
      ),
      pausedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}paused_at'],
      ),
      accumulatedPausedMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}accumulated_paused_ms'],
      )!,
    );
  }

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

class ActiveRestState extends DataClass implements Insertable<ActiveRestState> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final int afterProgramIndex;
  final int afterExerciseIndex;
  final int afterSetIndex;
  final int plannedRestSeconds;
  final int adjustedRestSeconds;
  final DateTime startedAt;
  final DateTime? endedAt;
  final DateTime? skippedAt;
  final DateTime? pausedAt;
  final int accumulatedPausedMs;
  const ActiveRestState({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.afterProgramIndex,
    required this.afterExerciseIndex,
    required this.afterSetIndex,
    required this.plannedRestSeconds,
    required this.adjustedRestSeconds,
    required this.startedAt,
    this.endedAt,
    this.skippedAt,
    this.pausedAt,
    required this.accumulatedPausedMs,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['after_program_index'] = Variable<int>(afterProgramIndex);
    map['after_exercise_index'] = Variable<int>(afterExerciseIndex);
    map['after_set_index'] = Variable<int>(afterSetIndex);
    map['planned_rest_seconds'] = Variable<int>(plannedRestSeconds);
    map['adjusted_rest_seconds'] = Variable<int>(adjustedRestSeconds);
    map['started_at'] = Variable<DateTime>(startedAt);
    if (!nullToAbsent || endedAt != null) {
      map['ended_at'] = Variable<DateTime>(endedAt);
    }
    if (!nullToAbsent || skippedAt != null) {
      map['skipped_at'] = Variable<DateTime>(skippedAt);
    }
    if (!nullToAbsent || pausedAt != null) {
      map['paused_at'] = Variable<DateTime>(pausedAt);
    }
    map['accumulated_paused_ms'] = Variable<int>(accumulatedPausedMs);
    return map;
  }

  ActiveRestStatesCompanion toCompanion(bool nullToAbsent) {
    return ActiveRestStatesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      afterProgramIndex: Value(afterProgramIndex),
      afterExerciseIndex: Value(afterExerciseIndex),
      afterSetIndex: Value(afterSetIndex),
      plannedRestSeconds: Value(plannedRestSeconds),
      adjustedRestSeconds: Value(adjustedRestSeconds),
      startedAt: Value(startedAt),
      endedAt: endedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(endedAt),
      skippedAt: skippedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(skippedAt),
      pausedAt: pausedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(pausedAt),
      accumulatedPausedMs: Value(accumulatedPausedMs),
    );
  }

  factory ActiveRestState.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveRestState(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      afterProgramIndex: serializer.fromJson<int>(json['afterProgramIndex']),
      afterExerciseIndex: serializer.fromJson<int>(json['afterExerciseIndex']),
      afterSetIndex: serializer.fromJson<int>(json['afterSetIndex']),
      plannedRestSeconds: serializer.fromJson<int>(json['plannedRestSeconds']),
      adjustedRestSeconds: serializer.fromJson<int>(
        json['adjustedRestSeconds'],
      ),
      startedAt: serializer.fromJson<DateTime>(json['startedAt']),
      endedAt: serializer.fromJson<DateTime?>(json['endedAt']),
      skippedAt: serializer.fromJson<DateTime?>(json['skippedAt']),
      pausedAt: serializer.fromJson<DateTime?>(json['pausedAt']),
      accumulatedPausedMs: serializer.fromJson<int>(
        json['accumulatedPausedMs'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'afterProgramIndex': serializer.toJson<int>(afterProgramIndex),
      'afterExerciseIndex': serializer.toJson<int>(afterExerciseIndex),
      'afterSetIndex': serializer.toJson<int>(afterSetIndex),
      'plannedRestSeconds': serializer.toJson<int>(plannedRestSeconds),
      'adjustedRestSeconds': serializer.toJson<int>(adjustedRestSeconds),
      'startedAt': serializer.toJson<DateTime>(startedAt),
      'endedAt': serializer.toJson<DateTime?>(endedAt),
      'skippedAt': serializer.toJson<DateTime?>(skippedAt),
      'pausedAt': serializer.toJson<DateTime?>(pausedAt),
      'accumulatedPausedMs': serializer.toJson<int>(accumulatedPausedMs),
    };
  }

  ActiveRestState copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    int? afterProgramIndex,
    int? afterExerciseIndex,
    int? afterSetIndex,
    int? plannedRestSeconds,
    int? adjustedRestSeconds,
    DateTime? startedAt,
    Value<DateTime?> endedAt = const Value.absent(),
    Value<DateTime?> skippedAt = const Value.absent(),
    Value<DateTime?> pausedAt = const Value.absent(),
    int? accumulatedPausedMs,
  }) => ActiveRestState(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    afterProgramIndex: afterProgramIndex ?? this.afterProgramIndex,
    afterExerciseIndex: afterExerciseIndex ?? this.afterExerciseIndex,
    afterSetIndex: afterSetIndex ?? this.afterSetIndex,
    plannedRestSeconds: plannedRestSeconds ?? this.plannedRestSeconds,
    adjustedRestSeconds: adjustedRestSeconds ?? this.adjustedRestSeconds,
    startedAt: startedAt ?? this.startedAt,
    endedAt: endedAt.present ? endedAt.value : this.endedAt,
    skippedAt: skippedAt.present ? skippedAt.value : this.skippedAt,
    pausedAt: pausedAt.present ? pausedAt.value : this.pausedAt,
    accumulatedPausedMs: accumulatedPausedMs ?? this.accumulatedPausedMs,
  );
  ActiveRestState copyWithCompanion(ActiveRestStatesCompanion data) {
    return ActiveRestState(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      afterProgramIndex: data.afterProgramIndex.present
          ? data.afterProgramIndex.value
          : this.afterProgramIndex,
      afterExerciseIndex: data.afterExerciseIndex.present
          ? data.afterExerciseIndex.value
          : this.afterExerciseIndex,
      afterSetIndex: data.afterSetIndex.present
          ? data.afterSetIndex.value
          : this.afterSetIndex,
      plannedRestSeconds: data.plannedRestSeconds.present
          ? data.plannedRestSeconds.value
          : this.plannedRestSeconds,
      adjustedRestSeconds: data.adjustedRestSeconds.present
          ? data.adjustedRestSeconds.value
          : this.adjustedRestSeconds,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      endedAt: data.endedAt.present ? data.endedAt.value : this.endedAt,
      skippedAt: data.skippedAt.present ? data.skippedAt.value : this.skippedAt,
      pausedAt: data.pausedAt.present ? data.pausedAt.value : this.pausedAt,
      accumulatedPausedMs: data.accumulatedPausedMs.present
          ? data.accumulatedPausedMs.value
          : this.accumulatedPausedMs,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveRestState(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('afterProgramIndex: $afterProgramIndex, ')
          ..write('afterExerciseIndex: $afterExerciseIndex, ')
          ..write('afterSetIndex: $afterSetIndex, ')
          ..write('plannedRestSeconds: $plannedRestSeconds, ')
          ..write('adjustedRestSeconds: $adjustedRestSeconds, ')
          ..write('startedAt: $startedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('skippedAt: $skippedAt, ')
          ..write('pausedAt: $pausedAt, ')
          ..write('accumulatedPausedMs: $accumulatedPausedMs')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    afterProgramIndex,
    afterExerciseIndex,
    afterSetIndex,
    plannedRestSeconds,
    adjustedRestSeconds,
    startedAt,
    endedAt,
    skippedAt,
    pausedAt,
    accumulatedPausedMs,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveRestState &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.afterProgramIndex == this.afterProgramIndex &&
          other.afterExerciseIndex == this.afterExerciseIndex &&
          other.afterSetIndex == this.afterSetIndex &&
          other.plannedRestSeconds == this.plannedRestSeconds &&
          other.adjustedRestSeconds == this.adjustedRestSeconds &&
          other.startedAt == this.startedAt &&
          other.endedAt == this.endedAt &&
          other.skippedAt == this.skippedAt &&
          other.pausedAt == this.pausedAt &&
          other.accumulatedPausedMs == this.accumulatedPausedMs);
}

class ActiveRestStatesCompanion extends UpdateCompanion<ActiveRestState> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<int> afterProgramIndex;
  final Value<int> afterExerciseIndex;
  final Value<int> afterSetIndex;
  final Value<int> plannedRestSeconds;
  final Value<int> adjustedRestSeconds;
  final Value<DateTime> startedAt;
  final Value<DateTime?> endedAt;
  final Value<DateTime?> skippedAt;
  final Value<DateTime?> pausedAt;
  final Value<int> accumulatedPausedMs;
  final Value<int> rowid;
  const ActiveRestStatesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.afterProgramIndex = const Value.absent(),
    this.afterExerciseIndex = const Value.absent(),
    this.afterSetIndex = const Value.absent(),
    this.plannedRestSeconds = const Value.absent(),
    this.adjustedRestSeconds = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.endedAt = const Value.absent(),
    this.skippedAt = const Value.absent(),
    this.pausedAt = const Value.absent(),
    this.accumulatedPausedMs = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveRestStatesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required int afterProgramIndex,
    required int afterExerciseIndex,
    required int afterSetIndex,
    required int plannedRestSeconds,
    required int adjustedRestSeconds,
    required DateTime startedAt,
    this.endedAt = const Value.absent(),
    this.skippedAt = const Value.absent(),
    this.pausedAt = const Value.absent(),
    this.accumulatedPausedMs = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       afterProgramIndex = Value(afterProgramIndex),
       afterExerciseIndex = Value(afterExerciseIndex),
       afterSetIndex = Value(afterSetIndex),
       plannedRestSeconds = Value(plannedRestSeconds),
       adjustedRestSeconds = Value(adjustedRestSeconds),
       startedAt = Value(startedAt);
  static Insertable<ActiveRestState> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<int>? afterProgramIndex,
    Expression<int>? afterExerciseIndex,
    Expression<int>? afterSetIndex,
    Expression<int>? plannedRestSeconds,
    Expression<int>? adjustedRestSeconds,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? endedAt,
    Expression<DateTime>? skippedAt,
    Expression<DateTime>? pausedAt,
    Expression<int>? accumulatedPausedMs,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (afterProgramIndex != null) 'after_program_index': afterProgramIndex,
      if (afterExerciseIndex != null)
        'after_exercise_index': afterExerciseIndex,
      if (afterSetIndex != null) 'after_set_index': afterSetIndex,
      if (plannedRestSeconds != null)
        'planned_rest_seconds': plannedRestSeconds,
      if (adjustedRestSeconds != null)
        'adjusted_rest_seconds': adjustedRestSeconds,
      if (startedAt != null) 'started_at': startedAt,
      if (endedAt != null) 'ended_at': endedAt,
      if (skippedAt != null) 'skipped_at': skippedAt,
      if (pausedAt != null) 'paused_at': pausedAt,
      if (accumulatedPausedMs != null)
        'accumulated_paused_ms': accumulatedPausedMs,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveRestStatesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<int>? afterProgramIndex,
    Value<int>? afterExerciseIndex,
    Value<int>? afterSetIndex,
    Value<int>? plannedRestSeconds,
    Value<int>? adjustedRestSeconds,
    Value<DateTime>? startedAt,
    Value<DateTime?>? endedAt,
    Value<DateTime?>? skippedAt,
    Value<DateTime?>? pausedAt,
    Value<int>? accumulatedPausedMs,
    Value<int>? rowid,
  }) {
    return ActiveRestStatesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      afterProgramIndex: afterProgramIndex ?? this.afterProgramIndex,
      afterExerciseIndex: afterExerciseIndex ?? this.afterExerciseIndex,
      afterSetIndex: afterSetIndex ?? this.afterSetIndex,
      plannedRestSeconds: plannedRestSeconds ?? this.plannedRestSeconds,
      adjustedRestSeconds: adjustedRestSeconds ?? this.adjustedRestSeconds,
      startedAt: startedAt ?? this.startedAt,
      endedAt: endedAt ?? this.endedAt,
      skippedAt: skippedAt ?? this.skippedAt,
      pausedAt: pausedAt ?? this.pausedAt,
      accumulatedPausedMs: accumulatedPausedMs ?? this.accumulatedPausedMs,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (afterProgramIndex.present) {
      map['after_program_index'] = Variable<int>(afterProgramIndex.value);
    }
    if (afterExerciseIndex.present) {
      map['after_exercise_index'] = Variable<int>(afterExerciseIndex.value);
    }
    if (afterSetIndex.present) {
      map['after_set_index'] = Variable<int>(afterSetIndex.value);
    }
    if (plannedRestSeconds.present) {
      map['planned_rest_seconds'] = Variable<int>(plannedRestSeconds.value);
    }
    if (adjustedRestSeconds.present) {
      map['adjusted_rest_seconds'] = Variable<int>(adjustedRestSeconds.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (endedAt.present) {
      map['ended_at'] = Variable<DateTime>(endedAt.value);
    }
    if (skippedAt.present) {
      map['skipped_at'] = Variable<DateTime>(skippedAt.value);
    }
    if (pausedAt.present) {
      map['paused_at'] = Variable<DateTime>(pausedAt.value);
    }
    if (accumulatedPausedMs.present) {
      map['accumulated_paused_ms'] = Variable<int>(accumulatedPausedMs.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveRestStatesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('afterProgramIndex: $afterProgramIndex, ')
          ..write('afterExerciseIndex: $afterExerciseIndex, ')
          ..write('afterSetIndex: $afterSetIndex, ')
          ..write('plannedRestSeconds: $plannedRestSeconds, ')
          ..write('adjustedRestSeconds: $adjustedRestSeconds, ')
          ..write('startedAt: $startedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('skippedAt: $skippedAt, ')
          ..write('pausedAt: $pausedAt, ')
          ..write('accumulatedPausedMs: $accumulatedPausedMs, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveScoreStopwatchStatesTable extends ActiveScoreStopwatchStates
    with
        TableInfo<$ActiveScoreStopwatchStatesTable, ActiveScoreStopwatchState> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveScoreStopwatchStatesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _accumulatedMsMeta = const VerificationMeta(
    'accumulatedMs',
  );
  @override
  late final GeneratedColumn<int> accumulatedMs = GeneratedColumn<int>(
    'accumulated_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stoppedAtMeta = const VerificationMeta(
    'stoppedAt',
  );
  @override
  late final GeneratedColumn<DateTime> stoppedAt = GeneratedColumn<DateTime>(
    'stopped_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    status,
    startedAt,
    accumulatedMs,
    stoppedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_score_stopwatch_states';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveScoreStopwatchState> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_startedAtMeta);
    }
    if (data.containsKey('accumulated_ms')) {
      context.handle(
        _accumulatedMsMeta,
        accumulatedMs.isAcceptableOrUnknown(
          data['accumulated_ms']!,
          _accumulatedMsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_accumulatedMsMeta);
    }
    if (data.containsKey('stopped_at')) {
      context.handle(
        _stoppedAtMeta,
        stoppedAt.isAcceptableOrUnknown(data['stopped_at']!, _stoppedAtMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveScoreStopwatchState map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveScoreStopwatchState(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      )!,
      accumulatedMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}accumulated_ms'],
      )!,
      stoppedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}stopped_at'],
      ),
    );
  }

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

class ActiveScoreStopwatchState extends DataClass
    implements Insertable<ActiveScoreStopwatchState> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final String status;
  final DateTime startedAt;
  final int accumulatedMs;
  final DateTime? stoppedAt;
  const ActiveScoreStopwatchState({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.status,
    required this.startedAt,
    required this.accumulatedMs,
    this.stoppedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['status'] = Variable<String>(status);
    map['started_at'] = Variable<DateTime>(startedAt);
    map['accumulated_ms'] = Variable<int>(accumulatedMs);
    if (!nullToAbsent || stoppedAt != null) {
      map['stopped_at'] = Variable<DateTime>(stoppedAt);
    }
    return map;
  }

  ActiveScoreStopwatchStatesCompanion toCompanion(bool nullToAbsent) {
    return ActiveScoreStopwatchStatesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      status: Value(status),
      startedAt: Value(startedAt),
      accumulatedMs: Value(accumulatedMs),
      stoppedAt: stoppedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(stoppedAt),
    );
  }

  factory ActiveScoreStopwatchState.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveScoreStopwatchState(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime>(json['startedAt']),
      accumulatedMs: serializer.fromJson<int>(json['accumulatedMs']),
      stoppedAt: serializer.fromJson<DateTime?>(json['stoppedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime>(startedAt),
      'accumulatedMs': serializer.toJson<int>(accumulatedMs),
      'stoppedAt': serializer.toJson<DateTime?>(stoppedAt),
    };
  }

  ActiveScoreStopwatchState copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    String? status,
    DateTime? startedAt,
    int? accumulatedMs,
    Value<DateTime?> stoppedAt = const Value.absent(),
  }) => ActiveScoreStopwatchState(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    status: status ?? this.status,
    startedAt: startedAt ?? this.startedAt,
    accumulatedMs: accumulatedMs ?? this.accumulatedMs,
    stoppedAt: stoppedAt.present ? stoppedAt.value : this.stoppedAt,
  );
  ActiveScoreStopwatchState copyWithCompanion(
    ActiveScoreStopwatchStatesCompanion data,
  ) {
    return ActiveScoreStopwatchState(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      accumulatedMs: data.accumulatedMs.present
          ? data.accumulatedMs.value
          : this.accumulatedMs,
      stoppedAt: data.stoppedAt.present ? data.stoppedAt.value : this.stoppedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveScoreStopwatchState(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('stoppedAt: $stoppedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    status,
    startedAt,
    accumulatedMs,
    stoppedAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveScoreStopwatchState &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.accumulatedMs == this.accumulatedMs &&
          other.stoppedAt == this.stoppedAt);
}

class ActiveScoreStopwatchStatesCompanion
    extends UpdateCompanion<ActiveScoreStopwatchState> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<String> status;
  final Value<DateTime> startedAt;
  final Value<int> accumulatedMs;
  final Value<DateTime?> stoppedAt;
  final Value<int> rowid;
  const ActiveScoreStopwatchStatesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.accumulatedMs = const Value.absent(),
    this.stoppedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveScoreStopwatchStatesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required String status,
    required DateTime startedAt,
    required int accumulatedMs,
    this.stoppedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       status = Value(status),
       startedAt = Value(startedAt),
       accumulatedMs = Value(accumulatedMs);
  static Insertable<ActiveScoreStopwatchState> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<int>? accumulatedMs,
    Expression<DateTime>? stoppedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (accumulatedMs != null) 'accumulated_ms': accumulatedMs,
      if (stoppedAt != null) 'stopped_at': stoppedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveScoreStopwatchStatesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<String>? status,
    Value<DateTime>? startedAt,
    Value<int>? accumulatedMs,
    Value<DateTime?>? stoppedAt,
    Value<int>? rowid,
  }) {
    return ActiveScoreStopwatchStatesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      accumulatedMs: accumulatedMs ?? this.accumulatedMs,
      stoppedAt: stoppedAt ?? this.stoppedAt,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (accumulatedMs.present) {
      map['accumulated_ms'] = Variable<int>(accumulatedMs.value);
    }
    if (stoppedAt.present) {
      map['stopped_at'] = Variable<DateTime>(stoppedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveScoreStopwatchStatesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('stoppedAt: $stoppedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveSetTimerStatesTable extends ActiveSetTimerStates
    with TableInfo<$ActiveSetTimerStatesTable, ActiveSetTimerState> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveSetTimerStatesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _accumulatedMsMeta = const VerificationMeta(
    'accumulatedMs',
  );
  @override
  late final GeneratedColumn<int> accumulatedMs = GeneratedColumn<int>(
    'accumulated_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stoppedAtMeta = const VerificationMeta(
    'stoppedAt',
  );
  @override
  late final GeneratedColumn<DateTime> stoppedAt = GeneratedColumn<DateTime>(
    'stopped_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _skippedAtMeta = const VerificationMeta(
    'skippedAt',
  );
  @override
  late final GeneratedColumn<DateTime> skippedAt = GeneratedColumn<DateTime>(
    'skipped_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    status,
    startedAt,
    accumulatedMs,
    stoppedAt,
    skippedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_set_timer_states';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveSetTimerState> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('accumulated_ms')) {
      context.handle(
        _accumulatedMsMeta,
        accumulatedMs.isAcceptableOrUnknown(
          data['accumulated_ms']!,
          _accumulatedMsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_accumulatedMsMeta);
    }
    if (data.containsKey('stopped_at')) {
      context.handle(
        _stoppedAtMeta,
        stoppedAt.isAcceptableOrUnknown(data['stopped_at']!, _stoppedAtMeta),
      );
    }
    if (data.containsKey('skipped_at')) {
      context.handle(
        _skippedAtMeta,
        skippedAt.isAcceptableOrUnknown(data['skipped_at']!, _skippedAtMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveSetTimerState map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveSetTimerState(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      accumulatedMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}accumulated_ms'],
      )!,
      stoppedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}stopped_at'],
      ),
      skippedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}skipped_at'],
      ),
    );
  }

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

class ActiveSetTimerState extends DataClass
    implements Insertable<ActiveSetTimerState> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final String status;
  final DateTime? startedAt;
  final int accumulatedMs;
  final DateTime? stoppedAt;
  final DateTime? skippedAt;
  const ActiveSetTimerState({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.status,
    this.startedAt,
    required this.accumulatedMs,
    this.stoppedAt,
    this.skippedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['status'] = Variable<String>(status);
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    map['accumulated_ms'] = Variable<int>(accumulatedMs);
    if (!nullToAbsent || stoppedAt != null) {
      map['stopped_at'] = Variable<DateTime>(stoppedAt);
    }
    if (!nullToAbsent || skippedAt != null) {
      map['skipped_at'] = Variable<DateTime>(skippedAt);
    }
    return map;
  }

  ActiveSetTimerStatesCompanion toCompanion(bool nullToAbsent) {
    return ActiveSetTimerStatesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      status: Value(status),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      accumulatedMs: Value(accumulatedMs),
      stoppedAt: stoppedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(stoppedAt),
      skippedAt: skippedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(skippedAt),
    );
  }

  factory ActiveSetTimerState.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveSetTimerState(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      accumulatedMs: serializer.fromJson<int>(json['accumulatedMs']),
      stoppedAt: serializer.fromJson<DateTime?>(json['stoppedAt']),
      skippedAt: serializer.fromJson<DateTime?>(json['skippedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'accumulatedMs': serializer.toJson<int>(accumulatedMs),
      'stoppedAt': serializer.toJson<DateTime?>(stoppedAt),
      'skippedAt': serializer.toJson<DateTime?>(skippedAt),
    };
  }

  ActiveSetTimerState copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    String? status,
    Value<DateTime?> startedAt = const Value.absent(),
    int? accumulatedMs,
    Value<DateTime?> stoppedAt = const Value.absent(),
    Value<DateTime?> skippedAt = const Value.absent(),
  }) => ActiveSetTimerState(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    status: status ?? this.status,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    accumulatedMs: accumulatedMs ?? this.accumulatedMs,
    stoppedAt: stoppedAt.present ? stoppedAt.value : this.stoppedAt,
    skippedAt: skippedAt.present ? skippedAt.value : this.skippedAt,
  );
  ActiveSetTimerState copyWithCompanion(ActiveSetTimerStatesCompanion data) {
    return ActiveSetTimerState(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      accumulatedMs: data.accumulatedMs.present
          ? data.accumulatedMs.value
          : this.accumulatedMs,
      stoppedAt: data.stoppedAt.present ? data.stoppedAt.value : this.stoppedAt,
      skippedAt: data.skippedAt.present ? data.skippedAt.value : this.skippedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveSetTimerState(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('stoppedAt: $stoppedAt, ')
          ..write('skippedAt: $skippedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programIndex,
    exerciseIndex,
    setIndex,
    status,
    startedAt,
    accumulatedMs,
    stoppedAt,
    skippedAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveSetTimerState &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.accumulatedMs == this.accumulatedMs &&
          other.stoppedAt == this.stoppedAt &&
          other.skippedAt == this.skippedAt);
}

class ActiveSetTimerStatesCompanion
    extends UpdateCompanion<ActiveSetTimerState> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<String> status;
  final Value<DateTime?> startedAt;
  final Value<int> accumulatedMs;
  final Value<DateTime?> stoppedAt;
  final Value<DateTime?> skippedAt;
  final Value<int> rowid;
  const ActiveSetTimerStatesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.accumulatedMs = const Value.absent(),
    this.stoppedAt = const Value.absent(),
    this.skippedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveSetTimerStatesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required String status,
    this.startedAt = const Value.absent(),
    required int accumulatedMs,
    this.stoppedAt = const Value.absent(),
    this.skippedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       status = Value(status),
       accumulatedMs = Value(accumulatedMs);
  static Insertable<ActiveSetTimerState> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<int>? accumulatedMs,
    Expression<DateTime>? stoppedAt,
    Expression<DateTime>? skippedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (accumulatedMs != null) 'accumulated_ms': accumulatedMs,
      if (stoppedAt != null) 'stopped_at': stoppedAt,
      if (skippedAt != null) 'skipped_at': skippedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveSetTimerStatesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<String>? status,
    Value<DateTime?>? startedAt,
    Value<int>? accumulatedMs,
    Value<DateTime?>? stoppedAt,
    Value<DateTime?>? skippedAt,
    Value<int>? rowid,
  }) {
    return ActiveSetTimerStatesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      accumulatedMs: accumulatedMs ?? this.accumulatedMs,
      stoppedAt: stoppedAt ?? this.stoppedAt,
      skippedAt: skippedAt ?? this.skippedAt,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (accumulatedMs.present) {
      map['accumulated_ms'] = Variable<int>(accumulatedMs.value);
    }
    if (stoppedAt.present) {
      map['stopped_at'] = Variable<DateTime>(stoppedAt.value);
    }
    if (skippedAt.present) {
      map['skipped_at'] = Variable<DateTime>(skippedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveSetTimerStatesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('accumulatedMs: $accumulatedMs, ')
          ..write('stoppedAt: $stoppedAt, ')
          ..write('skippedAt: $skippedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ActiveSetResultsTable extends ActiveSetResults
    with TableInfo<$ActiveSetResultsTable, ActiveSetResult> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ActiveSetResultsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _activeWorkoutSessionIdMeta =
      const VerificationMeta('activeWorkoutSessionId');
  @override
  late final GeneratedColumn<String> activeWorkoutSessionId =
      GeneratedColumn<String>(
        'active_workout_session_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _programSnapshotIdMeta = const VerificationMeta(
    'programSnapshotId',
  );
  @override
  late final GeneratedColumn<String> programSnapshotId =
      GeneratedColumn<String>(
        'program_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseSnapshotIdMeta =
      const VerificationMeta('exerciseSnapshotId');
  @override
  late final GeneratedColumn<String> exerciseSnapshotId =
      GeneratedColumn<String>(
        'exercise_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _completedAtMeta = const VerificationMeta(
    'completedAt',
  );
  @override
  late final GeneratedColumn<DateTime> completedAt = GeneratedColumn<DateTime>(
    'completed_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualTimeMsMeta = const VerificationMeta(
    'actualTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualTimeMs = GeneratedColumn<int>(
    'actual_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualRepsMeta = const VerificationMeta(
    'actualReps',
  );
  @override
  late final GeneratedColumn<int> actualReps = GeneratedColumn<int>(
    'actual_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreMeta = const VerificationMeta(
    'actualScore',
  );
  @override
  late final GeneratedColumn<double> actualScore = GeneratedColumn<double>(
    'actual_score',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreTimeMsMeta = const VerificationMeta(
    'actualScoreTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualScoreTimeMs = GeneratedColumn<int>(
    'actual_score_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _scoreInputModeSnapshotMeta =
      const VerificationMeta('scoreInputModeSnapshot');
  @override
  late final GeneratedColumn<String> scoreInputModeSnapshot =
      GeneratedColumn<String>(
        'score_input_mode_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('manual'),
      );
  static const VerificationMeta _scoreLabelSnapshotMeta =
      const VerificationMeta('scoreLabelSnapshot');
  @override
  late final GeneratedColumn<String> scoreLabelSnapshot =
      GeneratedColumn<String>(
        'score_label_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreUnitSnapshotMeta = const VerificationMeta(
    'scoreUnitSnapshot',
  );
  @override
  late final GeneratedColumn<String> scoreUnitSnapshot =
      GeneratedColumn<String>(
        'score_unit_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _noteMeta = const VerificationMeta('note');
  @override
  late final GeneratedColumn<String> note = GeneratedColumn<String>(
    'note',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('completed'),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    note,
    status,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'active_set_results';
  @override
  VerificationContext validateIntegrity(
    Insertable<ActiveSetResult> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('active_workout_session_id')) {
      context.handle(
        _activeWorkoutSessionIdMeta,
        activeWorkoutSessionId.isAcceptableOrUnknown(
          data['active_workout_session_id']!,
          _activeWorkoutSessionIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_activeWorkoutSessionIdMeta);
    }
    if (data.containsKey('program_snapshot_id')) {
      context.handle(
        _programSnapshotIdMeta,
        programSnapshotId.isAcceptableOrUnknown(
          data['program_snapshot_id']!,
          _programSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programSnapshotIdMeta);
    }
    if (data.containsKey('exercise_snapshot_id')) {
      context.handle(
        _exerciseSnapshotIdMeta,
        exerciseSnapshotId.isAcceptableOrUnknown(
          data['exercise_snapshot_id']!,
          _exerciseSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseSnapshotIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('completed_at')) {
      context.handle(
        _completedAtMeta,
        completedAt.isAcceptableOrUnknown(
          data['completed_at']!,
          _completedAtMeta,
        ),
      );
    }
    if (data.containsKey('actual_time_ms')) {
      context.handle(
        _actualTimeMsMeta,
        actualTimeMs.isAcceptableOrUnknown(
          data['actual_time_ms']!,
          _actualTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('actual_reps')) {
      context.handle(
        _actualRepsMeta,
        actualReps.isAcceptableOrUnknown(data['actual_reps']!, _actualRepsMeta),
      );
    }
    if (data.containsKey('actual_score')) {
      context.handle(
        _actualScoreMeta,
        actualScore.isAcceptableOrUnknown(
          data['actual_score']!,
          _actualScoreMeta,
        ),
      );
    }
    if (data.containsKey('actual_score_time_ms')) {
      context.handle(
        _actualScoreTimeMsMeta,
        actualScoreTimeMs.isAcceptableOrUnknown(
          data['actual_score_time_ms']!,
          _actualScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('score_input_mode_snapshot')) {
      context.handle(
        _scoreInputModeSnapshotMeta,
        scoreInputModeSnapshot.isAcceptableOrUnknown(
          data['score_input_mode_snapshot']!,
          _scoreInputModeSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_label_snapshot')) {
      context.handle(
        _scoreLabelSnapshotMeta,
        scoreLabelSnapshot.isAcceptableOrUnknown(
          data['score_label_snapshot']!,
          _scoreLabelSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_unit_snapshot')) {
      context.handle(
        _scoreUnitSnapshotMeta,
        scoreUnitSnapshot.isAcceptableOrUnknown(
          data['score_unit_snapshot']!,
          _scoreUnitSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('note')) {
      context.handle(
        _noteMeta,
        note.isAcceptableOrUnknown(data['note']!, _noteMeta),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ActiveSetResult map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ActiveSetResult(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      activeWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}active_workout_session_id'],
      )!,
      programSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_snapshot_id'],
      )!,
      exerciseSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_snapshot_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      completedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}completed_at'],
      ),
      actualTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_time_ms'],
      ),
      actualReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_reps'],
      ),
      actualScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}actual_score'],
      ),
      actualScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_score_time_ms'],
      ),
      scoreInputModeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode_snapshot'],
      )!,
      scoreLabelSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label_snapshot'],
      ),
      scoreUnitSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit_snapshot'],
      ),
      note: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}note'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
    );
  }

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

class ActiveSetResult extends DataClass implements Insertable<ActiveSetResult> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String activeWorkoutSessionId;
  final String programSnapshotId;
  final String exerciseSnapshotId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final DateTime? startedAt;
  final DateTime? completedAt;
  final int? actualTimeMs;
  final int? actualReps;
  final double? actualScore;
  final int? actualScoreTimeMs;
  final String scoreInputModeSnapshot;
  final String? scoreLabelSnapshot;
  final String? scoreUnitSnapshot;
  final String? note;
  final String status;
  const ActiveSetResult({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.activeWorkoutSessionId,
    required this.programSnapshotId,
    required this.exerciseSnapshotId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    this.startedAt,
    this.completedAt,
    this.actualTimeMs,
    this.actualReps,
    this.actualScore,
    this.actualScoreTimeMs,
    required this.scoreInputModeSnapshot,
    this.scoreLabelSnapshot,
    this.scoreUnitSnapshot,
    this.note,
    required this.status,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['active_workout_session_id'] = Variable<String>(activeWorkoutSessionId);
    map['program_snapshot_id'] = Variable<String>(programSnapshotId);
    map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    if (!nullToAbsent || completedAt != null) {
      map['completed_at'] = Variable<DateTime>(completedAt);
    }
    if (!nullToAbsent || actualTimeMs != null) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs);
    }
    if (!nullToAbsent || actualReps != null) {
      map['actual_reps'] = Variable<int>(actualReps);
    }
    if (!nullToAbsent || actualScore != null) {
      map['actual_score'] = Variable<double>(actualScore);
    }
    if (!nullToAbsent || actualScoreTimeMs != null) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs);
    }
    map['score_input_mode_snapshot'] = Variable<String>(scoreInputModeSnapshot);
    if (!nullToAbsent || scoreLabelSnapshot != null) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot);
    }
    if (!nullToAbsent || scoreUnitSnapshot != null) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot);
    }
    if (!nullToAbsent || note != null) {
      map['note'] = Variable<String>(note);
    }
    map['status'] = Variable<String>(status);
    return map;
  }

  ActiveSetResultsCompanion toCompanion(bool nullToAbsent) {
    return ActiveSetResultsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      activeWorkoutSessionId: Value(activeWorkoutSessionId),
      programSnapshotId: Value(programSnapshotId),
      exerciseSnapshotId: Value(exerciseSnapshotId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      completedAt: completedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(completedAt),
      actualTimeMs: actualTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualTimeMs),
      actualReps: actualReps == null && nullToAbsent
          ? const Value.absent()
          : Value(actualReps),
      actualScore: actualScore == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScore),
      actualScoreTimeMs: actualScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScoreTimeMs),
      scoreInputModeSnapshot: Value(scoreInputModeSnapshot),
      scoreLabelSnapshot: scoreLabelSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabelSnapshot),
      scoreUnitSnapshot: scoreUnitSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnitSnapshot),
      note: note == null && nullToAbsent ? const Value.absent() : Value(note),
      status: Value(status),
    );
  }

  factory ActiveSetResult.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ActiveSetResult(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      activeWorkoutSessionId: serializer.fromJson<String>(
        json['activeWorkoutSessionId'],
      ),
      programSnapshotId: serializer.fromJson<String>(json['programSnapshotId']),
      exerciseSnapshotId: serializer.fromJson<String>(
        json['exerciseSnapshotId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      completedAt: serializer.fromJson<DateTime?>(json['completedAt']),
      actualTimeMs: serializer.fromJson<int?>(json['actualTimeMs']),
      actualReps: serializer.fromJson<int?>(json['actualReps']),
      actualScore: serializer.fromJson<double?>(json['actualScore']),
      actualScoreTimeMs: serializer.fromJson<int?>(json['actualScoreTimeMs']),
      scoreInputModeSnapshot: serializer.fromJson<String>(
        json['scoreInputModeSnapshot'],
      ),
      scoreLabelSnapshot: serializer.fromJson<String?>(
        json['scoreLabelSnapshot'],
      ),
      scoreUnitSnapshot: serializer.fromJson<String?>(
        json['scoreUnitSnapshot'],
      ),
      note: serializer.fromJson<String?>(json['note']),
      status: serializer.fromJson<String>(json['status']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'activeWorkoutSessionId': serializer.toJson<String>(
        activeWorkoutSessionId,
      ),
      'programSnapshotId': serializer.toJson<String>(programSnapshotId),
      'exerciseSnapshotId': serializer.toJson<String>(exerciseSnapshotId),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'completedAt': serializer.toJson<DateTime?>(completedAt),
      'actualTimeMs': serializer.toJson<int?>(actualTimeMs),
      'actualReps': serializer.toJson<int?>(actualReps),
      'actualScore': serializer.toJson<double?>(actualScore),
      'actualScoreTimeMs': serializer.toJson<int?>(actualScoreTimeMs),
      'scoreInputModeSnapshot': serializer.toJson<String>(
        scoreInputModeSnapshot,
      ),
      'scoreLabelSnapshot': serializer.toJson<String?>(scoreLabelSnapshot),
      'scoreUnitSnapshot': serializer.toJson<String?>(scoreUnitSnapshot),
      'note': serializer.toJson<String?>(note),
      'status': serializer.toJson<String>(status),
    };
  }

  ActiveSetResult copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? activeWorkoutSessionId,
    String? programSnapshotId,
    String? exerciseSnapshotId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    Value<DateTime?> startedAt = const Value.absent(),
    Value<DateTime?> completedAt = const Value.absent(),
    Value<int?> actualTimeMs = const Value.absent(),
    Value<int?> actualReps = const Value.absent(),
    Value<double?> actualScore = const Value.absent(),
    Value<int?> actualScoreTimeMs = const Value.absent(),
    String? scoreInputModeSnapshot,
    Value<String?> scoreLabelSnapshot = const Value.absent(),
    Value<String?> scoreUnitSnapshot = const Value.absent(),
    Value<String?> note = const Value.absent(),
    String? status,
  }) => ActiveSetResult(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    activeWorkoutSessionId:
        activeWorkoutSessionId ?? this.activeWorkoutSessionId,
    programSnapshotId: programSnapshotId ?? this.programSnapshotId,
    exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    completedAt: completedAt.present ? completedAt.value : this.completedAt,
    actualTimeMs: actualTimeMs.present ? actualTimeMs.value : this.actualTimeMs,
    actualReps: actualReps.present ? actualReps.value : this.actualReps,
    actualScore: actualScore.present ? actualScore.value : this.actualScore,
    actualScoreTimeMs: actualScoreTimeMs.present
        ? actualScoreTimeMs.value
        : this.actualScoreTimeMs,
    scoreInputModeSnapshot:
        scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
    scoreLabelSnapshot: scoreLabelSnapshot.present
        ? scoreLabelSnapshot.value
        : this.scoreLabelSnapshot,
    scoreUnitSnapshot: scoreUnitSnapshot.present
        ? scoreUnitSnapshot.value
        : this.scoreUnitSnapshot,
    note: note.present ? note.value : this.note,
    status: status ?? this.status,
  );
  ActiveSetResult copyWithCompanion(ActiveSetResultsCompanion data) {
    return ActiveSetResult(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      activeWorkoutSessionId: data.activeWorkoutSessionId.present
          ? data.activeWorkoutSessionId.value
          : this.activeWorkoutSessionId,
      programSnapshotId: data.programSnapshotId.present
          ? data.programSnapshotId.value
          : this.programSnapshotId,
      exerciseSnapshotId: data.exerciseSnapshotId.present
          ? data.exerciseSnapshotId.value
          : this.exerciseSnapshotId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      completedAt: data.completedAt.present
          ? data.completedAt.value
          : this.completedAt,
      actualTimeMs: data.actualTimeMs.present
          ? data.actualTimeMs.value
          : this.actualTimeMs,
      actualReps: data.actualReps.present
          ? data.actualReps.value
          : this.actualReps,
      actualScore: data.actualScore.present
          ? data.actualScore.value
          : this.actualScore,
      actualScoreTimeMs: data.actualScoreTimeMs.present
          ? data.actualScoreTimeMs.value
          : this.actualScoreTimeMs,
      scoreInputModeSnapshot: data.scoreInputModeSnapshot.present
          ? data.scoreInputModeSnapshot.value
          : this.scoreInputModeSnapshot,
      scoreLabelSnapshot: data.scoreLabelSnapshot.present
          ? data.scoreLabelSnapshot.value
          : this.scoreLabelSnapshot,
      scoreUnitSnapshot: data.scoreUnitSnapshot.present
          ? data.scoreUnitSnapshot.value
          : this.scoreUnitSnapshot,
      note: data.note.present ? data.note.value : this.note,
      status: data.status.present ? data.status.value : this.status,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ActiveSetResult(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('note: $note, ')
          ..write('status: $status')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    activeWorkoutSessionId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    note,
    status,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ActiveSetResult &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.activeWorkoutSessionId == this.activeWorkoutSessionId &&
          other.programSnapshotId == this.programSnapshotId &&
          other.exerciseSnapshotId == this.exerciseSnapshotId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.startedAt == this.startedAt &&
          other.completedAt == this.completedAt &&
          other.actualTimeMs == this.actualTimeMs &&
          other.actualReps == this.actualReps &&
          other.actualScore == this.actualScore &&
          other.actualScoreTimeMs == this.actualScoreTimeMs &&
          other.scoreInputModeSnapshot == this.scoreInputModeSnapshot &&
          other.scoreLabelSnapshot == this.scoreLabelSnapshot &&
          other.scoreUnitSnapshot == this.scoreUnitSnapshot &&
          other.note == this.note &&
          other.status == this.status);
}

class ActiveSetResultsCompanion extends UpdateCompanion<ActiveSetResult> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> activeWorkoutSessionId;
  final Value<String> programSnapshotId;
  final Value<String> exerciseSnapshotId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<DateTime?> startedAt;
  final Value<DateTime?> completedAt;
  final Value<int?> actualTimeMs;
  final Value<int?> actualReps;
  final Value<double?> actualScore;
  final Value<int?> actualScoreTimeMs;
  final Value<String> scoreInputModeSnapshot;
  final Value<String?> scoreLabelSnapshot;
  final Value<String?> scoreUnitSnapshot;
  final Value<String?> note;
  final Value<String> status;
  final Value<int> rowid;
  const ActiveSetResultsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.activeWorkoutSessionId = const Value.absent(),
    this.programSnapshotId = const Value.absent(),
    this.exerciseSnapshotId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.note = const Value.absent(),
    this.status = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ActiveSetResultsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String activeWorkoutSessionId,
    required String programSnapshotId,
    required String exerciseSnapshotId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.note = const Value.absent(),
    this.status = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       activeWorkoutSessionId = Value(activeWorkoutSessionId),
       programSnapshotId = Value(programSnapshotId),
       exerciseSnapshotId = Value(exerciseSnapshotId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex);
  static Insertable<ActiveSetResult> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? activeWorkoutSessionId,
    Expression<String>? programSnapshotId,
    Expression<String>? exerciseSnapshotId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? completedAt,
    Expression<int>? actualTimeMs,
    Expression<int>? actualReps,
    Expression<double>? actualScore,
    Expression<int>? actualScoreTimeMs,
    Expression<String>? scoreInputModeSnapshot,
    Expression<String>? scoreLabelSnapshot,
    Expression<String>? scoreUnitSnapshot,
    Expression<String>? note,
    Expression<String>? status,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (activeWorkoutSessionId != null)
        'active_workout_session_id': activeWorkoutSessionId,
      if (programSnapshotId != null) 'program_snapshot_id': programSnapshotId,
      if (exerciseSnapshotId != null)
        'exercise_snapshot_id': exerciseSnapshotId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (startedAt != null) 'started_at': startedAt,
      if (completedAt != null) 'completed_at': completedAt,
      if (actualTimeMs != null) 'actual_time_ms': actualTimeMs,
      if (actualReps != null) 'actual_reps': actualReps,
      if (actualScore != null) 'actual_score': actualScore,
      if (actualScoreTimeMs != null) 'actual_score_time_ms': actualScoreTimeMs,
      if (scoreInputModeSnapshot != null)
        'score_input_mode_snapshot': scoreInputModeSnapshot,
      if (scoreLabelSnapshot != null)
        'score_label_snapshot': scoreLabelSnapshot,
      if (scoreUnitSnapshot != null) 'score_unit_snapshot': scoreUnitSnapshot,
      if (note != null) 'note': note,
      if (status != null) 'status': status,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ActiveSetResultsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? activeWorkoutSessionId,
    Value<String>? programSnapshotId,
    Value<String>? exerciseSnapshotId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<DateTime?>? startedAt,
    Value<DateTime?>? completedAt,
    Value<int?>? actualTimeMs,
    Value<int?>? actualReps,
    Value<double?>? actualScore,
    Value<int?>? actualScoreTimeMs,
    Value<String>? scoreInputModeSnapshot,
    Value<String?>? scoreLabelSnapshot,
    Value<String?>? scoreUnitSnapshot,
    Value<String?>? note,
    Value<String>? status,
    Value<int>? rowid,
  }) {
    return ActiveSetResultsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      activeWorkoutSessionId:
          activeWorkoutSessionId ?? this.activeWorkoutSessionId,
      programSnapshotId: programSnapshotId ?? this.programSnapshotId,
      exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      startedAt: startedAt ?? this.startedAt,
      completedAt: completedAt ?? this.completedAt,
      actualTimeMs: actualTimeMs ?? this.actualTimeMs,
      actualReps: actualReps ?? this.actualReps,
      actualScore: actualScore ?? this.actualScore,
      actualScoreTimeMs: actualScoreTimeMs ?? this.actualScoreTimeMs,
      scoreInputModeSnapshot:
          scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
      scoreLabelSnapshot: scoreLabelSnapshot ?? this.scoreLabelSnapshot,
      scoreUnitSnapshot: scoreUnitSnapshot ?? this.scoreUnitSnapshot,
      note: note ?? this.note,
      status: status ?? this.status,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (activeWorkoutSessionId.present) {
      map['active_workout_session_id'] = Variable<String>(
        activeWorkoutSessionId.value,
      );
    }
    if (programSnapshotId.present) {
      map['program_snapshot_id'] = Variable<String>(programSnapshotId.value);
    }
    if (exerciseSnapshotId.present) {
      map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId.value);
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (completedAt.present) {
      map['completed_at'] = Variable<DateTime>(completedAt.value);
    }
    if (actualTimeMs.present) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs.value);
    }
    if (actualReps.present) {
      map['actual_reps'] = Variable<int>(actualReps.value);
    }
    if (actualScore.present) {
      map['actual_score'] = Variable<double>(actualScore.value);
    }
    if (actualScoreTimeMs.present) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs.value);
    }
    if (scoreInputModeSnapshot.present) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot.value,
      );
    }
    if (scoreLabelSnapshot.present) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot.value);
    }
    if (scoreUnitSnapshot.present) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot.value);
    }
    if (note.present) {
      map['note'] = Variable<String>(note.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ActiveSetResultsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('activeWorkoutSessionId: $activeWorkoutSessionId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('note: $note, ')
          ..write('status: $status, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ChangeLogEntriesTable extends ChangeLogEntries
    with TableInfo<$ChangeLogEntriesTable, ChangeLogEntry> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ChangeLogEntriesTable(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 _entityTypeMeta = const VerificationMeta(
    'entityType',
  );
  @override
  late final GeneratedColumn<String> entityType = GeneratedColumn<String>(
    'entity_type',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _entityIdMeta = const VerificationMeta(
    'entityId',
  );
  @override
  late final GeneratedColumn<String> entityId = GeneratedColumn<String>(
    'entity_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _operationMeta = const VerificationMeta(
    'operation',
  );
  @override
  late final GeneratedColumn<String> operation = GeneratedColumn<String>(
    'operation',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _payloadHashMeta = const VerificationMeta(
    'payloadHash',
  );
  @override
  late final GeneratedColumn<String> payloadHash = GeneratedColumn<String>(
    'payload_hash',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _syncedAtMeta = const VerificationMeta(
    'syncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> syncedAt = GeneratedColumn<DateTime>(
    'synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    entityType,
    entityId,
    operation,
    payloadHash,
    localRevision,
    originDeviceId,
    createdAt,
    syncedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'change_log';
  @override
  VerificationContext validateIntegrity(
    Insertable<ChangeLogEntry> 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('entity_type')) {
      context.handle(
        _entityTypeMeta,
        entityType.isAcceptableOrUnknown(data['entity_type']!, _entityTypeMeta),
      );
    } else if (isInserting) {
      context.missing(_entityTypeMeta);
    }
    if (data.containsKey('entity_id')) {
      context.handle(
        _entityIdMeta,
        entityId.isAcceptableOrUnknown(data['entity_id']!, _entityIdMeta),
      );
    } else if (isInserting) {
      context.missing(_entityIdMeta);
    }
    if (data.containsKey('operation')) {
      context.handle(
        _operationMeta,
        operation.isAcceptableOrUnknown(data['operation']!, _operationMeta),
      );
    } else if (isInserting) {
      context.missing(_operationMeta);
    }
    if (data.containsKey('payload_hash')) {
      context.handle(
        _payloadHashMeta,
        payloadHash.isAcceptableOrUnknown(
          data['payload_hash']!,
          _payloadHashMeta,
        ),
      );
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('synced_at')) {
      context.handle(
        _syncedAtMeta,
        syncedAt.isAcceptableOrUnknown(data['synced_at']!, _syncedAtMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ChangeLogEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ChangeLogEntry(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      entityType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}entity_type'],
      )!,
      entityId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}entity_id'],
      )!,
      operation: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}operation'],
      )!,
      payloadHash: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}payload_hash'],
      ),
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      syncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}synced_at'],
      ),
    );
  }

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

class ChangeLogEntry extends DataClass implements Insertable<ChangeLogEntry> {
  final String id;
  final String entityType;
  final String entityId;
  final String operation;
  final String? payloadHash;
  final int localRevision;
  final String originDeviceId;
  final DateTime createdAt;
  final DateTime? syncedAt;
  const ChangeLogEntry({
    required this.id,
    required this.entityType,
    required this.entityId,
    required this.operation,
    this.payloadHash,
    required this.localRevision,
    required this.originDeviceId,
    required this.createdAt,
    this.syncedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['entity_type'] = Variable<String>(entityType);
    map['entity_id'] = Variable<String>(entityId);
    map['operation'] = Variable<String>(operation);
    if (!nullToAbsent || payloadHash != null) {
      map['payload_hash'] = Variable<String>(payloadHash);
    }
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    map['created_at'] = Variable<DateTime>(createdAt);
    if (!nullToAbsent || syncedAt != null) {
      map['synced_at'] = Variable<DateTime>(syncedAt);
    }
    return map;
  }

  ChangeLogEntriesCompanion toCompanion(bool nullToAbsent) {
    return ChangeLogEntriesCompanion(
      id: Value(id),
      entityType: Value(entityType),
      entityId: Value(entityId),
      operation: Value(operation),
      payloadHash: payloadHash == null && nullToAbsent
          ? const Value.absent()
          : Value(payloadHash),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      createdAt: Value(createdAt),
      syncedAt: syncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(syncedAt),
    );
  }

  factory ChangeLogEntry.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ChangeLogEntry(
      id: serializer.fromJson<String>(json['id']),
      entityType: serializer.fromJson<String>(json['entityType']),
      entityId: serializer.fromJson<String>(json['entityId']),
      operation: serializer.fromJson<String>(json['operation']),
      payloadHash: serializer.fromJson<String?>(json['payloadHash']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      syncedAt: serializer.fromJson<DateTime?>(json['syncedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'entityType': serializer.toJson<String>(entityType),
      'entityId': serializer.toJson<String>(entityId),
      'operation': serializer.toJson<String>(operation),
      'payloadHash': serializer.toJson<String?>(payloadHash),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'syncedAt': serializer.toJson<DateTime?>(syncedAt),
    };
  }

  ChangeLogEntry copyWith({
    String? id,
    String? entityType,
    String? entityId,
    String? operation,
    Value<String?> payloadHash = const Value.absent(),
    int? localRevision,
    String? originDeviceId,
    DateTime? createdAt,
    Value<DateTime?> syncedAt = const Value.absent(),
  }) => ChangeLogEntry(
    id: id ?? this.id,
    entityType: entityType ?? this.entityType,
    entityId: entityId ?? this.entityId,
    operation: operation ?? this.operation,
    payloadHash: payloadHash.present ? payloadHash.value : this.payloadHash,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    createdAt: createdAt ?? this.createdAt,
    syncedAt: syncedAt.present ? syncedAt.value : this.syncedAt,
  );
  ChangeLogEntry copyWithCompanion(ChangeLogEntriesCompanion data) {
    return ChangeLogEntry(
      id: data.id.present ? data.id.value : this.id,
      entityType: data.entityType.present
          ? data.entityType.value
          : this.entityType,
      entityId: data.entityId.present ? data.entityId.value : this.entityId,
      operation: data.operation.present ? data.operation.value : this.operation,
      payloadHash: data.payloadHash.present
          ? data.payloadHash.value
          : this.payloadHash,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      syncedAt: data.syncedAt.present ? data.syncedAt.value : this.syncedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ChangeLogEntry(')
          ..write('id: $id, ')
          ..write('entityType: $entityType, ')
          ..write('entityId: $entityId, ')
          ..write('operation: $operation, ')
          ..write('payloadHash: $payloadHash, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('createdAt: $createdAt, ')
          ..write('syncedAt: $syncedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    entityType,
    entityId,
    operation,
    payloadHash,
    localRevision,
    originDeviceId,
    createdAt,
    syncedAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ChangeLogEntry &&
          other.id == this.id &&
          other.entityType == this.entityType &&
          other.entityId == this.entityId &&
          other.operation == this.operation &&
          other.payloadHash == this.payloadHash &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.createdAt == this.createdAt &&
          other.syncedAt == this.syncedAt);
}

class ChangeLogEntriesCompanion extends UpdateCompanion<ChangeLogEntry> {
  final Value<String> id;
  final Value<String> entityType;
  final Value<String> entityId;
  final Value<String> operation;
  final Value<String?> payloadHash;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<DateTime> createdAt;
  final Value<DateTime?> syncedAt;
  final Value<int> rowid;
  const ChangeLogEntriesCompanion({
    this.id = const Value.absent(),
    this.entityType = const Value.absent(),
    this.entityId = const Value.absent(),
    this.operation = const Value.absent(),
    this.payloadHash = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.syncedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ChangeLogEntriesCompanion.insert({
    required String id,
    required String entityType,
    required String entityId,
    required String operation,
    this.payloadHash = const Value.absent(),
    required int localRevision,
    required String originDeviceId,
    required DateTime createdAt,
    this.syncedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       entityType = Value(entityType),
       entityId = Value(entityId),
       operation = Value(operation),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       createdAt = Value(createdAt);
  static Insertable<ChangeLogEntry> custom({
    Expression<String>? id,
    Expression<String>? entityType,
    Expression<String>? entityId,
    Expression<String>? operation,
    Expression<String>? payloadHash,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? syncedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (entityType != null) 'entity_type': entityType,
      if (entityId != null) 'entity_id': entityId,
      if (operation != null) 'operation': operation,
      if (payloadHash != null) 'payload_hash': payloadHash,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (createdAt != null) 'created_at': createdAt,
      if (syncedAt != null) 'synced_at': syncedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ChangeLogEntriesCompanion copyWith({
    Value<String>? id,
    Value<String>? entityType,
    Value<String>? entityId,
    Value<String>? operation,
    Value<String?>? payloadHash,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<DateTime>? createdAt,
    Value<DateTime?>? syncedAt,
    Value<int>? rowid,
  }) {
    return ChangeLogEntriesCompanion(
      id: id ?? this.id,
      entityType: entityType ?? this.entityType,
      entityId: entityId ?? this.entityId,
      operation: operation ?? this.operation,
      payloadHash: payloadHash ?? this.payloadHash,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      createdAt: createdAt ?? this.createdAt,
      syncedAt: syncedAt ?? this.syncedAt,
      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 (entityType.present) {
      map['entity_type'] = Variable<String>(entityType.value);
    }
    if (entityId.present) {
      map['entity_id'] = Variable<String>(entityId.value);
    }
    if (operation.present) {
      map['operation'] = Variable<String>(operation.value);
    }
    if (payloadHash.present) {
      map['payload_hash'] = Variable<String>(payloadHash.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<DateTime>(createdAt.value);
    }
    if (syncedAt.present) {
      map['synced_at'] = Variable<DateTime>(syncedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ChangeLogEntriesCompanion(')
          ..write('id: $id, ')
          ..write('entityType: $entityType, ')
          ..write('entityId: $entityId, ')
          ..write('operation: $operation, ')
          ..write('payloadHash: $payloadHash, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('createdAt: $createdAt, ')
          ..write('syncedAt: $syncedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $MediaAssetsTable extends MediaAssets
    with TableInfo<$MediaAssetsTable, MediaAsset> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $MediaAssetsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _kindMeta = const VerificationMeta('kind');
  @override
  late final GeneratedColumn<String> kind = GeneratedColumn<String>(
    'kind',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _localUriMeta = const VerificationMeta(
    'localUri',
  );
  @override
  late final GeneratedColumn<String> localUri = GeneratedColumn<String>(
    'local_uri',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  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 _sizeBytesMeta = const VerificationMeta(
    'sizeBytes',
  );
  @override
  late final GeneratedColumn<int> sizeBytes = GeneratedColumn<int>(
    'size_bytes',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _widthMeta = const VerificationMeta('width');
  @override
  late final GeneratedColumn<int> width = GeneratedColumn<int>(
    'width',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _heightMeta = const VerificationMeta('height');
  @override
  late final GeneratedColumn<int> height = GeneratedColumn<int>(
    'height',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _durationMsMeta = const VerificationMeta(
    'durationMs',
  );
  @override
  late final GeneratedColumn<int> durationMs = GeneratedColumn<int>(
    'duration_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _checksumMeta = const VerificationMeta(
    'checksum',
  );
  @override
  late final GeneratedColumn<String> checksum = GeneratedColumn<String>(
    'checksum',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteUriMeta = const VerificationMeta(
    'remoteUri',
  );
  @override
  late final GeneratedColumn<String> remoteUri = GeneratedColumn<String>(
    'remote_uri',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _thumbnailLocalUriMeta = const VerificationMeta(
    'thumbnailLocalUri',
  );
  @override
  late final GeneratedColumn<String> thumbnailLocalUri =
      GeneratedColumn<String>(
        'thumbnail_local_uri',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    kind,
    localUri,
    mimeType,
    sizeBytes,
    width,
    height,
    durationMs,
    checksum,
    remoteUri,
    thumbnailLocalUri,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'media_assets';
  @override
  VerificationContext validateIntegrity(
    Insertable<MediaAsset> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('kind')) {
      context.handle(
        _kindMeta,
        kind.isAcceptableOrUnknown(data['kind']!, _kindMeta),
      );
    } else if (isInserting) {
      context.missing(_kindMeta);
    }
    if (data.containsKey('local_uri')) {
      context.handle(
        _localUriMeta,
        localUri.isAcceptableOrUnknown(data['local_uri']!, _localUriMeta),
      );
    } else if (isInserting) {
      context.missing(_localUriMeta);
    }
    if (data.containsKey('mime_type')) {
      context.handle(
        _mimeTypeMeta,
        mimeType.isAcceptableOrUnknown(data['mime_type']!, _mimeTypeMeta),
      );
    }
    if (data.containsKey('size_bytes')) {
      context.handle(
        _sizeBytesMeta,
        sizeBytes.isAcceptableOrUnknown(data['size_bytes']!, _sizeBytesMeta),
      );
    }
    if (data.containsKey('width')) {
      context.handle(
        _widthMeta,
        width.isAcceptableOrUnknown(data['width']!, _widthMeta),
      );
    }
    if (data.containsKey('height')) {
      context.handle(
        _heightMeta,
        height.isAcceptableOrUnknown(data['height']!, _heightMeta),
      );
    }
    if (data.containsKey('duration_ms')) {
      context.handle(
        _durationMsMeta,
        durationMs.isAcceptableOrUnknown(data['duration_ms']!, _durationMsMeta),
      );
    }
    if (data.containsKey('checksum')) {
      context.handle(
        _checksumMeta,
        checksum.isAcceptableOrUnknown(data['checksum']!, _checksumMeta),
      );
    }
    if (data.containsKey('remote_uri')) {
      context.handle(
        _remoteUriMeta,
        remoteUri.isAcceptableOrUnknown(data['remote_uri']!, _remoteUriMeta),
      );
    }
    if (data.containsKey('thumbnail_local_uri')) {
      context.handle(
        _thumbnailLocalUriMeta,
        thumbnailLocalUri.isAcceptableOrUnknown(
          data['thumbnail_local_uri']!,
          _thumbnailLocalUriMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  MediaAsset map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return MediaAsset(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      kind: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}kind'],
      )!,
      localUri: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}local_uri'],
      )!,
      mimeType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}mime_type'],
      ),
      sizeBytes: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}size_bytes'],
      ),
      width: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}width'],
      ),
      height: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}height'],
      ),
      durationMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}duration_ms'],
      ),
      checksum: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}checksum'],
      ),
      remoteUri: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_uri'],
      ),
      thumbnailLocalUri: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}thumbnail_local_uri'],
      ),
    );
  }

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

class MediaAsset extends DataClass implements Insertable<MediaAsset> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String kind;
  final String localUri;
  final String? mimeType;
  final int? sizeBytes;
  final int? width;
  final int? height;
  final int? durationMs;
  final String? checksum;
  final String? remoteUri;
  final String? thumbnailLocalUri;
  const MediaAsset({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.kind,
    required this.localUri,
    this.mimeType,
    this.sizeBytes,
    this.width,
    this.height,
    this.durationMs,
    this.checksum,
    this.remoteUri,
    this.thumbnailLocalUri,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['kind'] = Variable<String>(kind);
    map['local_uri'] = Variable<String>(localUri);
    if (!nullToAbsent || mimeType != null) {
      map['mime_type'] = Variable<String>(mimeType);
    }
    if (!nullToAbsent || sizeBytes != null) {
      map['size_bytes'] = Variable<int>(sizeBytes);
    }
    if (!nullToAbsent || width != null) {
      map['width'] = Variable<int>(width);
    }
    if (!nullToAbsent || height != null) {
      map['height'] = Variable<int>(height);
    }
    if (!nullToAbsent || durationMs != null) {
      map['duration_ms'] = Variable<int>(durationMs);
    }
    if (!nullToAbsent || checksum != null) {
      map['checksum'] = Variable<String>(checksum);
    }
    if (!nullToAbsent || remoteUri != null) {
      map['remote_uri'] = Variable<String>(remoteUri);
    }
    if (!nullToAbsent || thumbnailLocalUri != null) {
      map['thumbnail_local_uri'] = Variable<String>(thumbnailLocalUri);
    }
    return map;
  }

  MediaAssetsCompanion toCompanion(bool nullToAbsent) {
    return MediaAssetsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      kind: Value(kind),
      localUri: Value(localUri),
      mimeType: mimeType == null && nullToAbsent
          ? const Value.absent()
          : Value(mimeType),
      sizeBytes: sizeBytes == null && nullToAbsent
          ? const Value.absent()
          : Value(sizeBytes),
      width: width == null && nullToAbsent
          ? const Value.absent()
          : Value(width),
      height: height == null && nullToAbsent
          ? const Value.absent()
          : Value(height),
      durationMs: durationMs == null && nullToAbsent
          ? const Value.absent()
          : Value(durationMs),
      checksum: checksum == null && nullToAbsent
          ? const Value.absent()
          : Value(checksum),
      remoteUri: remoteUri == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteUri),
      thumbnailLocalUri: thumbnailLocalUri == null && nullToAbsent
          ? const Value.absent()
          : Value(thumbnailLocalUri),
    );
  }

  factory MediaAsset.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return MediaAsset(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      kind: serializer.fromJson<String>(json['kind']),
      localUri: serializer.fromJson<String>(json['localUri']),
      mimeType: serializer.fromJson<String?>(json['mimeType']),
      sizeBytes: serializer.fromJson<int?>(json['sizeBytes']),
      width: serializer.fromJson<int?>(json['width']),
      height: serializer.fromJson<int?>(json['height']),
      durationMs: serializer.fromJson<int?>(json['durationMs']),
      checksum: serializer.fromJson<String?>(json['checksum']),
      remoteUri: serializer.fromJson<String?>(json['remoteUri']),
      thumbnailLocalUri: serializer.fromJson<String?>(
        json['thumbnailLocalUri'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'kind': serializer.toJson<String>(kind),
      'localUri': serializer.toJson<String>(localUri),
      'mimeType': serializer.toJson<String?>(mimeType),
      'sizeBytes': serializer.toJson<int?>(sizeBytes),
      'width': serializer.toJson<int?>(width),
      'height': serializer.toJson<int?>(height),
      'durationMs': serializer.toJson<int?>(durationMs),
      'checksum': serializer.toJson<String?>(checksum),
      'remoteUri': serializer.toJson<String?>(remoteUri),
      'thumbnailLocalUri': serializer.toJson<String?>(thumbnailLocalUri),
    };
  }

  MediaAsset copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? kind,
    String? localUri,
    Value<String?> mimeType = const Value.absent(),
    Value<int?> sizeBytes = const Value.absent(),
    Value<int?> width = const Value.absent(),
    Value<int?> height = const Value.absent(),
    Value<int?> durationMs = const Value.absent(),
    Value<String?> checksum = const Value.absent(),
    Value<String?> remoteUri = const Value.absent(),
    Value<String?> thumbnailLocalUri = const Value.absent(),
  }) => MediaAsset(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    kind: kind ?? this.kind,
    localUri: localUri ?? this.localUri,
    mimeType: mimeType.present ? mimeType.value : this.mimeType,
    sizeBytes: sizeBytes.present ? sizeBytes.value : this.sizeBytes,
    width: width.present ? width.value : this.width,
    height: height.present ? height.value : this.height,
    durationMs: durationMs.present ? durationMs.value : this.durationMs,
    checksum: checksum.present ? checksum.value : this.checksum,
    remoteUri: remoteUri.present ? remoteUri.value : this.remoteUri,
    thumbnailLocalUri: thumbnailLocalUri.present
        ? thumbnailLocalUri.value
        : this.thumbnailLocalUri,
  );
  MediaAsset copyWithCompanion(MediaAssetsCompanion data) {
    return MediaAsset(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      kind: data.kind.present ? data.kind.value : this.kind,
      localUri: data.localUri.present ? data.localUri.value : this.localUri,
      mimeType: data.mimeType.present ? data.mimeType.value : this.mimeType,
      sizeBytes: data.sizeBytes.present ? data.sizeBytes.value : this.sizeBytes,
      width: data.width.present ? data.width.value : this.width,
      height: data.height.present ? data.height.value : this.height,
      durationMs: data.durationMs.present
          ? data.durationMs.value
          : this.durationMs,
      checksum: data.checksum.present ? data.checksum.value : this.checksum,
      remoteUri: data.remoteUri.present ? data.remoteUri.value : this.remoteUri,
      thumbnailLocalUri: data.thumbnailLocalUri.present
          ? data.thumbnailLocalUri.value
          : this.thumbnailLocalUri,
    );
  }

  @override
  String toString() {
    return (StringBuffer('MediaAsset(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('kind: $kind, ')
          ..write('localUri: $localUri, ')
          ..write('mimeType: $mimeType, ')
          ..write('sizeBytes: $sizeBytes, ')
          ..write('width: $width, ')
          ..write('height: $height, ')
          ..write('durationMs: $durationMs, ')
          ..write('checksum: $checksum, ')
          ..write('remoteUri: $remoteUri, ')
          ..write('thumbnailLocalUri: $thumbnailLocalUri')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    kind,
    localUri,
    mimeType,
    sizeBytes,
    width,
    height,
    durationMs,
    checksum,
    remoteUri,
    thumbnailLocalUri,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is MediaAsset &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.kind == this.kind &&
          other.localUri == this.localUri &&
          other.mimeType == this.mimeType &&
          other.sizeBytes == this.sizeBytes &&
          other.width == this.width &&
          other.height == this.height &&
          other.durationMs == this.durationMs &&
          other.checksum == this.checksum &&
          other.remoteUri == this.remoteUri &&
          other.thumbnailLocalUri == this.thumbnailLocalUri);
}

class MediaAssetsCompanion extends UpdateCompanion<MediaAsset> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> kind;
  final Value<String> localUri;
  final Value<String?> mimeType;
  final Value<int?> sizeBytes;
  final Value<int?> width;
  final Value<int?> height;
  final Value<int?> durationMs;
  final Value<String?> checksum;
  final Value<String?> remoteUri;
  final Value<String?> thumbnailLocalUri;
  final Value<int> rowid;
  const MediaAssetsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.kind = const Value.absent(),
    this.localUri = const Value.absent(),
    this.mimeType = const Value.absent(),
    this.sizeBytes = const Value.absent(),
    this.width = const Value.absent(),
    this.height = const Value.absent(),
    this.durationMs = const Value.absent(),
    this.checksum = const Value.absent(),
    this.remoteUri = const Value.absent(),
    this.thumbnailLocalUri = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  MediaAssetsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String kind,
    required String localUri,
    this.mimeType = const Value.absent(),
    this.sizeBytes = const Value.absent(),
    this.width = const Value.absent(),
    this.height = const Value.absent(),
    this.durationMs = const Value.absent(),
    this.checksum = const Value.absent(),
    this.remoteUri = const Value.absent(),
    this.thumbnailLocalUri = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       kind = Value(kind),
       localUri = Value(localUri);
  static Insertable<MediaAsset> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? kind,
    Expression<String>? localUri,
    Expression<String>? mimeType,
    Expression<int>? sizeBytes,
    Expression<int>? width,
    Expression<int>? height,
    Expression<int>? durationMs,
    Expression<String>? checksum,
    Expression<String>? remoteUri,
    Expression<String>? thumbnailLocalUri,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (kind != null) 'kind': kind,
      if (localUri != null) 'local_uri': localUri,
      if (mimeType != null) 'mime_type': mimeType,
      if (sizeBytes != null) 'size_bytes': sizeBytes,
      if (width != null) 'width': width,
      if (height != null) 'height': height,
      if (durationMs != null) 'duration_ms': durationMs,
      if (checksum != null) 'checksum': checksum,
      if (remoteUri != null) 'remote_uri': remoteUri,
      if (thumbnailLocalUri != null) 'thumbnail_local_uri': thumbnailLocalUri,
      if (rowid != null) 'rowid': rowid,
    });
  }

  MediaAssetsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? kind,
    Value<String>? localUri,
    Value<String?>? mimeType,
    Value<int?>? sizeBytes,
    Value<int?>? width,
    Value<int?>? height,
    Value<int?>? durationMs,
    Value<String?>? checksum,
    Value<String?>? remoteUri,
    Value<String?>? thumbnailLocalUri,
    Value<int>? rowid,
  }) {
    return MediaAssetsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      kind: kind ?? this.kind,
      localUri: localUri ?? this.localUri,
      mimeType: mimeType ?? this.mimeType,
      sizeBytes: sizeBytes ?? this.sizeBytes,
      width: width ?? this.width,
      height: height ?? this.height,
      durationMs: durationMs ?? this.durationMs,
      checksum: checksum ?? this.checksum,
      remoteUri: remoteUri ?? this.remoteUri,
      thumbnailLocalUri: thumbnailLocalUri ?? this.thumbnailLocalUri,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (kind.present) {
      map['kind'] = Variable<String>(kind.value);
    }
    if (localUri.present) {
      map['local_uri'] = Variable<String>(localUri.value);
    }
    if (mimeType.present) {
      map['mime_type'] = Variable<String>(mimeType.value);
    }
    if (sizeBytes.present) {
      map['size_bytes'] = Variable<int>(sizeBytes.value);
    }
    if (width.present) {
      map['width'] = Variable<int>(width.value);
    }
    if (height.present) {
      map['height'] = Variable<int>(height.value);
    }
    if (durationMs.present) {
      map['duration_ms'] = Variable<int>(durationMs.value);
    }
    if (checksum.present) {
      map['checksum'] = Variable<String>(checksum.value);
    }
    if (remoteUri.present) {
      map['remote_uri'] = Variable<String>(remoteUri.value);
    }
    if (thumbnailLocalUri.present) {
      map['thumbnail_local_uri'] = Variable<String>(thumbnailLocalUri.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('MediaAssetsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('kind: $kind, ')
          ..write('localUri: $localUri, ')
          ..write('mimeType: $mimeType, ')
          ..write('sizeBytes: $sizeBytes, ')
          ..write('width: $width, ')
          ..write('height: $height, ')
          ..write('durationMs: $durationMs, ')
          ..write('checksum: $checksum, ')
          ..write('remoteUri: $remoteUri, ')
          ..write('thumbnailLocalUri: $thumbnailLocalUri, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ExercisesTable extends Exercises
    with TableInfo<$ExercisesTable, Exercise> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ExercisesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _descriptionMeta = const VerificationMeta(
    'description',
  );
  @override
  late final GeneratedColumn<String> description = GeneratedColumn<String>(
    'description',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _iconMediaIdMeta = const VerificationMeta(
    'iconMediaId',
  );
  @override
  late final GeneratedColumn<String> iconMediaId = GeneratedColumn<String>(
    'icon_media_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES media_assets (id)',
    ),
  );
  static const VerificationMeta _videoMediaIdMeta = const VerificationMeta(
    'videoMediaId',
  );
  @override
  late final GeneratedColumn<String> videoMediaId = GeneratedColumn<String>(
    'video_media_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES media_assets (id)',
    ),
  );
  static const VerificationMeta _hasTimeMeasureMeta = const VerificationMeta(
    'hasTimeMeasure',
  );
  @override
  late final GeneratedColumn<bool> hasTimeMeasure = GeneratedColumn<bool>(
    'has_time_measure',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_time_measure" IN (0, 1))',
    ),
  );
  static const VerificationMeta _hasRepsMeasureMeta = const VerificationMeta(
    'hasRepsMeasure',
  );
  @override
  late final GeneratedColumn<bool> hasRepsMeasure = GeneratedColumn<bool>(
    'has_reps_measure',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_reps_measure" IN (0, 1))',
    ),
  );
  static const VerificationMeta _hasScoreMeasureMeta = const VerificationMeta(
    'hasScoreMeasure',
  );
  @override
  late final GeneratedColumn<bool> hasScoreMeasure = GeneratedColumn<bool>(
    'has_score_measure',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_score_measure" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreInputModeMeta = const VerificationMeta(
    'scoreInputMode',
  );
  @override
  late final GeneratedColumn<String> scoreInputMode = GeneratedColumn<String>(
    'score_input_mode',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('manual'),
  );
  static const VerificationMeta _scoreLabelMeta = const VerificationMeta(
    'scoreLabel',
  );
  @override
  late final GeneratedColumn<String> scoreLabel = GeneratedColumn<String>(
    'score_label',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _scoreUnitMeta = const VerificationMeta(
    'scoreUnit',
  );
  @override
  late final GeneratedColumn<String> scoreUnit = GeneratedColumn<String>(
    'score_unit',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _defaultTargetTimeSecondsMeta =
      const VerificationMeta('defaultTargetTimeSeconds');
  @override
  late final GeneratedColumn<int> defaultTargetTimeSeconds =
      GeneratedColumn<int>(
        'default_target_time_seconds',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _defaultTargetRepsMeta = const VerificationMeta(
    'defaultTargetReps',
  );
  @override
  late final GeneratedColumn<int> defaultTargetReps = GeneratedColumn<int>(
    'default_target_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _defaultTargetScoreMeta =
      const VerificationMeta('defaultTargetScore');
  @override
  late final GeneratedColumn<double> defaultTargetScore =
      GeneratedColumn<double>(
        'default_target_score',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _defaultTargetScoreTimeMsMeta =
      const VerificationMeta('defaultTargetScoreTimeMs');
  @override
  late final GeneratedColumn<int> defaultTargetScoreTimeMs =
      GeneratedColumn<int>(
        'default_target_score_time_ms',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _autoStartNextTimedStepMeta =
      const VerificationMeta('autoStartNextTimedStep');
  @override
  late final GeneratedColumn<bool> autoStartNextTimedStep =
      GeneratedColumn<bool>(
        'auto_start_next_timed_step',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("auto_start_next_timed_step" IN (0, 1))',
        ),
        defaultValue: const Constant(true),
      );
  static const VerificationMeta _categoryMeta = const VerificationMeta(
    'category',
  );
  @override
  late final GeneratedColumn<String> category = GeneratedColumn<String>(
    'category',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('uncategorized'),
  );
  static const VerificationMeta _isExampleMeta = const VerificationMeta(
    'isExample',
  );
  @override
  late final GeneratedColumn<bool> isExample = GeneratedColumn<bool>(
    'is_example',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_example" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _tagsJsonMeta = const VerificationMeta(
    'tagsJson',
  );
  @override
  late final GeneratedColumn<String> tagsJson = GeneratedColumn<String>(
    'tags_json',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('[]'),
  );
  static const VerificationMeta _archivedAtMeta = const VerificationMeta(
    'archivedAt',
  );
  @override
  late final GeneratedColumn<DateTime> archivedAt = GeneratedColumn<DateTime>(
    'archived_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    description,
    iconMediaId,
    videoMediaId,
    hasTimeMeasure,
    hasRepsMeasure,
    hasScoreMeasure,
    scoreInputMode,
    scoreLabel,
    scoreUnit,
    defaultTargetTimeSeconds,
    defaultTargetReps,
    defaultTargetScore,
    defaultTargetScoreTimeMs,
    autoStartNextTimedStep,
    category,
    isExample,
    tagsJson,
    archivedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'exercises';
  @override
  VerificationContext validateIntegrity(
    Insertable<Exercise> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('description')) {
      context.handle(
        _descriptionMeta,
        description.isAcceptableOrUnknown(
          data['description']!,
          _descriptionMeta,
        ),
      );
    }
    if (data.containsKey('icon_media_id')) {
      context.handle(
        _iconMediaIdMeta,
        iconMediaId.isAcceptableOrUnknown(
          data['icon_media_id']!,
          _iconMediaIdMeta,
        ),
      );
    }
    if (data.containsKey('video_media_id')) {
      context.handle(
        _videoMediaIdMeta,
        videoMediaId.isAcceptableOrUnknown(
          data['video_media_id']!,
          _videoMediaIdMeta,
        ),
      );
    }
    if (data.containsKey('has_time_measure')) {
      context.handle(
        _hasTimeMeasureMeta,
        hasTimeMeasure.isAcceptableOrUnknown(
          data['has_time_measure']!,
          _hasTimeMeasureMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_hasTimeMeasureMeta);
    }
    if (data.containsKey('has_reps_measure')) {
      context.handle(
        _hasRepsMeasureMeta,
        hasRepsMeasure.isAcceptableOrUnknown(
          data['has_reps_measure']!,
          _hasRepsMeasureMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_hasRepsMeasureMeta);
    }
    if (data.containsKey('has_score_measure')) {
      context.handle(
        _hasScoreMeasureMeta,
        hasScoreMeasure.isAcceptableOrUnknown(
          data['has_score_measure']!,
          _hasScoreMeasureMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_hasScoreMeasureMeta);
    }
    if (data.containsKey('score_input_mode')) {
      context.handle(
        _scoreInputModeMeta,
        scoreInputMode.isAcceptableOrUnknown(
          data['score_input_mode']!,
          _scoreInputModeMeta,
        ),
      );
    }
    if (data.containsKey('score_label')) {
      context.handle(
        _scoreLabelMeta,
        scoreLabel.isAcceptableOrUnknown(data['score_label']!, _scoreLabelMeta),
      );
    }
    if (data.containsKey('score_unit')) {
      context.handle(
        _scoreUnitMeta,
        scoreUnit.isAcceptableOrUnknown(data['score_unit']!, _scoreUnitMeta),
      );
    }
    if (data.containsKey('default_target_time_seconds')) {
      context.handle(
        _defaultTargetTimeSecondsMeta,
        defaultTargetTimeSeconds.isAcceptableOrUnknown(
          data['default_target_time_seconds']!,
          _defaultTargetTimeSecondsMeta,
        ),
      );
    }
    if (data.containsKey('default_target_reps')) {
      context.handle(
        _defaultTargetRepsMeta,
        defaultTargetReps.isAcceptableOrUnknown(
          data['default_target_reps']!,
          _defaultTargetRepsMeta,
        ),
      );
    }
    if (data.containsKey('default_target_score')) {
      context.handle(
        _defaultTargetScoreMeta,
        defaultTargetScore.isAcceptableOrUnknown(
          data['default_target_score']!,
          _defaultTargetScoreMeta,
        ),
      );
    }
    if (data.containsKey('default_target_score_time_ms')) {
      context.handle(
        _defaultTargetScoreTimeMsMeta,
        defaultTargetScoreTimeMs.isAcceptableOrUnknown(
          data['default_target_score_time_ms']!,
          _defaultTargetScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('auto_start_next_timed_step')) {
      context.handle(
        _autoStartNextTimedStepMeta,
        autoStartNextTimedStep.isAcceptableOrUnknown(
          data['auto_start_next_timed_step']!,
          _autoStartNextTimedStepMeta,
        ),
      );
    }
    if (data.containsKey('category')) {
      context.handle(
        _categoryMeta,
        category.isAcceptableOrUnknown(data['category']!, _categoryMeta),
      );
    }
    if (data.containsKey('is_example')) {
      context.handle(
        _isExampleMeta,
        isExample.isAcceptableOrUnknown(data['is_example']!, _isExampleMeta),
      );
    }
    if (data.containsKey('tags_json')) {
      context.handle(
        _tagsJsonMeta,
        tagsJson.isAcceptableOrUnknown(data['tags_json']!, _tagsJsonMeta),
      );
    }
    if (data.containsKey('archived_at')) {
      context.handle(
        _archivedAtMeta,
        archivedAt.isAcceptableOrUnknown(data['archived_at']!, _archivedAtMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Exercise map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Exercise(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      description: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}description'],
      ),
      iconMediaId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}icon_media_id'],
      ),
      videoMediaId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}video_media_id'],
      ),
      hasTimeMeasure: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_time_measure'],
      )!,
      hasRepsMeasure: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_reps_measure'],
      )!,
      hasScoreMeasure: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_score_measure'],
      )!,
      scoreInputMode: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode'],
      )!,
      scoreLabel: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label'],
      ),
      scoreUnit: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit'],
      ),
      defaultTargetTimeSeconds: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_target_time_seconds'],
      ),
      defaultTargetReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_target_reps'],
      ),
      defaultTargetScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}default_target_score'],
      ),
      defaultTargetScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_target_score_time_ms'],
      ),
      autoStartNextTimedStep: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}auto_start_next_timed_step'],
      )!,
      category: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}category'],
      )!,
      isExample: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_example'],
      )!,
      tagsJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}tags_json'],
      )!,
      archivedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}archived_at'],
      ),
    );
  }

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

class Exercise extends DataClass implements Insertable<Exercise> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String name;
  final String? description;
  final String? iconMediaId;
  final String? videoMediaId;
  final bool hasTimeMeasure;
  final bool hasRepsMeasure;
  final bool hasScoreMeasure;
  final String scoreInputMode;
  final String? scoreLabel;
  final String? scoreUnit;
  final int? defaultTargetTimeSeconds;
  final int? defaultTargetReps;
  final double? defaultTargetScore;
  final int? defaultTargetScoreTimeMs;
  final bool autoStartNextTimedStep;
  final String category;
  final bool isExample;
  final String tagsJson;
  final DateTime? archivedAt;
  const Exercise({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.name,
    this.description,
    this.iconMediaId,
    this.videoMediaId,
    required this.hasTimeMeasure,
    required this.hasRepsMeasure,
    required this.hasScoreMeasure,
    required this.scoreInputMode,
    this.scoreLabel,
    this.scoreUnit,
    this.defaultTargetTimeSeconds,
    this.defaultTargetReps,
    this.defaultTargetScore,
    this.defaultTargetScoreTimeMs,
    required this.autoStartNextTimedStep,
    required this.category,
    required this.isExample,
    required this.tagsJson,
    this.archivedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['name'] = Variable<String>(name);
    if (!nullToAbsent || description != null) {
      map['description'] = Variable<String>(description);
    }
    if (!nullToAbsent || iconMediaId != null) {
      map['icon_media_id'] = Variable<String>(iconMediaId);
    }
    if (!nullToAbsent || videoMediaId != null) {
      map['video_media_id'] = Variable<String>(videoMediaId);
    }
    map['has_time_measure'] = Variable<bool>(hasTimeMeasure);
    map['has_reps_measure'] = Variable<bool>(hasRepsMeasure);
    map['has_score_measure'] = Variable<bool>(hasScoreMeasure);
    map['score_input_mode'] = Variable<String>(scoreInputMode);
    if (!nullToAbsent || scoreLabel != null) {
      map['score_label'] = Variable<String>(scoreLabel);
    }
    if (!nullToAbsent || scoreUnit != null) {
      map['score_unit'] = Variable<String>(scoreUnit);
    }
    if (!nullToAbsent || defaultTargetTimeSeconds != null) {
      map['default_target_time_seconds'] = Variable<int>(
        defaultTargetTimeSeconds,
      );
    }
    if (!nullToAbsent || defaultTargetReps != null) {
      map['default_target_reps'] = Variable<int>(defaultTargetReps);
    }
    if (!nullToAbsent || defaultTargetScore != null) {
      map['default_target_score'] = Variable<double>(defaultTargetScore);
    }
    if (!nullToAbsent || defaultTargetScoreTimeMs != null) {
      map['default_target_score_time_ms'] = Variable<int>(
        defaultTargetScoreTimeMs,
      );
    }
    map['auto_start_next_timed_step'] = Variable<bool>(autoStartNextTimedStep);
    map['category'] = Variable<String>(category);
    map['is_example'] = Variable<bool>(isExample);
    map['tags_json'] = Variable<String>(tagsJson);
    if (!nullToAbsent || archivedAt != null) {
      map['archived_at'] = Variable<DateTime>(archivedAt);
    }
    return map;
  }

  ExercisesCompanion toCompanion(bool nullToAbsent) {
    return ExercisesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      name: Value(name),
      description: description == null && nullToAbsent
          ? const Value.absent()
          : Value(description),
      iconMediaId: iconMediaId == null && nullToAbsent
          ? const Value.absent()
          : Value(iconMediaId),
      videoMediaId: videoMediaId == null && nullToAbsent
          ? const Value.absent()
          : Value(videoMediaId),
      hasTimeMeasure: Value(hasTimeMeasure),
      hasRepsMeasure: Value(hasRepsMeasure),
      hasScoreMeasure: Value(hasScoreMeasure),
      scoreInputMode: Value(scoreInputMode),
      scoreLabel: scoreLabel == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabel),
      scoreUnit: scoreUnit == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnit),
      defaultTargetTimeSeconds: defaultTargetTimeSeconds == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetTimeSeconds),
      defaultTargetReps: defaultTargetReps == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetReps),
      defaultTargetScore: defaultTargetScore == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetScore),
      defaultTargetScoreTimeMs: defaultTargetScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetScoreTimeMs),
      autoStartNextTimedStep: Value(autoStartNextTimedStep),
      category: Value(category),
      isExample: Value(isExample),
      tagsJson: Value(tagsJson),
      archivedAt: archivedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(archivedAt),
    );
  }

  factory Exercise.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Exercise(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      name: serializer.fromJson<String>(json['name']),
      description: serializer.fromJson<String?>(json['description']),
      iconMediaId: serializer.fromJson<String?>(json['iconMediaId']),
      videoMediaId: serializer.fromJson<String?>(json['videoMediaId']),
      hasTimeMeasure: serializer.fromJson<bool>(json['hasTimeMeasure']),
      hasRepsMeasure: serializer.fromJson<bool>(json['hasRepsMeasure']),
      hasScoreMeasure: serializer.fromJson<bool>(json['hasScoreMeasure']),
      scoreInputMode: serializer.fromJson<String>(json['scoreInputMode']),
      scoreLabel: serializer.fromJson<String?>(json['scoreLabel']),
      scoreUnit: serializer.fromJson<String?>(json['scoreUnit']),
      defaultTargetTimeSeconds: serializer.fromJson<int?>(
        json['defaultTargetTimeSeconds'],
      ),
      defaultTargetReps: serializer.fromJson<int?>(json['defaultTargetReps']),
      defaultTargetScore: serializer.fromJson<double?>(
        json['defaultTargetScore'],
      ),
      defaultTargetScoreTimeMs: serializer.fromJson<int?>(
        json['defaultTargetScoreTimeMs'],
      ),
      autoStartNextTimedStep: serializer.fromJson<bool>(
        json['autoStartNextTimedStep'],
      ),
      category: serializer.fromJson<String>(json['category']),
      isExample: serializer.fromJson<bool>(json['isExample']),
      tagsJson: serializer.fromJson<String>(json['tagsJson']),
      archivedAt: serializer.fromJson<DateTime?>(json['archivedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'name': serializer.toJson<String>(name),
      'description': serializer.toJson<String?>(description),
      'iconMediaId': serializer.toJson<String?>(iconMediaId),
      'videoMediaId': serializer.toJson<String?>(videoMediaId),
      'hasTimeMeasure': serializer.toJson<bool>(hasTimeMeasure),
      'hasRepsMeasure': serializer.toJson<bool>(hasRepsMeasure),
      'hasScoreMeasure': serializer.toJson<bool>(hasScoreMeasure),
      'scoreInputMode': serializer.toJson<String>(scoreInputMode),
      'scoreLabel': serializer.toJson<String?>(scoreLabel),
      'scoreUnit': serializer.toJson<String?>(scoreUnit),
      'defaultTargetTimeSeconds': serializer.toJson<int?>(
        defaultTargetTimeSeconds,
      ),
      'defaultTargetReps': serializer.toJson<int?>(defaultTargetReps),
      'defaultTargetScore': serializer.toJson<double?>(defaultTargetScore),
      'defaultTargetScoreTimeMs': serializer.toJson<int?>(
        defaultTargetScoreTimeMs,
      ),
      'autoStartNextTimedStep': serializer.toJson<bool>(autoStartNextTimedStep),
      'category': serializer.toJson<String>(category),
      'isExample': serializer.toJson<bool>(isExample),
      'tagsJson': serializer.toJson<String>(tagsJson),
      'archivedAt': serializer.toJson<DateTime?>(archivedAt),
    };
  }

  Exercise copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? name,
    Value<String?> description = const Value.absent(),
    Value<String?> iconMediaId = const Value.absent(),
    Value<String?> videoMediaId = const Value.absent(),
    bool? hasTimeMeasure,
    bool? hasRepsMeasure,
    bool? hasScoreMeasure,
    String? scoreInputMode,
    Value<String?> scoreLabel = const Value.absent(),
    Value<String?> scoreUnit = const Value.absent(),
    Value<int?> defaultTargetTimeSeconds = const Value.absent(),
    Value<int?> defaultTargetReps = const Value.absent(),
    Value<double?> defaultTargetScore = const Value.absent(),
    Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
    bool? autoStartNextTimedStep,
    String? category,
    bool? isExample,
    String? tagsJson,
    Value<DateTime?> archivedAt = const Value.absent(),
  }) => Exercise(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    name: name ?? this.name,
    description: description.present ? description.value : this.description,
    iconMediaId: iconMediaId.present ? iconMediaId.value : this.iconMediaId,
    videoMediaId: videoMediaId.present ? videoMediaId.value : this.videoMediaId,
    hasTimeMeasure: hasTimeMeasure ?? this.hasTimeMeasure,
    hasRepsMeasure: hasRepsMeasure ?? this.hasRepsMeasure,
    hasScoreMeasure: hasScoreMeasure ?? this.hasScoreMeasure,
    scoreInputMode: scoreInputMode ?? this.scoreInputMode,
    scoreLabel: scoreLabel.present ? scoreLabel.value : this.scoreLabel,
    scoreUnit: scoreUnit.present ? scoreUnit.value : this.scoreUnit,
    defaultTargetTimeSeconds: defaultTargetTimeSeconds.present
        ? defaultTargetTimeSeconds.value
        : this.defaultTargetTimeSeconds,
    defaultTargetReps: defaultTargetReps.present
        ? defaultTargetReps.value
        : this.defaultTargetReps,
    defaultTargetScore: defaultTargetScore.present
        ? defaultTargetScore.value
        : this.defaultTargetScore,
    defaultTargetScoreTimeMs: defaultTargetScoreTimeMs.present
        ? defaultTargetScoreTimeMs.value
        : this.defaultTargetScoreTimeMs,
    autoStartNextTimedStep:
        autoStartNextTimedStep ?? this.autoStartNextTimedStep,
    category: category ?? this.category,
    isExample: isExample ?? this.isExample,
    tagsJson: tagsJson ?? this.tagsJson,
    archivedAt: archivedAt.present ? archivedAt.value : this.archivedAt,
  );
  Exercise copyWithCompanion(ExercisesCompanion data) {
    return Exercise(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      name: data.name.present ? data.name.value : this.name,
      description: data.description.present
          ? data.description.value
          : this.description,
      iconMediaId: data.iconMediaId.present
          ? data.iconMediaId.value
          : this.iconMediaId,
      videoMediaId: data.videoMediaId.present
          ? data.videoMediaId.value
          : this.videoMediaId,
      hasTimeMeasure: data.hasTimeMeasure.present
          ? data.hasTimeMeasure.value
          : this.hasTimeMeasure,
      hasRepsMeasure: data.hasRepsMeasure.present
          ? data.hasRepsMeasure.value
          : this.hasRepsMeasure,
      hasScoreMeasure: data.hasScoreMeasure.present
          ? data.hasScoreMeasure.value
          : this.hasScoreMeasure,
      scoreInputMode: data.scoreInputMode.present
          ? data.scoreInputMode.value
          : this.scoreInputMode,
      scoreLabel: data.scoreLabel.present
          ? data.scoreLabel.value
          : this.scoreLabel,
      scoreUnit: data.scoreUnit.present ? data.scoreUnit.value : this.scoreUnit,
      defaultTargetTimeSeconds: data.defaultTargetTimeSeconds.present
          ? data.defaultTargetTimeSeconds.value
          : this.defaultTargetTimeSeconds,
      defaultTargetReps: data.defaultTargetReps.present
          ? data.defaultTargetReps.value
          : this.defaultTargetReps,
      defaultTargetScore: data.defaultTargetScore.present
          ? data.defaultTargetScore.value
          : this.defaultTargetScore,
      defaultTargetScoreTimeMs: data.defaultTargetScoreTimeMs.present
          ? data.defaultTargetScoreTimeMs.value
          : this.defaultTargetScoreTimeMs,
      autoStartNextTimedStep: data.autoStartNextTimedStep.present
          ? data.autoStartNextTimedStep.value
          : this.autoStartNextTimedStep,
      category: data.category.present ? data.category.value : this.category,
      isExample: data.isExample.present ? data.isExample.value : this.isExample,
      tagsJson: data.tagsJson.present ? data.tagsJson.value : this.tagsJson,
      archivedAt: data.archivedAt.present
          ? data.archivedAt.value
          : this.archivedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Exercise(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('description: $description, ')
          ..write('iconMediaId: $iconMediaId, ')
          ..write('videoMediaId: $videoMediaId, ')
          ..write('hasTimeMeasure: $hasTimeMeasure, ')
          ..write('hasRepsMeasure: $hasRepsMeasure, ')
          ..write('hasScoreMeasure: $hasScoreMeasure, ')
          ..write('scoreInputMode: $scoreInputMode, ')
          ..write('scoreLabel: $scoreLabel, ')
          ..write('scoreUnit: $scoreUnit, ')
          ..write('defaultTargetTimeSeconds: $defaultTargetTimeSeconds, ')
          ..write('defaultTargetReps: $defaultTargetReps, ')
          ..write('defaultTargetScore: $defaultTargetScore, ')
          ..write('defaultTargetScoreTimeMs: $defaultTargetScoreTimeMs, ')
          ..write('autoStartNextTimedStep: $autoStartNextTimedStep, ')
          ..write('category: $category, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson, ')
          ..write('archivedAt: $archivedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    description,
    iconMediaId,
    videoMediaId,
    hasTimeMeasure,
    hasRepsMeasure,
    hasScoreMeasure,
    scoreInputMode,
    scoreLabel,
    scoreUnit,
    defaultTargetTimeSeconds,
    defaultTargetReps,
    defaultTargetScore,
    defaultTargetScoreTimeMs,
    autoStartNextTimedStep,
    category,
    isExample,
    tagsJson,
    archivedAt,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Exercise &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.name == this.name &&
          other.description == this.description &&
          other.iconMediaId == this.iconMediaId &&
          other.videoMediaId == this.videoMediaId &&
          other.hasTimeMeasure == this.hasTimeMeasure &&
          other.hasRepsMeasure == this.hasRepsMeasure &&
          other.hasScoreMeasure == this.hasScoreMeasure &&
          other.scoreInputMode == this.scoreInputMode &&
          other.scoreLabel == this.scoreLabel &&
          other.scoreUnit == this.scoreUnit &&
          other.defaultTargetTimeSeconds == this.defaultTargetTimeSeconds &&
          other.defaultTargetReps == this.defaultTargetReps &&
          other.defaultTargetScore == this.defaultTargetScore &&
          other.defaultTargetScoreTimeMs == this.defaultTargetScoreTimeMs &&
          other.autoStartNextTimedStep == this.autoStartNextTimedStep &&
          other.category == this.category &&
          other.isExample == this.isExample &&
          other.tagsJson == this.tagsJson &&
          other.archivedAt == this.archivedAt);
}

class ExercisesCompanion extends UpdateCompanion<Exercise> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> name;
  final Value<String?> description;
  final Value<String?> iconMediaId;
  final Value<String?> videoMediaId;
  final Value<bool> hasTimeMeasure;
  final Value<bool> hasRepsMeasure;
  final Value<bool> hasScoreMeasure;
  final Value<String> scoreInputMode;
  final Value<String?> scoreLabel;
  final Value<String?> scoreUnit;
  final Value<int?> defaultTargetTimeSeconds;
  final Value<int?> defaultTargetReps;
  final Value<double?> defaultTargetScore;
  final Value<int?> defaultTargetScoreTimeMs;
  final Value<bool> autoStartNextTimedStep;
  final Value<String> category;
  final Value<bool> isExample;
  final Value<String> tagsJson;
  final Value<DateTime?> archivedAt;
  final Value<int> rowid;
  const ExercisesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.name = const Value.absent(),
    this.description = const Value.absent(),
    this.iconMediaId = const Value.absent(),
    this.videoMediaId = const Value.absent(),
    this.hasTimeMeasure = const Value.absent(),
    this.hasRepsMeasure = const Value.absent(),
    this.hasScoreMeasure = const Value.absent(),
    this.scoreInputMode = const Value.absent(),
    this.scoreLabel = const Value.absent(),
    this.scoreUnit = const Value.absent(),
    this.defaultTargetTimeSeconds = const Value.absent(),
    this.defaultTargetReps = const Value.absent(),
    this.defaultTargetScore = const Value.absent(),
    this.defaultTargetScoreTimeMs = const Value.absent(),
    this.autoStartNextTimedStep = const Value.absent(),
    this.category = const Value.absent(),
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.archivedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ExercisesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String name,
    this.description = const Value.absent(),
    this.iconMediaId = const Value.absent(),
    this.videoMediaId = const Value.absent(),
    required bool hasTimeMeasure,
    required bool hasRepsMeasure,
    required bool hasScoreMeasure,
    this.scoreInputMode = const Value.absent(),
    this.scoreLabel = const Value.absent(),
    this.scoreUnit = const Value.absent(),
    this.defaultTargetTimeSeconds = const Value.absent(),
    this.defaultTargetReps = const Value.absent(),
    this.defaultTargetScore = const Value.absent(),
    this.defaultTargetScoreTimeMs = const Value.absent(),
    this.autoStartNextTimedStep = const Value.absent(),
    this.category = const Value.absent(),
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.archivedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       name = Value(name),
       hasTimeMeasure = Value(hasTimeMeasure),
       hasRepsMeasure = Value(hasRepsMeasure),
       hasScoreMeasure = Value(hasScoreMeasure);
  static Insertable<Exercise> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? name,
    Expression<String>? description,
    Expression<String>? iconMediaId,
    Expression<String>? videoMediaId,
    Expression<bool>? hasTimeMeasure,
    Expression<bool>? hasRepsMeasure,
    Expression<bool>? hasScoreMeasure,
    Expression<String>? scoreInputMode,
    Expression<String>? scoreLabel,
    Expression<String>? scoreUnit,
    Expression<int>? defaultTargetTimeSeconds,
    Expression<int>? defaultTargetReps,
    Expression<double>? defaultTargetScore,
    Expression<int>? defaultTargetScoreTimeMs,
    Expression<bool>? autoStartNextTimedStep,
    Expression<String>? category,
    Expression<bool>? isExample,
    Expression<String>? tagsJson,
    Expression<DateTime>? archivedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (name != null) 'name': name,
      if (description != null) 'description': description,
      if (iconMediaId != null) 'icon_media_id': iconMediaId,
      if (videoMediaId != null) 'video_media_id': videoMediaId,
      if (hasTimeMeasure != null) 'has_time_measure': hasTimeMeasure,
      if (hasRepsMeasure != null) 'has_reps_measure': hasRepsMeasure,
      if (hasScoreMeasure != null) 'has_score_measure': hasScoreMeasure,
      if (scoreInputMode != null) 'score_input_mode': scoreInputMode,
      if (scoreLabel != null) 'score_label': scoreLabel,
      if (scoreUnit != null) 'score_unit': scoreUnit,
      if (defaultTargetTimeSeconds != null)
        'default_target_time_seconds': defaultTargetTimeSeconds,
      if (defaultTargetReps != null) 'default_target_reps': defaultTargetReps,
      if (defaultTargetScore != null)
        'default_target_score': defaultTargetScore,
      if (defaultTargetScoreTimeMs != null)
        'default_target_score_time_ms': defaultTargetScoreTimeMs,
      if (autoStartNextTimedStep != null)
        'auto_start_next_timed_step': autoStartNextTimedStep,
      if (category != null) 'category': category,
      if (isExample != null) 'is_example': isExample,
      if (tagsJson != null) 'tags_json': tagsJson,
      if (archivedAt != null) 'archived_at': archivedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ExercisesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? name,
    Value<String?>? description,
    Value<String?>? iconMediaId,
    Value<String?>? videoMediaId,
    Value<bool>? hasTimeMeasure,
    Value<bool>? hasRepsMeasure,
    Value<bool>? hasScoreMeasure,
    Value<String>? scoreInputMode,
    Value<String?>? scoreLabel,
    Value<String?>? scoreUnit,
    Value<int?>? defaultTargetTimeSeconds,
    Value<int?>? defaultTargetReps,
    Value<double?>? defaultTargetScore,
    Value<int?>? defaultTargetScoreTimeMs,
    Value<bool>? autoStartNextTimedStep,
    Value<String>? category,
    Value<bool>? isExample,
    Value<String>? tagsJson,
    Value<DateTime?>? archivedAt,
    Value<int>? rowid,
  }) {
    return ExercisesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      name: name ?? this.name,
      description: description ?? this.description,
      iconMediaId: iconMediaId ?? this.iconMediaId,
      videoMediaId: videoMediaId ?? this.videoMediaId,
      hasTimeMeasure: hasTimeMeasure ?? this.hasTimeMeasure,
      hasRepsMeasure: hasRepsMeasure ?? this.hasRepsMeasure,
      hasScoreMeasure: hasScoreMeasure ?? this.hasScoreMeasure,
      scoreInputMode: scoreInputMode ?? this.scoreInputMode,
      scoreLabel: scoreLabel ?? this.scoreLabel,
      scoreUnit: scoreUnit ?? this.scoreUnit,
      defaultTargetTimeSeconds:
          defaultTargetTimeSeconds ?? this.defaultTargetTimeSeconds,
      defaultTargetReps: defaultTargetReps ?? this.defaultTargetReps,
      defaultTargetScore: defaultTargetScore ?? this.defaultTargetScore,
      defaultTargetScoreTimeMs:
          defaultTargetScoreTimeMs ?? this.defaultTargetScoreTimeMs,
      autoStartNextTimedStep:
          autoStartNextTimedStep ?? this.autoStartNextTimedStep,
      category: category ?? this.category,
      isExample: isExample ?? this.isExample,
      tagsJson: tagsJson ?? this.tagsJson,
      archivedAt: archivedAt ?? this.archivedAt,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (description.present) {
      map['description'] = Variable<String>(description.value);
    }
    if (iconMediaId.present) {
      map['icon_media_id'] = Variable<String>(iconMediaId.value);
    }
    if (videoMediaId.present) {
      map['video_media_id'] = Variable<String>(videoMediaId.value);
    }
    if (hasTimeMeasure.present) {
      map['has_time_measure'] = Variable<bool>(hasTimeMeasure.value);
    }
    if (hasRepsMeasure.present) {
      map['has_reps_measure'] = Variable<bool>(hasRepsMeasure.value);
    }
    if (hasScoreMeasure.present) {
      map['has_score_measure'] = Variable<bool>(hasScoreMeasure.value);
    }
    if (scoreInputMode.present) {
      map['score_input_mode'] = Variable<String>(scoreInputMode.value);
    }
    if (scoreLabel.present) {
      map['score_label'] = Variable<String>(scoreLabel.value);
    }
    if (scoreUnit.present) {
      map['score_unit'] = Variable<String>(scoreUnit.value);
    }
    if (defaultTargetTimeSeconds.present) {
      map['default_target_time_seconds'] = Variable<int>(
        defaultTargetTimeSeconds.value,
      );
    }
    if (defaultTargetReps.present) {
      map['default_target_reps'] = Variable<int>(defaultTargetReps.value);
    }
    if (defaultTargetScore.present) {
      map['default_target_score'] = Variable<double>(defaultTargetScore.value);
    }
    if (defaultTargetScoreTimeMs.present) {
      map['default_target_score_time_ms'] = Variable<int>(
        defaultTargetScoreTimeMs.value,
      );
    }
    if (autoStartNextTimedStep.present) {
      map['auto_start_next_timed_step'] = Variable<bool>(
        autoStartNextTimedStep.value,
      );
    }
    if (category.present) {
      map['category'] = Variable<String>(category.value);
    }
    if (isExample.present) {
      map['is_example'] = Variable<bool>(isExample.value);
    }
    if (tagsJson.present) {
      map['tags_json'] = Variable<String>(tagsJson.value);
    }
    if (archivedAt.present) {
      map['archived_at'] = Variable<DateTime>(archivedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ExercisesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('description: $description, ')
          ..write('iconMediaId: $iconMediaId, ')
          ..write('videoMediaId: $videoMediaId, ')
          ..write('hasTimeMeasure: $hasTimeMeasure, ')
          ..write('hasRepsMeasure: $hasRepsMeasure, ')
          ..write('hasScoreMeasure: $hasScoreMeasure, ')
          ..write('scoreInputMode: $scoreInputMode, ')
          ..write('scoreLabel: $scoreLabel, ')
          ..write('scoreUnit: $scoreUnit, ')
          ..write('defaultTargetTimeSeconds: $defaultTargetTimeSeconds, ')
          ..write('defaultTargetReps: $defaultTargetReps, ')
          ..write('defaultTargetScore: $defaultTargetScore, ')
          ..write('defaultTargetScoreTimeMs: $defaultTargetScoreTimeMs, ')
          ..write('autoStartNextTimedStep: $autoStartNextTimedStep, ')
          ..write('category: $category, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson, ')
          ..write('archivedAt: $archivedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ExerciseImagesTable extends ExerciseImages
    with TableInfo<$ExerciseImagesTable, ExerciseImage> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ExerciseImagesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _exerciseIdMeta = const VerificationMeta(
    'exerciseId',
  );
  @override
  late final GeneratedColumn<String> exerciseId = GeneratedColumn<String>(
    'exercise_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES exercises (id)',
    ),
  );
  static const VerificationMeta _mediaAssetIdMeta = const VerificationMeta(
    'mediaAssetId',
  );
  @override
  late final GeneratedColumn<String> mediaAssetId = GeneratedColumn<String>(
    'media_asset_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES media_assets (id)',
    ),
  );
  static const VerificationMeta _positionMeta = const VerificationMeta(
    'position',
  );
  @override
  late final GeneratedColumn<int> position = GeneratedColumn<int>(
    'position',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    exerciseId,
    mediaAssetId,
    position,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'exercise_images';
  @override
  VerificationContext validateIntegrity(
    Insertable<ExerciseImage> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('exercise_id')) {
      context.handle(
        _exerciseIdMeta,
        exerciseId.isAcceptableOrUnknown(data['exercise_id']!, _exerciseIdMeta),
      );
    } else if (isInserting) {
      context.missing(_exerciseIdMeta);
    }
    if (data.containsKey('media_asset_id')) {
      context.handle(
        _mediaAssetIdMeta,
        mediaAssetId.isAcceptableOrUnknown(
          data['media_asset_id']!,
          _mediaAssetIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_mediaAssetIdMeta);
    }
    if (data.containsKey('position')) {
      context.handle(
        _positionMeta,
        position.isAcceptableOrUnknown(data['position']!, _positionMeta),
      );
    } else if (isInserting) {
      context.missing(_positionMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ExerciseImage map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ExerciseImage(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      exerciseId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_id'],
      )!,
      mediaAssetId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}media_asset_id'],
      )!,
      position: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}position'],
      )!,
    );
  }

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

class ExerciseImage extends DataClass implements Insertable<ExerciseImage> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String exerciseId;
  final String mediaAssetId;
  final int position;
  const ExerciseImage({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.exerciseId,
    required this.mediaAssetId,
    required this.position,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['exercise_id'] = Variable<String>(exerciseId);
    map['media_asset_id'] = Variable<String>(mediaAssetId);
    map['position'] = Variable<int>(position);
    return map;
  }

  ExerciseImagesCompanion toCompanion(bool nullToAbsent) {
    return ExerciseImagesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      exerciseId: Value(exerciseId),
      mediaAssetId: Value(mediaAssetId),
      position: Value(position),
    );
  }

  factory ExerciseImage.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ExerciseImage(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      exerciseId: serializer.fromJson<String>(json['exerciseId']),
      mediaAssetId: serializer.fromJson<String>(json['mediaAssetId']),
      position: serializer.fromJson<int>(json['position']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'exerciseId': serializer.toJson<String>(exerciseId),
      'mediaAssetId': serializer.toJson<String>(mediaAssetId),
      'position': serializer.toJson<int>(position),
    };
  }

  ExerciseImage copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? exerciseId,
    String? mediaAssetId,
    int? position,
  }) => ExerciseImage(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    exerciseId: exerciseId ?? this.exerciseId,
    mediaAssetId: mediaAssetId ?? this.mediaAssetId,
    position: position ?? this.position,
  );
  ExerciseImage copyWithCompanion(ExerciseImagesCompanion data) {
    return ExerciseImage(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      exerciseId: data.exerciseId.present
          ? data.exerciseId.value
          : this.exerciseId,
      mediaAssetId: data.mediaAssetId.present
          ? data.mediaAssetId.value
          : this.mediaAssetId,
      position: data.position.present ? data.position.value : this.position,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ExerciseImage(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('exerciseId: $exerciseId, ')
          ..write('mediaAssetId: $mediaAssetId, ')
          ..write('position: $position')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    exerciseId,
    mediaAssetId,
    position,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ExerciseImage &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.exerciseId == this.exerciseId &&
          other.mediaAssetId == this.mediaAssetId &&
          other.position == this.position);
}

class ExerciseImagesCompanion extends UpdateCompanion<ExerciseImage> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> exerciseId;
  final Value<String> mediaAssetId;
  final Value<int> position;
  final Value<int> rowid;
  const ExerciseImagesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.exerciseId = const Value.absent(),
    this.mediaAssetId = const Value.absent(),
    this.position = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ExerciseImagesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String exerciseId,
    required String mediaAssetId,
    required int position,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       exerciseId = Value(exerciseId),
       mediaAssetId = Value(mediaAssetId),
       position = Value(position);
  static Insertable<ExerciseImage> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? exerciseId,
    Expression<String>? mediaAssetId,
    Expression<int>? position,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (exerciseId != null) 'exercise_id': exerciseId,
      if (mediaAssetId != null) 'media_asset_id': mediaAssetId,
      if (position != null) 'position': position,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ExerciseImagesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? exerciseId,
    Value<String>? mediaAssetId,
    Value<int>? position,
    Value<int>? rowid,
  }) {
    return ExerciseImagesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      exerciseId: exerciseId ?? this.exerciseId,
      mediaAssetId: mediaAssetId ?? this.mediaAssetId,
      position: position ?? this.position,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (exerciseId.present) {
      map['exercise_id'] = Variable<String>(exerciseId.value);
    }
    if (mediaAssetId.present) {
      map['media_asset_id'] = Variable<String>(mediaAssetId.value);
    }
    if (position.present) {
      map['position'] = Variable<int>(position.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ExerciseImagesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('exerciseId: $exerciseId, ')
          ..write('mediaAssetId: $mediaAssetId, ')
          ..write('position: $position, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ExerciseStepsTable extends ExerciseSteps
    with TableInfo<$ExerciseStepsTable, ExerciseStep> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ExerciseStepsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _exerciseIdMeta = const VerificationMeta(
    'exerciseId',
  );
  @override
  late final GeneratedColumn<String> exerciseId = GeneratedColumn<String>(
    'exercise_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES exercises (id)',
    ),
  );
  static const VerificationMeta _positionMeta = const VerificationMeta(
    'position',
  );
  @override
  late final GeneratedColumn<int> position = GeneratedColumn<int>(
    'position',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _typeMeta = const VerificationMeta('type');
  @override
  late final GeneratedColumn<String> type = GeneratedColumn<String>(
    'type',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _defaultTargetValueMeta =
      const VerificationMeta('defaultTargetValue');
  @override
  late final GeneratedColumn<int> defaultTargetValue = GeneratedColumn<int>(
    'default_target_value',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _hasScoreMeta = const VerificationMeta(
    'hasScore',
  );
  @override
  late final GeneratedColumn<bool> hasScore = GeneratedColumn<bool>(
    'has_score',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_score" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreInputModeMeta = const VerificationMeta(
    'scoreInputMode',
  );
  @override
  late final GeneratedColumn<String> scoreInputMode = GeneratedColumn<String>(
    'score_input_mode',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _scoreLabelMeta = const VerificationMeta(
    'scoreLabel',
  );
  @override
  late final GeneratedColumn<String> scoreLabel = GeneratedColumn<String>(
    'score_label',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _scoreUnitMeta = const VerificationMeta(
    'scoreUnit',
  );
  @override
  late final GeneratedColumn<String> scoreUnit = GeneratedColumn<String>(
    'score_unit',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _defaultTargetScoreMeta =
      const VerificationMeta('defaultTargetScore');
  @override
  late final GeneratedColumn<double> defaultTargetScore =
      GeneratedColumn<double>(
        'default_target_score',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _defaultTargetScoreTimeMsMeta =
      const VerificationMeta('defaultTargetScoreTimeMs');
  @override
  late final GeneratedColumn<int> defaultTargetScoreTimeMs =
      GeneratedColumn<int>(
        'default_target_score_time_ms',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    exerciseId,
    position,
    name,
    type,
    defaultTargetValue,
    hasScore,
    scoreInputMode,
    scoreLabel,
    scoreUnit,
    defaultTargetScore,
    defaultTargetScoreTimeMs,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'exercise_steps';
  @override
  VerificationContext validateIntegrity(
    Insertable<ExerciseStep> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('exercise_id')) {
      context.handle(
        _exerciseIdMeta,
        exerciseId.isAcceptableOrUnknown(data['exercise_id']!, _exerciseIdMeta),
      );
    } else if (isInserting) {
      context.missing(_exerciseIdMeta);
    }
    if (data.containsKey('position')) {
      context.handle(
        _positionMeta,
        position.isAcceptableOrUnknown(data['position']!, _positionMeta),
      );
    } else if (isInserting) {
      context.missing(_positionMeta);
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('type')) {
      context.handle(
        _typeMeta,
        type.isAcceptableOrUnknown(data['type']!, _typeMeta),
      );
    } else if (isInserting) {
      context.missing(_typeMeta);
    }
    if (data.containsKey('default_target_value')) {
      context.handle(
        _defaultTargetValueMeta,
        defaultTargetValue.isAcceptableOrUnknown(
          data['default_target_value']!,
          _defaultTargetValueMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_defaultTargetValueMeta);
    }
    if (data.containsKey('has_score')) {
      context.handle(
        _hasScoreMeta,
        hasScore.isAcceptableOrUnknown(data['has_score']!, _hasScoreMeta),
      );
    } else if (isInserting) {
      context.missing(_hasScoreMeta);
    }
    if (data.containsKey('score_input_mode')) {
      context.handle(
        _scoreInputModeMeta,
        scoreInputMode.isAcceptableOrUnknown(
          data['score_input_mode']!,
          _scoreInputModeMeta,
        ),
      );
    }
    if (data.containsKey('score_label')) {
      context.handle(
        _scoreLabelMeta,
        scoreLabel.isAcceptableOrUnknown(data['score_label']!, _scoreLabelMeta),
      );
    }
    if (data.containsKey('score_unit')) {
      context.handle(
        _scoreUnitMeta,
        scoreUnit.isAcceptableOrUnknown(data['score_unit']!, _scoreUnitMeta),
      );
    }
    if (data.containsKey('default_target_score')) {
      context.handle(
        _defaultTargetScoreMeta,
        defaultTargetScore.isAcceptableOrUnknown(
          data['default_target_score']!,
          _defaultTargetScoreMeta,
        ),
      );
    }
    if (data.containsKey('default_target_score_time_ms')) {
      context.handle(
        _defaultTargetScoreTimeMsMeta,
        defaultTargetScoreTimeMs.isAcceptableOrUnknown(
          data['default_target_score_time_ms']!,
          _defaultTargetScoreTimeMsMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ExerciseStep map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ExerciseStep(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      exerciseId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_id'],
      )!,
      position: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}position'],
      )!,
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      type: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}type'],
      )!,
      defaultTargetValue: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_target_value'],
      )!,
      hasScore: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_score'],
      )!,
      scoreInputMode: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode'],
      ),
      scoreLabel: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label'],
      ),
      scoreUnit: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit'],
      ),
      defaultTargetScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}default_target_score'],
      ),
      defaultTargetScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_target_score_time_ms'],
      ),
    );
  }

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

class ExerciseStep extends DataClass implements Insertable<ExerciseStep> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String exerciseId;
  final int position;
  final String name;
  final String type;
  final int defaultTargetValue;
  final bool hasScore;
  final String? scoreInputMode;
  final String? scoreLabel;
  final String? scoreUnit;
  final double? defaultTargetScore;
  final int? defaultTargetScoreTimeMs;
  const ExerciseStep({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.exerciseId,
    required this.position,
    required this.name,
    required this.type,
    required this.defaultTargetValue,
    required this.hasScore,
    this.scoreInputMode,
    this.scoreLabel,
    this.scoreUnit,
    this.defaultTargetScore,
    this.defaultTargetScoreTimeMs,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['exercise_id'] = Variable<String>(exerciseId);
    map['position'] = Variable<int>(position);
    map['name'] = Variable<String>(name);
    map['type'] = Variable<String>(type);
    map['default_target_value'] = Variable<int>(defaultTargetValue);
    map['has_score'] = Variable<bool>(hasScore);
    if (!nullToAbsent || scoreInputMode != null) {
      map['score_input_mode'] = Variable<String>(scoreInputMode);
    }
    if (!nullToAbsent || scoreLabel != null) {
      map['score_label'] = Variable<String>(scoreLabel);
    }
    if (!nullToAbsent || scoreUnit != null) {
      map['score_unit'] = Variable<String>(scoreUnit);
    }
    if (!nullToAbsent || defaultTargetScore != null) {
      map['default_target_score'] = Variable<double>(defaultTargetScore);
    }
    if (!nullToAbsent || defaultTargetScoreTimeMs != null) {
      map['default_target_score_time_ms'] = Variable<int>(
        defaultTargetScoreTimeMs,
      );
    }
    return map;
  }

  ExerciseStepsCompanion toCompanion(bool nullToAbsent) {
    return ExerciseStepsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      exerciseId: Value(exerciseId),
      position: Value(position),
      name: Value(name),
      type: Value(type),
      defaultTargetValue: Value(defaultTargetValue),
      hasScore: Value(hasScore),
      scoreInputMode: scoreInputMode == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreInputMode),
      scoreLabel: scoreLabel == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabel),
      scoreUnit: scoreUnit == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnit),
      defaultTargetScore: defaultTargetScore == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetScore),
      defaultTargetScoreTimeMs: defaultTargetScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(defaultTargetScoreTimeMs),
    );
  }

  factory ExerciseStep.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ExerciseStep(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      exerciseId: serializer.fromJson<String>(json['exerciseId']),
      position: serializer.fromJson<int>(json['position']),
      name: serializer.fromJson<String>(json['name']),
      type: serializer.fromJson<String>(json['type']),
      defaultTargetValue: serializer.fromJson<int>(json['defaultTargetValue']),
      hasScore: serializer.fromJson<bool>(json['hasScore']),
      scoreInputMode: serializer.fromJson<String?>(json['scoreInputMode']),
      scoreLabel: serializer.fromJson<String?>(json['scoreLabel']),
      scoreUnit: serializer.fromJson<String?>(json['scoreUnit']),
      defaultTargetScore: serializer.fromJson<double?>(
        json['defaultTargetScore'],
      ),
      defaultTargetScoreTimeMs: serializer.fromJson<int?>(
        json['defaultTargetScoreTimeMs'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'exerciseId': serializer.toJson<String>(exerciseId),
      'position': serializer.toJson<int>(position),
      'name': serializer.toJson<String>(name),
      'type': serializer.toJson<String>(type),
      'defaultTargetValue': serializer.toJson<int>(defaultTargetValue),
      'hasScore': serializer.toJson<bool>(hasScore),
      'scoreInputMode': serializer.toJson<String?>(scoreInputMode),
      'scoreLabel': serializer.toJson<String?>(scoreLabel),
      'scoreUnit': serializer.toJson<String?>(scoreUnit),
      'defaultTargetScore': serializer.toJson<double?>(defaultTargetScore),
      'defaultTargetScoreTimeMs': serializer.toJson<int?>(
        defaultTargetScoreTimeMs,
      ),
    };
  }

  ExerciseStep copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? exerciseId,
    int? position,
    String? name,
    String? type,
    int? defaultTargetValue,
    bool? hasScore,
    Value<String?> scoreInputMode = const Value.absent(),
    Value<String?> scoreLabel = const Value.absent(),
    Value<String?> scoreUnit = const Value.absent(),
    Value<double?> defaultTargetScore = const Value.absent(),
    Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
  }) => ExerciseStep(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    exerciseId: exerciseId ?? this.exerciseId,
    position: position ?? this.position,
    name: name ?? this.name,
    type: type ?? this.type,
    defaultTargetValue: defaultTargetValue ?? this.defaultTargetValue,
    hasScore: hasScore ?? this.hasScore,
    scoreInputMode: scoreInputMode.present
        ? scoreInputMode.value
        : this.scoreInputMode,
    scoreLabel: scoreLabel.present ? scoreLabel.value : this.scoreLabel,
    scoreUnit: scoreUnit.present ? scoreUnit.value : this.scoreUnit,
    defaultTargetScore: defaultTargetScore.present
        ? defaultTargetScore.value
        : this.defaultTargetScore,
    defaultTargetScoreTimeMs: defaultTargetScoreTimeMs.present
        ? defaultTargetScoreTimeMs.value
        : this.defaultTargetScoreTimeMs,
  );
  ExerciseStep copyWithCompanion(ExerciseStepsCompanion data) {
    return ExerciseStep(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      exerciseId: data.exerciseId.present
          ? data.exerciseId.value
          : this.exerciseId,
      position: data.position.present ? data.position.value : this.position,
      name: data.name.present ? data.name.value : this.name,
      type: data.type.present ? data.type.value : this.type,
      defaultTargetValue: data.defaultTargetValue.present
          ? data.defaultTargetValue.value
          : this.defaultTargetValue,
      hasScore: data.hasScore.present ? data.hasScore.value : this.hasScore,
      scoreInputMode: data.scoreInputMode.present
          ? data.scoreInputMode.value
          : this.scoreInputMode,
      scoreLabel: data.scoreLabel.present
          ? data.scoreLabel.value
          : this.scoreLabel,
      scoreUnit: data.scoreUnit.present ? data.scoreUnit.value : this.scoreUnit,
      defaultTargetScore: data.defaultTargetScore.present
          ? data.defaultTargetScore.value
          : this.defaultTargetScore,
      defaultTargetScoreTimeMs: data.defaultTargetScoreTimeMs.present
          ? data.defaultTargetScoreTimeMs.value
          : this.defaultTargetScoreTimeMs,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ExerciseStep(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('exerciseId: $exerciseId, ')
          ..write('position: $position, ')
          ..write('name: $name, ')
          ..write('type: $type, ')
          ..write('defaultTargetValue: $defaultTargetValue, ')
          ..write('hasScore: $hasScore, ')
          ..write('scoreInputMode: $scoreInputMode, ')
          ..write('scoreLabel: $scoreLabel, ')
          ..write('scoreUnit: $scoreUnit, ')
          ..write('defaultTargetScore: $defaultTargetScore, ')
          ..write('defaultTargetScoreTimeMs: $defaultTargetScoreTimeMs')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    exerciseId,
    position,
    name,
    type,
    defaultTargetValue,
    hasScore,
    scoreInputMode,
    scoreLabel,
    scoreUnit,
    defaultTargetScore,
    defaultTargetScoreTimeMs,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ExerciseStep &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.exerciseId == this.exerciseId &&
          other.position == this.position &&
          other.name == this.name &&
          other.type == this.type &&
          other.defaultTargetValue == this.defaultTargetValue &&
          other.hasScore == this.hasScore &&
          other.scoreInputMode == this.scoreInputMode &&
          other.scoreLabel == this.scoreLabel &&
          other.scoreUnit == this.scoreUnit &&
          other.defaultTargetScore == this.defaultTargetScore &&
          other.defaultTargetScoreTimeMs == this.defaultTargetScoreTimeMs);
}

class ExerciseStepsCompanion extends UpdateCompanion<ExerciseStep> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> exerciseId;
  final Value<int> position;
  final Value<String> name;
  final Value<String> type;
  final Value<int> defaultTargetValue;
  final Value<bool> hasScore;
  final Value<String?> scoreInputMode;
  final Value<String?> scoreLabel;
  final Value<String?> scoreUnit;
  final Value<double?> defaultTargetScore;
  final Value<int?> defaultTargetScoreTimeMs;
  final Value<int> rowid;
  const ExerciseStepsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.exerciseId = const Value.absent(),
    this.position = const Value.absent(),
    this.name = const Value.absent(),
    this.type = const Value.absent(),
    this.defaultTargetValue = const Value.absent(),
    this.hasScore = const Value.absent(),
    this.scoreInputMode = const Value.absent(),
    this.scoreLabel = const Value.absent(),
    this.scoreUnit = const Value.absent(),
    this.defaultTargetScore = const Value.absent(),
    this.defaultTargetScoreTimeMs = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ExerciseStepsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String exerciseId,
    required int position,
    required String name,
    required String type,
    required int defaultTargetValue,
    required bool hasScore,
    this.scoreInputMode = const Value.absent(),
    this.scoreLabel = const Value.absent(),
    this.scoreUnit = const Value.absent(),
    this.defaultTargetScore = const Value.absent(),
    this.defaultTargetScoreTimeMs = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       exerciseId = Value(exerciseId),
       position = Value(position),
       name = Value(name),
       type = Value(type),
       defaultTargetValue = Value(defaultTargetValue),
       hasScore = Value(hasScore);
  static Insertable<ExerciseStep> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? exerciseId,
    Expression<int>? position,
    Expression<String>? name,
    Expression<String>? type,
    Expression<int>? defaultTargetValue,
    Expression<bool>? hasScore,
    Expression<String>? scoreInputMode,
    Expression<String>? scoreLabel,
    Expression<String>? scoreUnit,
    Expression<double>? defaultTargetScore,
    Expression<int>? defaultTargetScoreTimeMs,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (exerciseId != null) 'exercise_id': exerciseId,
      if (position != null) 'position': position,
      if (name != null) 'name': name,
      if (type != null) 'type': type,
      if (defaultTargetValue != null)
        'default_target_value': defaultTargetValue,
      if (hasScore != null) 'has_score': hasScore,
      if (scoreInputMode != null) 'score_input_mode': scoreInputMode,
      if (scoreLabel != null) 'score_label': scoreLabel,
      if (scoreUnit != null) 'score_unit': scoreUnit,
      if (defaultTargetScore != null)
        'default_target_score': defaultTargetScore,
      if (defaultTargetScoreTimeMs != null)
        'default_target_score_time_ms': defaultTargetScoreTimeMs,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ExerciseStepsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? exerciseId,
    Value<int>? position,
    Value<String>? name,
    Value<String>? type,
    Value<int>? defaultTargetValue,
    Value<bool>? hasScore,
    Value<String?>? scoreInputMode,
    Value<String?>? scoreLabel,
    Value<String?>? scoreUnit,
    Value<double?>? defaultTargetScore,
    Value<int?>? defaultTargetScoreTimeMs,
    Value<int>? rowid,
  }) {
    return ExerciseStepsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      exerciseId: exerciseId ?? this.exerciseId,
      position: position ?? this.position,
      name: name ?? this.name,
      type: type ?? this.type,
      defaultTargetValue: defaultTargetValue ?? this.defaultTargetValue,
      hasScore: hasScore ?? this.hasScore,
      scoreInputMode: scoreInputMode ?? this.scoreInputMode,
      scoreLabel: scoreLabel ?? this.scoreLabel,
      scoreUnit: scoreUnit ?? this.scoreUnit,
      defaultTargetScore: defaultTargetScore ?? this.defaultTargetScore,
      defaultTargetScoreTimeMs:
          defaultTargetScoreTimeMs ?? this.defaultTargetScoreTimeMs,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (exerciseId.present) {
      map['exercise_id'] = Variable<String>(exerciseId.value);
    }
    if (position.present) {
      map['position'] = Variable<int>(position.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (type.present) {
      map['type'] = Variable<String>(type.value);
    }
    if (defaultTargetValue.present) {
      map['default_target_value'] = Variable<int>(defaultTargetValue.value);
    }
    if (hasScore.present) {
      map['has_score'] = Variable<bool>(hasScore.value);
    }
    if (scoreInputMode.present) {
      map['score_input_mode'] = Variable<String>(scoreInputMode.value);
    }
    if (scoreLabel.present) {
      map['score_label'] = Variable<String>(scoreLabel.value);
    }
    if (scoreUnit.present) {
      map['score_unit'] = Variable<String>(scoreUnit.value);
    }
    if (defaultTargetScore.present) {
      map['default_target_score'] = Variable<double>(defaultTargetScore.value);
    }
    if (defaultTargetScoreTimeMs.present) {
      map['default_target_score_time_ms'] = Variable<int>(
        defaultTargetScoreTimeMs.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ExerciseStepsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('exerciseId: $exerciseId, ')
          ..write('position: $position, ')
          ..write('name: $name, ')
          ..write('type: $type, ')
          ..write('defaultTargetValue: $defaultTargetValue, ')
          ..write('hasScore: $hasScore, ')
          ..write('scoreInputMode: $scoreInputMode, ')
          ..write('scoreLabel: $scoreLabel, ')
          ..write('scoreUnit: $scoreUnit, ')
          ..write('defaultTargetScore: $defaultTargetScore, ')
          ..write('defaultTargetScoreTimeMs: $defaultTargetScoreTimeMs, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $LocalSeedMetadataTable extends LocalSeedMetadata
    with TableInfo<$LocalSeedMetadataTable, LocalSeedMetadataData> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $LocalSeedMetadataTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _keyMeta = const VerificationMeta('key');
  @override
  late final GeneratedColumn<String> key = GeneratedColumn<String>(
    'key',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _versionMeta = const VerificationMeta(
    'version',
  );
  @override
  late final GeneratedColumn<int> version = GeneratedColumn<int>(
    'version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (version >= 0)',
  );
  static const VerificationMeta _appliedAtMeta = const VerificationMeta(
    'appliedAt',
  );
  @override
  late final GeneratedColumn<DateTime> appliedAt = GeneratedColumn<DateTime>(
    'applied_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  @override
  List<GeneratedColumn> get $columns => [key, version, appliedAt];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'local_seed_metadata';
  @override
  VerificationContext validateIntegrity(
    Insertable<LocalSeedMetadataData> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('key')) {
      context.handle(
        _keyMeta,
        key.isAcceptableOrUnknown(data['key']!, _keyMeta),
      );
    } else if (isInserting) {
      context.missing(_keyMeta);
    }
    if (data.containsKey('version')) {
      context.handle(
        _versionMeta,
        version.isAcceptableOrUnknown(data['version']!, _versionMeta),
      );
    } else if (isInserting) {
      context.missing(_versionMeta);
    }
    if (data.containsKey('applied_at')) {
      context.handle(
        _appliedAtMeta,
        appliedAt.isAcceptableOrUnknown(data['applied_at']!, _appliedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_appliedAtMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {key};
  @override
  LocalSeedMetadataData map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return LocalSeedMetadataData(
      key: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}key'],
      )!,
      version: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}version'],
      )!,
      appliedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}applied_at'],
      )!,
    );
  }

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

class LocalSeedMetadataData extends DataClass
    implements Insertable<LocalSeedMetadataData> {
  final String key;
  final int version;
  final DateTime appliedAt;
  const LocalSeedMetadataData({
    required this.key,
    required this.version,
    required this.appliedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['key'] = Variable<String>(key);
    map['version'] = Variable<int>(version);
    map['applied_at'] = Variable<DateTime>(appliedAt);
    return map;
  }

  LocalSeedMetadataCompanion toCompanion(bool nullToAbsent) {
    return LocalSeedMetadataCompanion(
      key: Value(key),
      version: Value(version),
      appliedAt: Value(appliedAt),
    );
  }

  factory LocalSeedMetadataData.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return LocalSeedMetadataData(
      key: serializer.fromJson<String>(json['key']),
      version: serializer.fromJson<int>(json['version']),
      appliedAt: serializer.fromJson<DateTime>(json['appliedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'key': serializer.toJson<String>(key),
      'version': serializer.toJson<int>(version),
      'appliedAt': serializer.toJson<DateTime>(appliedAt),
    };
  }

  LocalSeedMetadataData copyWith({
    String? key,
    int? version,
    DateTime? appliedAt,
  }) => LocalSeedMetadataData(
    key: key ?? this.key,
    version: version ?? this.version,
    appliedAt: appliedAt ?? this.appliedAt,
  );
  LocalSeedMetadataData copyWithCompanion(LocalSeedMetadataCompanion data) {
    return LocalSeedMetadataData(
      key: data.key.present ? data.key.value : this.key,
      version: data.version.present ? data.version.value : this.version,
      appliedAt: data.appliedAt.present ? data.appliedAt.value : this.appliedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('LocalSeedMetadataData(')
          ..write('key: $key, ')
          ..write('version: $version, ')
          ..write('appliedAt: $appliedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(key, version, appliedAt);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is LocalSeedMetadataData &&
          other.key == this.key &&
          other.version == this.version &&
          other.appliedAt == this.appliedAt);
}

class LocalSeedMetadataCompanion
    extends UpdateCompanion<LocalSeedMetadataData> {
  final Value<String> key;
  final Value<int> version;
  final Value<DateTime> appliedAt;
  final Value<int> rowid;
  const LocalSeedMetadataCompanion({
    this.key = const Value.absent(),
    this.version = const Value.absent(),
    this.appliedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  LocalSeedMetadataCompanion.insert({
    required String key,
    required int version,
    required DateTime appliedAt,
    this.rowid = const Value.absent(),
  }) : key = Value(key),
       version = Value(version),
       appliedAt = Value(appliedAt);
  static Insertable<LocalSeedMetadataData> custom({
    Expression<String>? key,
    Expression<int>? version,
    Expression<DateTime>? appliedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (key != null) 'key': key,
      if (version != null) 'version': version,
      if (appliedAt != null) 'applied_at': appliedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  LocalSeedMetadataCompanion copyWith({
    Value<String>? key,
    Value<int>? version,
    Value<DateTime>? appliedAt,
    Value<int>? rowid,
  }) {
    return LocalSeedMetadataCompanion(
      key: key ?? this.key,
      version: version ?? this.version,
      appliedAt: appliedAt ?? this.appliedAt,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (key.present) {
      map['key'] = Variable<String>(key.value);
    }
    if (version.present) {
      map['version'] = Variable<int>(version.value);
    }
    if (appliedAt.present) {
      map['applied_at'] = Variable<DateTime>(appliedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('LocalSeedMetadataCompanion(')
          ..write('key: $key, ')
          ..write('version: $version, ')
          ..write('appliedAt: $appliedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $OnlineAccountSessionsTable extends OnlineAccountSessions
    with TableInfo<$OnlineAccountSessionsTable, OnlineAccountSession> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $OnlineAccountSessionsTable(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 _serverUserIdMeta = const VerificationMeta(
    'serverUserId',
  );
  @override
  late final GeneratedColumn<String> serverUserId = GeneratedColumn<String>(
    'server_user_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _emailMeta = const VerificationMeta('email');
  @override
  late final GeneratedColumn<String> email = GeneratedColumn<String>(
    'email',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _displayNameMeta = const VerificationMeta(
    'displayName',
  );
  @override
  late final GeneratedColumn<String> displayName = GeneratedColumn<String>(
    'display_name',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _isLoggedInMeta = const VerificationMeta(
    'isLoggedIn',
  );
  @override
  late final GeneratedColumn<bool> isLoggedIn = GeneratedColumn<bool>(
    'is_logged_in',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_logged_in" IN (0, 1))',
    ),
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAuthenticatedAtMeta =
      const VerificationMeta('lastAuthenticatedAt');
  @override
  late final GeneratedColumn<DateTime> lastAuthenticatedAt =
      GeneratedColumn<DateTime>(
        'last_authenticated_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    serverUserId,
    email,
    displayName,
    isLoggedIn,
    createdAt,
    updatedAt,
    lastAuthenticatedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'online_account_sessions';
  @override
  VerificationContext validateIntegrity(
    Insertable<OnlineAccountSession> 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('server_user_id')) {
      context.handle(
        _serverUserIdMeta,
        serverUserId.isAcceptableOrUnknown(
          data['server_user_id']!,
          _serverUserIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_serverUserIdMeta);
    }
    if (data.containsKey('email')) {
      context.handle(
        _emailMeta,
        email.isAcceptableOrUnknown(data['email']!, _emailMeta),
      );
    } else if (isInserting) {
      context.missing(_emailMeta);
    }
    if (data.containsKey('display_name')) {
      context.handle(
        _displayNameMeta,
        displayName.isAcceptableOrUnknown(
          data['display_name']!,
          _displayNameMeta,
        ),
      );
    }
    if (data.containsKey('is_logged_in')) {
      context.handle(
        _isLoggedInMeta,
        isLoggedIn.isAcceptableOrUnknown(
          data['is_logged_in']!,
          _isLoggedInMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_isLoggedInMeta);
    }
    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_authenticated_at')) {
      context.handle(
        _lastAuthenticatedAtMeta,
        lastAuthenticatedAt.isAcceptableOrUnknown(
          data['last_authenticated_at']!,
          _lastAuthenticatedAtMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  OnlineAccountSession map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return OnlineAccountSession(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      serverUserId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}server_user_id'],
      )!,
      email: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}email'],
      )!,
      displayName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}display_name'],
      ),
      isLoggedIn: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_logged_in'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      lastAuthenticatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_authenticated_at'],
      ),
    );
  }

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

class OnlineAccountSession extends DataClass
    implements Insertable<OnlineAccountSession> {
  final String id;
  final String serverUserId;
  final String email;
  final String? displayName;
  final bool isLoggedIn;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? lastAuthenticatedAt;
  const OnlineAccountSession({
    required this.id,
    required this.serverUserId,
    required this.email,
    this.displayName,
    required this.isLoggedIn,
    required this.createdAt,
    required this.updatedAt,
    this.lastAuthenticatedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['server_user_id'] = Variable<String>(serverUserId);
    map['email'] = Variable<String>(email);
    if (!nullToAbsent || displayName != null) {
      map['display_name'] = Variable<String>(displayName);
    }
    map['is_logged_in'] = Variable<bool>(isLoggedIn);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || lastAuthenticatedAt != null) {
      map['last_authenticated_at'] = Variable<DateTime>(lastAuthenticatedAt);
    }
    return map;
  }

  OnlineAccountSessionsCompanion toCompanion(bool nullToAbsent) {
    return OnlineAccountSessionsCompanion(
      id: Value(id),
      serverUserId: Value(serverUserId),
      email: Value(email),
      displayName: displayName == null && nullToAbsent
          ? const Value.absent()
          : Value(displayName),
      isLoggedIn: Value(isLoggedIn),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      lastAuthenticatedAt: lastAuthenticatedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastAuthenticatedAt),
    );
  }

  factory OnlineAccountSession.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return OnlineAccountSession(
      id: serializer.fromJson<String>(json['id']),
      serverUserId: serializer.fromJson<String>(json['serverUserId']),
      email: serializer.fromJson<String>(json['email']),
      displayName: serializer.fromJson<String?>(json['displayName']),
      isLoggedIn: serializer.fromJson<bool>(json['isLoggedIn']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      lastAuthenticatedAt: serializer.fromJson<DateTime?>(
        json['lastAuthenticatedAt'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'serverUserId': serializer.toJson<String>(serverUserId),
      'email': serializer.toJson<String>(email),
      'displayName': serializer.toJson<String?>(displayName),
      'isLoggedIn': serializer.toJson<bool>(isLoggedIn),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'lastAuthenticatedAt': serializer.toJson<DateTime?>(lastAuthenticatedAt),
    };
  }

  OnlineAccountSession copyWith({
    String? id,
    String? serverUserId,
    String? email,
    Value<String?> displayName = const Value.absent(),
    bool? isLoggedIn,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> lastAuthenticatedAt = const Value.absent(),
  }) => OnlineAccountSession(
    id: id ?? this.id,
    serverUserId: serverUserId ?? this.serverUserId,
    email: email ?? this.email,
    displayName: displayName.present ? displayName.value : this.displayName,
    isLoggedIn: isLoggedIn ?? this.isLoggedIn,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    lastAuthenticatedAt: lastAuthenticatedAt.present
        ? lastAuthenticatedAt.value
        : this.lastAuthenticatedAt,
  );
  OnlineAccountSession copyWithCompanion(OnlineAccountSessionsCompanion data) {
    return OnlineAccountSession(
      id: data.id.present ? data.id.value : this.id,
      serverUserId: data.serverUserId.present
          ? data.serverUserId.value
          : this.serverUserId,
      email: data.email.present ? data.email.value : this.email,
      displayName: data.displayName.present
          ? data.displayName.value
          : this.displayName,
      isLoggedIn: data.isLoggedIn.present
          ? data.isLoggedIn.value
          : this.isLoggedIn,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      lastAuthenticatedAt: data.lastAuthenticatedAt.present
          ? data.lastAuthenticatedAt.value
          : this.lastAuthenticatedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('OnlineAccountSession(')
          ..write('id: $id, ')
          ..write('serverUserId: $serverUserId, ')
          ..write('email: $email, ')
          ..write('displayName: $displayName, ')
          ..write('isLoggedIn: $isLoggedIn, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthenticatedAt: $lastAuthenticatedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    serverUserId,
    email,
    displayName,
    isLoggedIn,
    createdAt,
    updatedAt,
    lastAuthenticatedAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is OnlineAccountSession &&
          other.id == this.id &&
          other.serverUserId == this.serverUserId &&
          other.email == this.email &&
          other.displayName == this.displayName &&
          other.isLoggedIn == this.isLoggedIn &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.lastAuthenticatedAt == this.lastAuthenticatedAt);
}

class OnlineAccountSessionsCompanion
    extends UpdateCompanion<OnlineAccountSession> {
  final Value<String> id;
  final Value<String> serverUserId;
  final Value<String> email;
  final Value<String?> displayName;
  final Value<bool> isLoggedIn;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> lastAuthenticatedAt;
  final Value<int> rowid;
  const OnlineAccountSessionsCompanion({
    this.id = const Value.absent(),
    this.serverUserId = const Value.absent(),
    this.email = const Value.absent(),
    this.displayName = const Value.absent(),
    this.isLoggedIn = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.lastAuthenticatedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  OnlineAccountSessionsCompanion.insert({
    required String id,
    required String serverUserId,
    required String email,
    this.displayName = const Value.absent(),
    required bool isLoggedIn,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.lastAuthenticatedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       serverUserId = Value(serverUserId),
       email = Value(email),
       isLoggedIn = Value(isLoggedIn),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt);
  static Insertable<OnlineAccountSession> custom({
    Expression<String>? id,
    Expression<String>? serverUserId,
    Expression<String>? email,
    Expression<String>? displayName,
    Expression<bool>? isLoggedIn,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? lastAuthenticatedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (serverUserId != null) 'server_user_id': serverUserId,
      if (email != null) 'email': email,
      if (displayName != null) 'display_name': displayName,
      if (isLoggedIn != null) 'is_logged_in': isLoggedIn,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (lastAuthenticatedAt != null)
        'last_authenticated_at': lastAuthenticatedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  OnlineAccountSessionsCompanion copyWith({
    Value<String>? id,
    Value<String>? serverUserId,
    Value<String>? email,
    Value<String?>? displayName,
    Value<bool>? isLoggedIn,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? lastAuthenticatedAt,
    Value<int>? rowid,
  }) {
    return OnlineAccountSessionsCompanion(
      id: id ?? this.id,
      serverUserId: serverUserId ?? this.serverUserId,
      email: email ?? this.email,
      displayName: displayName ?? this.displayName,
      isLoggedIn: isLoggedIn ?? this.isLoggedIn,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      lastAuthenticatedAt: lastAuthenticatedAt ?? this.lastAuthenticatedAt,
      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 (serverUserId.present) {
      map['server_user_id'] = Variable<String>(serverUserId.value);
    }
    if (email.present) {
      map['email'] = Variable<String>(email.value);
    }
    if (displayName.present) {
      map['display_name'] = Variable<String>(displayName.value);
    }
    if (isLoggedIn.present) {
      map['is_logged_in'] = Variable<bool>(isLoggedIn.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (lastAuthenticatedAt.present) {
      map['last_authenticated_at'] = Variable<DateTime>(
        lastAuthenticatedAt.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('OnlineAccountSessionsCompanion(')
          ..write('id: $id, ')
          ..write('serverUserId: $serverUserId, ')
          ..write('email: $email, ')
          ..write('displayName: $displayName, ')
          ..write('isLoggedIn: $isLoggedIn, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('lastAuthenticatedAt: $lastAuthenticatedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $PendingShareActionsTable extends PendingShareActions
    with TableInfo<$PendingShareActionsTable, PendingShareAction> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $PendingShareActionsTable(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 _actionTypeMeta = const VerificationMeta(
    'actionType',
  );
  @override
  late final GeneratedColumn<String> actionType = GeneratedColumn<String>(
    'action_type',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _shareIdMeta = const VerificationMeta(
    'shareId',
  );
  @override
  late final GeneratedColumn<String> shareId = GeneratedColumn<String>(
    'share_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _resourceTypeMeta = const VerificationMeta(
    'resourceType',
  );
  @override
  late final GeneratedColumn<String> resourceType = GeneratedColumn<String>(
    'resource_type',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _payloadJsonMeta = const VerificationMeta(
    'payloadJson',
  );
  @override
  late final GeneratedColumn<String> payloadJson = GeneratedColumn<String>(
    'payload_json',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _recipientEmailsJsonMeta =
      const VerificationMeta('recipientEmailsJson');
  @override
  late final GeneratedColumn<String> recipientEmailsJson =
      GeneratedColumn<String>(
        'recipient_emails_json',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _lastAttemptAtMeta = const VerificationMeta(
    'lastAttemptAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastAttemptAt =
      GeneratedColumn<DateTime>(
        'last_attempt_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _attemptCountMeta = const VerificationMeta(
    'attemptCount',
  );
  @override
  late final GeneratedColumn<int> attemptCount = GeneratedColumn<int>(
    'attempt_count',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (attempt_count >= 0)',
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    actionType,
    shareId,
    resourceType,
    payloadJson,
    recipientEmailsJson,
    createdAt,
    lastAttemptAt,
    attemptCount,
    status,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'pending_share_actions';
  @override
  VerificationContext validateIntegrity(
    Insertable<PendingShareAction> 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('action_type')) {
      context.handle(
        _actionTypeMeta,
        actionType.isAcceptableOrUnknown(data['action_type']!, _actionTypeMeta),
      );
    } else if (isInserting) {
      context.missing(_actionTypeMeta);
    }
    if (data.containsKey('share_id')) {
      context.handle(
        _shareIdMeta,
        shareId.isAcceptableOrUnknown(data['share_id']!, _shareIdMeta),
      );
    }
    if (data.containsKey('resource_type')) {
      context.handle(
        _resourceTypeMeta,
        resourceType.isAcceptableOrUnknown(
          data['resource_type']!,
          _resourceTypeMeta,
        ),
      );
    }
    if (data.containsKey('payload_json')) {
      context.handle(
        _payloadJsonMeta,
        payloadJson.isAcceptableOrUnknown(
          data['payload_json']!,
          _payloadJsonMeta,
        ),
      );
    }
    if (data.containsKey('recipient_emails_json')) {
      context.handle(
        _recipientEmailsJsonMeta,
        recipientEmailsJson.isAcceptableOrUnknown(
          data['recipient_emails_json']!,
          _recipientEmailsJsonMeta,
        ),
      );
    }
    if (data.containsKey('created_at')) {
      context.handle(
        _createdAtMeta,
        createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
      );
    } else if (isInserting) {
      context.missing(_createdAtMeta);
    }
    if (data.containsKey('last_attempt_at')) {
      context.handle(
        _lastAttemptAtMeta,
        lastAttemptAt.isAcceptableOrUnknown(
          data['last_attempt_at']!,
          _lastAttemptAtMeta,
        ),
      );
    }
    if (data.containsKey('attempt_count')) {
      context.handle(
        _attemptCountMeta,
        attemptCount.isAcceptableOrUnknown(
          data['attempt_count']!,
          _attemptCountMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_attemptCountMeta);
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  PendingShareAction map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return PendingShareAction(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      actionType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}action_type'],
      )!,
      shareId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}share_id'],
      ),
      resourceType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}resource_type'],
      ),
      payloadJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}payload_json'],
      ),
      recipientEmailsJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}recipient_emails_json'],
      ),
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      lastAttemptAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_attempt_at'],
      ),
      attemptCount: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}attempt_count'],
      )!,
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
    );
  }

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

class PendingShareAction extends DataClass
    implements Insertable<PendingShareAction> {
  final String id;
  final String actionType;
  final String? shareId;
  final String? resourceType;
  final String? payloadJson;
  final String? recipientEmailsJson;
  final DateTime createdAt;
  final DateTime? lastAttemptAt;
  final int attemptCount;
  final String status;
  const PendingShareAction({
    required this.id,
    required this.actionType,
    this.shareId,
    this.resourceType,
    this.payloadJson,
    this.recipientEmailsJson,
    required this.createdAt,
    this.lastAttemptAt,
    required this.attemptCount,
    required this.status,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['action_type'] = Variable<String>(actionType);
    if (!nullToAbsent || shareId != null) {
      map['share_id'] = Variable<String>(shareId);
    }
    if (!nullToAbsent || resourceType != null) {
      map['resource_type'] = Variable<String>(resourceType);
    }
    if (!nullToAbsent || payloadJson != null) {
      map['payload_json'] = Variable<String>(payloadJson);
    }
    if (!nullToAbsent || recipientEmailsJson != null) {
      map['recipient_emails_json'] = Variable<String>(recipientEmailsJson);
    }
    map['created_at'] = Variable<DateTime>(createdAt);
    if (!nullToAbsent || lastAttemptAt != null) {
      map['last_attempt_at'] = Variable<DateTime>(lastAttemptAt);
    }
    map['attempt_count'] = Variable<int>(attemptCount);
    map['status'] = Variable<String>(status);
    return map;
  }

  PendingShareActionsCompanion toCompanion(bool nullToAbsent) {
    return PendingShareActionsCompanion(
      id: Value(id),
      actionType: Value(actionType),
      shareId: shareId == null && nullToAbsent
          ? const Value.absent()
          : Value(shareId),
      resourceType: resourceType == null && nullToAbsent
          ? const Value.absent()
          : Value(resourceType),
      payloadJson: payloadJson == null && nullToAbsent
          ? const Value.absent()
          : Value(payloadJson),
      recipientEmailsJson: recipientEmailsJson == null && nullToAbsent
          ? const Value.absent()
          : Value(recipientEmailsJson),
      createdAt: Value(createdAt),
      lastAttemptAt: lastAttemptAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastAttemptAt),
      attemptCount: Value(attemptCount),
      status: Value(status),
    );
  }

  factory PendingShareAction.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return PendingShareAction(
      id: serializer.fromJson<String>(json['id']),
      actionType: serializer.fromJson<String>(json['actionType']),
      shareId: serializer.fromJson<String?>(json['shareId']),
      resourceType: serializer.fromJson<String?>(json['resourceType']),
      payloadJson: serializer.fromJson<String?>(json['payloadJson']),
      recipientEmailsJson: serializer.fromJson<String?>(
        json['recipientEmailsJson'],
      ),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      lastAttemptAt: serializer.fromJson<DateTime?>(json['lastAttemptAt']),
      attemptCount: serializer.fromJson<int>(json['attemptCount']),
      status: serializer.fromJson<String>(json['status']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'actionType': serializer.toJson<String>(actionType),
      'shareId': serializer.toJson<String?>(shareId),
      'resourceType': serializer.toJson<String?>(resourceType),
      'payloadJson': serializer.toJson<String?>(payloadJson),
      'recipientEmailsJson': serializer.toJson<String?>(recipientEmailsJson),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'lastAttemptAt': serializer.toJson<DateTime?>(lastAttemptAt),
      'attemptCount': serializer.toJson<int>(attemptCount),
      'status': serializer.toJson<String>(status),
    };
  }

  PendingShareAction copyWith({
    String? id,
    String? actionType,
    Value<String?> shareId = const Value.absent(),
    Value<String?> resourceType = const Value.absent(),
    Value<String?> payloadJson = const Value.absent(),
    Value<String?> recipientEmailsJson = const Value.absent(),
    DateTime? createdAt,
    Value<DateTime?> lastAttemptAt = const Value.absent(),
    int? attemptCount,
    String? status,
  }) => PendingShareAction(
    id: id ?? this.id,
    actionType: actionType ?? this.actionType,
    shareId: shareId.present ? shareId.value : this.shareId,
    resourceType: resourceType.present ? resourceType.value : this.resourceType,
    payloadJson: payloadJson.present ? payloadJson.value : this.payloadJson,
    recipientEmailsJson: recipientEmailsJson.present
        ? recipientEmailsJson.value
        : this.recipientEmailsJson,
    createdAt: createdAt ?? this.createdAt,
    lastAttemptAt: lastAttemptAt.present
        ? lastAttemptAt.value
        : this.lastAttemptAt,
    attemptCount: attemptCount ?? this.attemptCount,
    status: status ?? this.status,
  );
  PendingShareAction copyWithCompanion(PendingShareActionsCompanion data) {
    return PendingShareAction(
      id: data.id.present ? data.id.value : this.id,
      actionType: data.actionType.present
          ? data.actionType.value
          : this.actionType,
      shareId: data.shareId.present ? data.shareId.value : this.shareId,
      resourceType: data.resourceType.present
          ? data.resourceType.value
          : this.resourceType,
      payloadJson: data.payloadJson.present
          ? data.payloadJson.value
          : this.payloadJson,
      recipientEmailsJson: data.recipientEmailsJson.present
          ? data.recipientEmailsJson.value
          : this.recipientEmailsJson,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      lastAttemptAt: data.lastAttemptAt.present
          ? data.lastAttemptAt.value
          : this.lastAttemptAt,
      attemptCount: data.attemptCount.present
          ? data.attemptCount.value
          : this.attemptCount,
      status: data.status.present ? data.status.value : this.status,
    );
  }

  @override
  String toString() {
    return (StringBuffer('PendingShareAction(')
          ..write('id: $id, ')
          ..write('actionType: $actionType, ')
          ..write('shareId: $shareId, ')
          ..write('resourceType: $resourceType, ')
          ..write('payloadJson: $payloadJson, ')
          ..write('recipientEmailsJson: $recipientEmailsJson, ')
          ..write('createdAt: $createdAt, ')
          ..write('lastAttemptAt: $lastAttemptAt, ')
          ..write('attemptCount: $attemptCount, ')
          ..write('status: $status')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    actionType,
    shareId,
    resourceType,
    payloadJson,
    recipientEmailsJson,
    createdAt,
    lastAttemptAt,
    attemptCount,
    status,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is PendingShareAction &&
          other.id == this.id &&
          other.actionType == this.actionType &&
          other.shareId == this.shareId &&
          other.resourceType == this.resourceType &&
          other.payloadJson == this.payloadJson &&
          other.recipientEmailsJson == this.recipientEmailsJson &&
          other.createdAt == this.createdAt &&
          other.lastAttemptAt == this.lastAttemptAt &&
          other.attemptCount == this.attemptCount &&
          other.status == this.status);
}

class PendingShareActionsCompanion extends UpdateCompanion<PendingShareAction> {
  final Value<String> id;
  final Value<String> actionType;
  final Value<String?> shareId;
  final Value<String?> resourceType;
  final Value<String?> payloadJson;
  final Value<String?> recipientEmailsJson;
  final Value<DateTime> createdAt;
  final Value<DateTime?> lastAttemptAt;
  final Value<int> attemptCount;
  final Value<String> status;
  final Value<int> rowid;
  const PendingShareActionsCompanion({
    this.id = const Value.absent(),
    this.actionType = const Value.absent(),
    this.shareId = const Value.absent(),
    this.resourceType = const Value.absent(),
    this.payloadJson = const Value.absent(),
    this.recipientEmailsJson = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.lastAttemptAt = const Value.absent(),
    this.attemptCount = const Value.absent(),
    this.status = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  PendingShareActionsCompanion.insert({
    required String id,
    required String actionType,
    this.shareId = const Value.absent(),
    this.resourceType = const Value.absent(),
    this.payloadJson = const Value.absent(),
    this.recipientEmailsJson = const Value.absent(),
    required DateTime createdAt,
    this.lastAttemptAt = const Value.absent(),
    required int attemptCount,
    required String status,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       actionType = Value(actionType),
       createdAt = Value(createdAt),
       attemptCount = Value(attemptCount),
       status = Value(status);
  static Insertable<PendingShareAction> custom({
    Expression<String>? id,
    Expression<String>? actionType,
    Expression<String>? shareId,
    Expression<String>? resourceType,
    Expression<String>? payloadJson,
    Expression<String>? recipientEmailsJson,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? lastAttemptAt,
    Expression<int>? attemptCount,
    Expression<String>? status,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (actionType != null) 'action_type': actionType,
      if (shareId != null) 'share_id': shareId,
      if (resourceType != null) 'resource_type': resourceType,
      if (payloadJson != null) 'payload_json': payloadJson,
      if (recipientEmailsJson != null)
        'recipient_emails_json': recipientEmailsJson,
      if (createdAt != null) 'created_at': createdAt,
      if (lastAttemptAt != null) 'last_attempt_at': lastAttemptAt,
      if (attemptCount != null) 'attempt_count': attemptCount,
      if (status != null) 'status': status,
      if (rowid != null) 'rowid': rowid,
    });
  }

  PendingShareActionsCompanion copyWith({
    Value<String>? id,
    Value<String>? actionType,
    Value<String?>? shareId,
    Value<String?>? resourceType,
    Value<String?>? payloadJson,
    Value<String?>? recipientEmailsJson,
    Value<DateTime>? createdAt,
    Value<DateTime?>? lastAttemptAt,
    Value<int>? attemptCount,
    Value<String>? status,
    Value<int>? rowid,
  }) {
    return PendingShareActionsCompanion(
      id: id ?? this.id,
      actionType: actionType ?? this.actionType,
      shareId: shareId ?? this.shareId,
      resourceType: resourceType ?? this.resourceType,
      payloadJson: payloadJson ?? this.payloadJson,
      recipientEmailsJson: recipientEmailsJson ?? this.recipientEmailsJson,
      createdAt: createdAt ?? this.createdAt,
      lastAttemptAt: lastAttemptAt ?? this.lastAttemptAt,
      attemptCount: attemptCount ?? this.attemptCount,
      status: status ?? this.status,
      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 (actionType.present) {
      map['action_type'] = Variable<String>(actionType.value);
    }
    if (shareId.present) {
      map['share_id'] = Variable<String>(shareId.value);
    }
    if (resourceType.present) {
      map['resource_type'] = Variable<String>(resourceType.value);
    }
    if (payloadJson.present) {
      map['payload_json'] = Variable<String>(payloadJson.value);
    }
    if (recipientEmailsJson.present) {
      map['recipient_emails_json'] = Variable<String>(
        recipientEmailsJson.value,
      );
    }
    if (createdAt.present) {
      map['created_at'] = Variable<DateTime>(createdAt.value);
    }
    if (lastAttemptAt.present) {
      map['last_attempt_at'] = Variable<DateTime>(lastAttemptAt.value);
    }
    if (attemptCount.present) {
      map['attempt_count'] = Variable<int>(attemptCount.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('PendingShareActionsCompanion(')
          ..write('id: $id, ')
          ..write('actionType: $actionType, ')
          ..write('shareId: $shareId, ')
          ..write('resourceType: $resourceType, ')
          ..write('payloadJson: $payloadJson, ')
          ..write('recipientEmailsJson: $recipientEmailsJson, ')
          ..write('createdAt: $createdAt, ')
          ..write('lastAttemptAt: $lastAttemptAt, ')
          ..write('attemptCount: $attemptCount, ')
          ..write('status: $status, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ProgramsTable extends Programs with TableInfo<$ProgramsTable, Program> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ProgramsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _nameMeta = const VerificationMeta('name');
  @override
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _defaultRestSecondsMeta =
      const VerificationMeta('defaultRestSeconds');
  @override
  late final GeneratedColumn<int> defaultRestSeconds = GeneratedColumn<int>(
    'default_rest_seconds',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _isExampleMeta = const VerificationMeta(
    'isExample',
  );
  @override
  late final GeneratedColumn<bool> isExample = GeneratedColumn<bool>(
    'is_example',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("is_example" IN (0, 1))',
    ),
    defaultValue: const Constant(false),
  );
  static const VerificationMeta _tagsJsonMeta = const VerificationMeta(
    'tagsJson',
  );
  @override
  late final GeneratedColumn<String> tagsJson = GeneratedColumn<String>(
    'tags_json',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('[]'),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    defaultRestSeconds,
    isExample,
    tagsJson,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'programs';
  @override
  VerificationContext validateIntegrity(
    Insertable<Program> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('name')) {
      context.handle(
        _nameMeta,
        name.isAcceptableOrUnknown(data['name']!, _nameMeta),
      );
    } else if (isInserting) {
      context.missing(_nameMeta);
    }
    if (data.containsKey('default_rest_seconds')) {
      context.handle(
        _defaultRestSecondsMeta,
        defaultRestSeconds.isAcceptableOrUnknown(
          data['default_rest_seconds']!,
          _defaultRestSecondsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_defaultRestSecondsMeta);
    }
    if (data.containsKey('is_example')) {
      context.handle(
        _isExampleMeta,
        isExample.isAcceptableOrUnknown(data['is_example']!, _isExampleMeta),
      );
    }
    if (data.containsKey('tags_json')) {
      context.handle(
        _tagsJsonMeta,
        tagsJson.isAcceptableOrUnknown(data['tags_json']!, _tagsJsonMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  Program map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return Program(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      defaultRestSeconds: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_rest_seconds'],
      )!,
      isExample: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}is_example'],
      )!,
      tagsJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}tags_json'],
      )!,
    );
  }

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

class Program extends DataClass implements Insertable<Program> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String name;
  final int defaultRestSeconds;
  final bool isExample;
  final String tagsJson;
  const Program({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.name,
    required this.defaultRestSeconds,
    required this.isExample,
    required this.tagsJson,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['name'] = Variable<String>(name);
    map['default_rest_seconds'] = Variable<int>(defaultRestSeconds);
    map['is_example'] = Variable<bool>(isExample);
    map['tags_json'] = Variable<String>(tagsJson);
    return map;
  }

  ProgramsCompanion toCompanion(bool nullToAbsent) {
    return ProgramsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      name: Value(name),
      defaultRestSeconds: Value(defaultRestSeconds),
      isExample: Value(isExample),
      tagsJson: Value(tagsJson),
    );
  }

  factory Program.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return Program(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      name: serializer.fromJson<String>(json['name']),
      defaultRestSeconds: serializer.fromJson<int>(json['defaultRestSeconds']),
      isExample: serializer.fromJson<bool>(json['isExample']),
      tagsJson: serializer.fromJson<String>(json['tagsJson']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'name': serializer.toJson<String>(name),
      'defaultRestSeconds': serializer.toJson<int>(defaultRestSeconds),
      'isExample': serializer.toJson<bool>(isExample),
      'tagsJson': serializer.toJson<String>(tagsJson),
    };
  }

  Program copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? name,
    int? defaultRestSeconds,
    bool? isExample,
    String? tagsJson,
  }) => Program(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    name: name ?? this.name,
    defaultRestSeconds: defaultRestSeconds ?? this.defaultRestSeconds,
    isExample: isExample ?? this.isExample,
    tagsJson: tagsJson ?? this.tagsJson,
  );
  Program copyWithCompanion(ProgramsCompanion data) {
    return Program(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      name: data.name.present ? data.name.value : this.name,
      defaultRestSeconds: data.defaultRestSeconds.present
          ? data.defaultRestSeconds.value
          : this.defaultRestSeconds,
      isExample: data.isExample.present ? data.isExample.value : this.isExample,
      tagsJson: data.tagsJson.present ? data.tagsJson.value : this.tagsJson,
    );
  }

  @override
  String toString() {
    return (StringBuffer('Program(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('defaultRestSeconds: $defaultRestSeconds, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    name,
    defaultRestSeconds,
    isExample,
    tagsJson,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is Program &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.name == this.name &&
          other.defaultRestSeconds == this.defaultRestSeconds &&
          other.isExample == this.isExample &&
          other.tagsJson == this.tagsJson);
}

class ProgramsCompanion extends UpdateCompanion<Program> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> name;
  final Value<int> defaultRestSeconds;
  final Value<bool> isExample;
  final Value<String> tagsJson;
  final Value<int> rowid;
  const ProgramsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.name = const Value.absent(),
    this.defaultRestSeconds = const Value.absent(),
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ProgramsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String name,
    required int defaultRestSeconds,
    this.isExample = const Value.absent(),
    this.tagsJson = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       name = Value(name),
       defaultRestSeconds = Value(defaultRestSeconds);
  static Insertable<Program> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? name,
    Expression<int>? defaultRestSeconds,
    Expression<bool>? isExample,
    Expression<String>? tagsJson,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (name != null) 'name': name,
      if (defaultRestSeconds != null)
        'default_rest_seconds': defaultRestSeconds,
      if (isExample != null) 'is_example': isExample,
      if (tagsJson != null) 'tags_json': tagsJson,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ProgramsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? name,
    Value<int>? defaultRestSeconds,
    Value<bool>? isExample,
    Value<String>? tagsJson,
    Value<int>? rowid,
  }) {
    return ProgramsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      name: name ?? this.name,
      defaultRestSeconds: defaultRestSeconds ?? this.defaultRestSeconds,
      isExample: isExample ?? this.isExample,
      tagsJson: tagsJson ?? this.tagsJson,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (defaultRestSeconds.present) {
      map['default_rest_seconds'] = Variable<int>(defaultRestSeconds.value);
    }
    if (isExample.present) {
      map['is_example'] = Variable<bool>(isExample.value);
    }
    if (tagsJson.present) {
      map['tags_json'] = Variable<String>(tagsJson.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ProgramsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('name: $name, ')
          ..write('defaultRestSeconds: $defaultRestSeconds, ')
          ..write('isExample: $isExample, ')
          ..write('tagsJson: $tagsJson, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ProgramExercisesTable extends ProgramExercises
    with TableInfo<$ProgramExercisesTable, ProgramExercise> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ProgramExercisesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _programIdMeta = const VerificationMeta(
    'programId',
  );
  @override
  late final GeneratedColumn<String> programId = GeneratedColumn<String>(
    'program_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES programs (id)',
    ),
  );
  static const VerificationMeta _sourceExerciseIdMeta = const VerificationMeta(
    'sourceExerciseId',
  );
  @override
  late final GeneratedColumn<String> sourceExerciseId = GeneratedColumn<String>(
    'source_exercise_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES exercises (id)',
    ),
  );
  static const VerificationMeta _positionMeta = const VerificationMeta(
    'position',
  );
  @override
  late final GeneratedColumn<int> position = GeneratedColumn<int>(
    'position',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseNameSnapshotMeta =
      const VerificationMeta('exerciseNameSnapshot');
  @override
  late final GeneratedColumn<String> exerciseNameSnapshot =
      GeneratedColumn<String>(
        'exercise_name_snapshot',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseDescriptionSnapshotMeta =
      const VerificationMeta('exerciseDescriptionSnapshot');
  @override
  late final GeneratedColumn<String> exerciseDescriptionSnapshot =
      GeneratedColumn<String>(
        'exercise_description_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _exerciseImageMediaIdSnapshotMeta =
      const VerificationMeta('exerciseImageMediaIdSnapshot');
  @override
  late final GeneratedColumn<String> exerciseImageMediaIdSnapshot =
      GeneratedColumn<String>(
        'exercise_image_media_id_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES media_assets (id)',
        ),
      );
  static const VerificationMeta _exerciseImageMediaIdsSnapshotJsonMeta =
      const VerificationMeta('exerciseImageMediaIdsSnapshotJson');
  @override
  late final GeneratedColumn<String> exerciseImageMediaIdsSnapshotJson =
      GeneratedColumn<String>(
        'exercise_image_media_ids_snapshot_json',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _exerciseStepsSnapshotJsonMeta =
      const VerificationMeta('exerciseStepsSnapshotJson');
  @override
  late final GeneratedColumn<String> exerciseStepsSnapshotJson =
      GeneratedColumn<String>(
        'exercise_steps_snapshot_json',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _autoStartNextTimedStepSnapshotMeta =
      const VerificationMeta('autoStartNextTimedStepSnapshot');
  @override
  late final GeneratedColumn<bool> autoStartNextTimedStepSnapshot =
      GeneratedColumn<bool>(
        'auto_start_next_timed_step_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("auto_start_next_timed_step_snapshot" IN (0, 1))',
        ),
        defaultValue: const Constant(true),
      );
  static const VerificationMeta _autoStartNextTimedStepOverrideMeta =
      const VerificationMeta('autoStartNextTimedStepOverride');
  @override
  late final GeneratedColumn<bool> autoStartNextTimedStepOverride =
      GeneratedColumn<bool>(
        'auto_start_next_timed_step_override',
        aliasedName,
        true,
        type: DriftSqlType.bool,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("auto_start_next_timed_step_override" IN (0, 1))',
        ),
      );
  static const VerificationMeta _exerciseVideoMediaIdSnapshotMeta =
      const VerificationMeta('exerciseVideoMediaIdSnapshot');
  @override
  late final GeneratedColumn<String> exerciseVideoMediaIdSnapshot =
      GeneratedColumn<String>(
        'exercise_video_media_id_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES media_assets (id)',
        ),
      );
  static const VerificationMeta _exerciseArchivedSnapshotMeta =
      const VerificationMeta('exerciseArchivedSnapshot');
  @override
  late final GeneratedColumn<bool> exerciseArchivedSnapshot =
      GeneratedColumn<bool>(
        'exercise_archived_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("exercise_archived_snapshot" IN (0, 1))',
        ),
        defaultValue: const Constant(false),
      );
  static const VerificationMeta _availableTimeSnapshotMeta =
      const VerificationMeta('availableTimeSnapshot');
  @override
  late final GeneratedColumn<bool> availableTimeSnapshot =
      GeneratedColumn<bool>(
        'available_time_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("available_time_snapshot" IN (0, 1))',
        ),
      );
  static const VerificationMeta _availableRepsSnapshotMeta =
      const VerificationMeta('availableRepsSnapshot');
  @override
  late final GeneratedColumn<bool> availableRepsSnapshot =
      GeneratedColumn<bool>(
        'available_reps_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("available_reps_snapshot" IN (0, 1))',
        ),
      );
  static const VerificationMeta _availableScoreSnapshotMeta =
      const VerificationMeta('availableScoreSnapshot');
  @override
  late final GeneratedColumn<bool> availableScoreSnapshot =
      GeneratedColumn<bool>(
        'available_score_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.bool,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("available_score_snapshot" IN (0, 1))',
        ),
      );
  static const VerificationMeta _scoreInputModeSnapshotMeta =
      const VerificationMeta('scoreInputModeSnapshot');
  @override
  late final GeneratedColumn<String> scoreInputModeSnapshot =
      GeneratedColumn<String>(
        'score_input_mode_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('manual'),
      );
  static const VerificationMeta _scoreLabelSnapshotMeta =
      const VerificationMeta('scoreLabelSnapshot');
  @override
  late final GeneratedColumn<String> scoreLabelSnapshot =
      GeneratedColumn<String>(
        'score_label_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreUnitSnapshotMeta = const VerificationMeta(
    'scoreUnitSnapshot',
  );
  @override
  late final GeneratedColumn<String> scoreUnitSnapshot =
      GeneratedColumn<String>(
        'score_unit_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _setsCountMeta = const VerificationMeta(
    'setsCount',
  );
  @override
  late final GeneratedColumn<int> setsCount = GeneratedColumn<int>(
    'sets_count',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _timeEnabledMeta = const VerificationMeta(
    'timeEnabled',
  );
  @override
  late final GeneratedColumn<bool> timeEnabled = GeneratedColumn<bool>(
    'time_enabled',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("time_enabled" IN (0, 1))',
    ),
  );
  static const VerificationMeta _repsEnabledMeta = const VerificationMeta(
    'repsEnabled',
  );
  @override
  late final GeneratedColumn<bool> repsEnabled = GeneratedColumn<bool>(
    'reps_enabled',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("reps_enabled" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreEnabledMeta = const VerificationMeta(
    'scoreEnabled',
  );
  @override
  late final GeneratedColumn<bool> scoreEnabled = GeneratedColumn<bool>(
    'score_enabled',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("score_enabled" IN (0, 1))',
    ),
  );
  static const VerificationMeta _targetTimeSecondsMeta = const VerificationMeta(
    'targetTimeSeconds',
  );
  @override
  late final GeneratedColumn<int> targetTimeSeconds = GeneratedColumn<int>(
    'target_time_seconds',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetRepsMeta = const VerificationMeta(
    'targetReps',
  );
  @override
  late final GeneratedColumn<int> targetReps = GeneratedColumn<int>(
    'target_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetScoreMeta = const VerificationMeta(
    'targetScore',
  );
  @override
  late final GeneratedColumn<double> targetScore = GeneratedColumn<double>(
    'target_score',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetScoreTimeMsMeta = const VerificationMeta(
    'targetScoreTimeMs',
  );
  @override
  late final GeneratedColumn<int> targetScoreTimeMs = GeneratedColumn<int>(
    'target_score_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _restSecondsOverrideMeta =
      const VerificationMeta('restSecondsOverride');
  @override
  late final GeneratedColumn<int> restSecondsOverride = GeneratedColumn<int>(
    'rest_seconds_override',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    programId,
    sourceExerciseId,
    position,
    exerciseNameSnapshot,
    exerciseDescriptionSnapshot,
    exerciseImageMediaIdSnapshot,
    exerciseImageMediaIdsSnapshotJson,
    exerciseStepsSnapshotJson,
    autoStartNextTimedStepSnapshot,
    autoStartNextTimedStepOverride,
    exerciseVideoMediaIdSnapshot,
    exerciseArchivedSnapshot,
    availableTimeSnapshot,
    availableRepsSnapshot,
    availableScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    setsCount,
    timeEnabled,
    repsEnabled,
    scoreEnabled,
    targetTimeSeconds,
    targetReps,
    targetScore,
    targetScoreTimeMs,
    restSecondsOverride,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'program_exercises';
  @override
  VerificationContext validateIntegrity(
    Insertable<ProgramExercise> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('program_id')) {
      context.handle(
        _programIdMeta,
        programId.isAcceptableOrUnknown(data['program_id']!, _programIdMeta),
      );
    } else if (isInserting) {
      context.missing(_programIdMeta);
    }
    if (data.containsKey('source_exercise_id')) {
      context.handle(
        _sourceExerciseIdMeta,
        sourceExerciseId.isAcceptableOrUnknown(
          data['source_exercise_id']!,
          _sourceExerciseIdMeta,
        ),
      );
    }
    if (data.containsKey('position')) {
      context.handle(
        _positionMeta,
        position.isAcceptableOrUnknown(data['position']!, _positionMeta),
      );
    } else if (isInserting) {
      context.missing(_positionMeta);
    }
    if (data.containsKey('exercise_name_snapshot')) {
      context.handle(
        _exerciseNameSnapshotMeta,
        exerciseNameSnapshot.isAcceptableOrUnknown(
          data['exercise_name_snapshot']!,
          _exerciseNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseNameSnapshotMeta);
    }
    if (data.containsKey('exercise_description_snapshot')) {
      context.handle(
        _exerciseDescriptionSnapshotMeta,
        exerciseDescriptionSnapshot.isAcceptableOrUnknown(
          data['exercise_description_snapshot']!,
          _exerciseDescriptionSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('exercise_image_media_id_snapshot')) {
      context.handle(
        _exerciseImageMediaIdSnapshotMeta,
        exerciseImageMediaIdSnapshot.isAcceptableOrUnknown(
          data['exercise_image_media_id_snapshot']!,
          _exerciseImageMediaIdSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('exercise_image_media_ids_snapshot_json')) {
      context.handle(
        _exerciseImageMediaIdsSnapshotJsonMeta,
        exerciseImageMediaIdsSnapshotJson.isAcceptableOrUnknown(
          data['exercise_image_media_ids_snapshot_json']!,
          _exerciseImageMediaIdsSnapshotJsonMeta,
        ),
      );
    }
    if (data.containsKey('exercise_steps_snapshot_json')) {
      context.handle(
        _exerciseStepsSnapshotJsonMeta,
        exerciseStepsSnapshotJson.isAcceptableOrUnknown(
          data['exercise_steps_snapshot_json']!,
          _exerciseStepsSnapshotJsonMeta,
        ),
      );
    }
    if (data.containsKey('auto_start_next_timed_step_snapshot')) {
      context.handle(
        _autoStartNextTimedStepSnapshotMeta,
        autoStartNextTimedStepSnapshot.isAcceptableOrUnknown(
          data['auto_start_next_timed_step_snapshot']!,
          _autoStartNextTimedStepSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('auto_start_next_timed_step_override')) {
      context.handle(
        _autoStartNextTimedStepOverrideMeta,
        autoStartNextTimedStepOverride.isAcceptableOrUnknown(
          data['auto_start_next_timed_step_override']!,
          _autoStartNextTimedStepOverrideMeta,
        ),
      );
    }
    if (data.containsKey('exercise_video_media_id_snapshot')) {
      context.handle(
        _exerciseVideoMediaIdSnapshotMeta,
        exerciseVideoMediaIdSnapshot.isAcceptableOrUnknown(
          data['exercise_video_media_id_snapshot']!,
          _exerciseVideoMediaIdSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('exercise_archived_snapshot')) {
      context.handle(
        _exerciseArchivedSnapshotMeta,
        exerciseArchivedSnapshot.isAcceptableOrUnknown(
          data['exercise_archived_snapshot']!,
          _exerciseArchivedSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('available_time_snapshot')) {
      context.handle(
        _availableTimeSnapshotMeta,
        availableTimeSnapshot.isAcceptableOrUnknown(
          data['available_time_snapshot']!,
          _availableTimeSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_availableTimeSnapshotMeta);
    }
    if (data.containsKey('available_reps_snapshot')) {
      context.handle(
        _availableRepsSnapshotMeta,
        availableRepsSnapshot.isAcceptableOrUnknown(
          data['available_reps_snapshot']!,
          _availableRepsSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_availableRepsSnapshotMeta);
    }
    if (data.containsKey('available_score_snapshot')) {
      context.handle(
        _availableScoreSnapshotMeta,
        availableScoreSnapshot.isAcceptableOrUnknown(
          data['available_score_snapshot']!,
          _availableScoreSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_availableScoreSnapshotMeta);
    }
    if (data.containsKey('score_input_mode_snapshot')) {
      context.handle(
        _scoreInputModeSnapshotMeta,
        scoreInputModeSnapshot.isAcceptableOrUnknown(
          data['score_input_mode_snapshot']!,
          _scoreInputModeSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_label_snapshot')) {
      context.handle(
        _scoreLabelSnapshotMeta,
        scoreLabelSnapshot.isAcceptableOrUnknown(
          data['score_label_snapshot']!,
          _scoreLabelSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_unit_snapshot')) {
      context.handle(
        _scoreUnitSnapshotMeta,
        scoreUnitSnapshot.isAcceptableOrUnknown(
          data['score_unit_snapshot']!,
          _scoreUnitSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('sets_count')) {
      context.handle(
        _setsCountMeta,
        setsCount.isAcceptableOrUnknown(data['sets_count']!, _setsCountMeta),
      );
    } else if (isInserting) {
      context.missing(_setsCountMeta);
    }
    if (data.containsKey('time_enabled')) {
      context.handle(
        _timeEnabledMeta,
        timeEnabled.isAcceptableOrUnknown(
          data['time_enabled']!,
          _timeEnabledMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_timeEnabledMeta);
    }
    if (data.containsKey('reps_enabled')) {
      context.handle(
        _repsEnabledMeta,
        repsEnabled.isAcceptableOrUnknown(
          data['reps_enabled']!,
          _repsEnabledMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_repsEnabledMeta);
    }
    if (data.containsKey('score_enabled')) {
      context.handle(
        _scoreEnabledMeta,
        scoreEnabled.isAcceptableOrUnknown(
          data['score_enabled']!,
          _scoreEnabledMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_scoreEnabledMeta);
    }
    if (data.containsKey('target_time_seconds')) {
      context.handle(
        _targetTimeSecondsMeta,
        targetTimeSeconds.isAcceptableOrUnknown(
          data['target_time_seconds']!,
          _targetTimeSecondsMeta,
        ),
      );
    }
    if (data.containsKey('target_reps')) {
      context.handle(
        _targetRepsMeta,
        targetReps.isAcceptableOrUnknown(data['target_reps']!, _targetRepsMeta),
      );
    }
    if (data.containsKey('target_score')) {
      context.handle(
        _targetScoreMeta,
        targetScore.isAcceptableOrUnknown(
          data['target_score']!,
          _targetScoreMeta,
        ),
      );
    }
    if (data.containsKey('target_score_time_ms')) {
      context.handle(
        _targetScoreTimeMsMeta,
        targetScoreTimeMs.isAcceptableOrUnknown(
          data['target_score_time_ms']!,
          _targetScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('rest_seconds_override')) {
      context.handle(
        _restSecondsOverrideMeta,
        restSecondsOverride.isAcceptableOrUnknown(
          data['rest_seconds_override']!,
          _restSecondsOverrideMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  ProgramExercise map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ProgramExercise(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      programId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_id'],
      )!,
      sourceExerciseId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_exercise_id'],
      ),
      position: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}position'],
      )!,
      exerciseNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_name_snapshot'],
      )!,
      exerciseDescriptionSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_description_snapshot'],
      ),
      exerciseImageMediaIdSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_image_media_id_snapshot'],
      ),
      exerciseImageMediaIdsSnapshotJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_image_media_ids_snapshot_json'],
      ),
      exerciseStepsSnapshotJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_steps_snapshot_json'],
      ),
      autoStartNextTimedStepSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}auto_start_next_timed_step_snapshot'],
      )!,
      autoStartNextTimedStepOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}auto_start_next_timed_step_override'],
      ),
      exerciseVideoMediaIdSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_video_media_id_snapshot'],
      ),
      exerciseArchivedSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}exercise_archived_snapshot'],
      )!,
      availableTimeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}available_time_snapshot'],
      )!,
      availableRepsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}available_reps_snapshot'],
      )!,
      availableScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}available_score_snapshot'],
      )!,
      scoreInputModeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode_snapshot'],
      )!,
      scoreLabelSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label_snapshot'],
      ),
      scoreUnitSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit_snapshot'],
      ),
      setsCount: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sets_count'],
      )!,
      timeEnabled: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}time_enabled'],
      )!,
      repsEnabled: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}reps_enabled'],
      )!,
      scoreEnabled: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}score_enabled'],
      )!,
      targetTimeSeconds: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_time_seconds'],
      ),
      targetReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_reps'],
      ),
      targetScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}target_score'],
      ),
      targetScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_score_time_ms'],
      ),
      restSecondsOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}rest_seconds_override'],
      ),
    );
  }

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

class ProgramExercise extends DataClass implements Insertable<ProgramExercise> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String programId;
  final String? sourceExerciseId;
  final int position;
  final String exerciseNameSnapshot;
  final String? exerciseDescriptionSnapshot;
  final String? exerciseImageMediaIdSnapshot;
  final String? exerciseImageMediaIdsSnapshotJson;
  final String? exerciseStepsSnapshotJson;
  final bool autoStartNextTimedStepSnapshot;
  final bool? autoStartNextTimedStepOverride;
  final String? exerciseVideoMediaIdSnapshot;
  final bool exerciseArchivedSnapshot;
  final bool availableTimeSnapshot;
  final bool availableRepsSnapshot;
  final bool availableScoreSnapshot;
  final String scoreInputModeSnapshot;
  final String? scoreLabelSnapshot;
  final String? scoreUnitSnapshot;
  final int setsCount;
  final bool timeEnabled;
  final bool repsEnabled;
  final bool scoreEnabled;
  final int? targetTimeSeconds;
  final int? targetReps;
  final double? targetScore;
  final int? targetScoreTimeMs;
  final int? restSecondsOverride;
  const ProgramExercise({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.programId,
    this.sourceExerciseId,
    required this.position,
    required this.exerciseNameSnapshot,
    this.exerciseDescriptionSnapshot,
    this.exerciseImageMediaIdSnapshot,
    this.exerciseImageMediaIdsSnapshotJson,
    this.exerciseStepsSnapshotJson,
    required this.autoStartNextTimedStepSnapshot,
    this.autoStartNextTimedStepOverride,
    this.exerciseVideoMediaIdSnapshot,
    required this.exerciseArchivedSnapshot,
    required this.availableTimeSnapshot,
    required this.availableRepsSnapshot,
    required this.availableScoreSnapshot,
    required this.scoreInputModeSnapshot,
    this.scoreLabelSnapshot,
    this.scoreUnitSnapshot,
    required this.setsCount,
    required this.timeEnabled,
    required this.repsEnabled,
    required this.scoreEnabled,
    this.targetTimeSeconds,
    this.targetReps,
    this.targetScore,
    this.targetScoreTimeMs,
    this.restSecondsOverride,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['program_id'] = Variable<String>(programId);
    if (!nullToAbsent || sourceExerciseId != null) {
      map['source_exercise_id'] = Variable<String>(sourceExerciseId);
    }
    map['position'] = Variable<int>(position);
    map['exercise_name_snapshot'] = Variable<String>(exerciseNameSnapshot);
    if (!nullToAbsent || exerciseDescriptionSnapshot != null) {
      map['exercise_description_snapshot'] = Variable<String>(
        exerciseDescriptionSnapshot,
      );
    }
    if (!nullToAbsent || exerciseImageMediaIdSnapshot != null) {
      map['exercise_image_media_id_snapshot'] = Variable<String>(
        exerciseImageMediaIdSnapshot,
      );
    }
    if (!nullToAbsent || exerciseImageMediaIdsSnapshotJson != null) {
      map['exercise_image_media_ids_snapshot_json'] = Variable<String>(
        exerciseImageMediaIdsSnapshotJson,
      );
    }
    if (!nullToAbsent || exerciseStepsSnapshotJson != null) {
      map['exercise_steps_snapshot_json'] = Variable<String>(
        exerciseStepsSnapshotJson,
      );
    }
    map['auto_start_next_timed_step_snapshot'] = Variable<bool>(
      autoStartNextTimedStepSnapshot,
    );
    if (!nullToAbsent || autoStartNextTimedStepOverride != null) {
      map['auto_start_next_timed_step_override'] = Variable<bool>(
        autoStartNextTimedStepOverride,
      );
    }
    if (!nullToAbsent || exerciseVideoMediaIdSnapshot != null) {
      map['exercise_video_media_id_snapshot'] = Variable<String>(
        exerciseVideoMediaIdSnapshot,
      );
    }
    map['exercise_archived_snapshot'] = Variable<bool>(
      exerciseArchivedSnapshot,
    );
    map['available_time_snapshot'] = Variable<bool>(availableTimeSnapshot);
    map['available_reps_snapshot'] = Variable<bool>(availableRepsSnapshot);
    map['available_score_snapshot'] = Variable<bool>(availableScoreSnapshot);
    map['score_input_mode_snapshot'] = Variable<String>(scoreInputModeSnapshot);
    if (!nullToAbsent || scoreLabelSnapshot != null) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot);
    }
    if (!nullToAbsent || scoreUnitSnapshot != null) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot);
    }
    map['sets_count'] = Variable<int>(setsCount);
    map['time_enabled'] = Variable<bool>(timeEnabled);
    map['reps_enabled'] = Variable<bool>(repsEnabled);
    map['score_enabled'] = Variable<bool>(scoreEnabled);
    if (!nullToAbsent || targetTimeSeconds != null) {
      map['target_time_seconds'] = Variable<int>(targetTimeSeconds);
    }
    if (!nullToAbsent || targetReps != null) {
      map['target_reps'] = Variable<int>(targetReps);
    }
    if (!nullToAbsent || targetScore != null) {
      map['target_score'] = Variable<double>(targetScore);
    }
    if (!nullToAbsent || targetScoreTimeMs != null) {
      map['target_score_time_ms'] = Variable<int>(targetScoreTimeMs);
    }
    if (!nullToAbsent || restSecondsOverride != null) {
      map['rest_seconds_override'] = Variable<int>(restSecondsOverride);
    }
    return map;
  }

  ProgramExercisesCompanion toCompanion(bool nullToAbsent) {
    return ProgramExercisesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      programId: Value(programId),
      sourceExerciseId: sourceExerciseId == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceExerciseId),
      position: Value(position),
      exerciseNameSnapshot: Value(exerciseNameSnapshot),
      exerciseDescriptionSnapshot:
          exerciseDescriptionSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(exerciseDescriptionSnapshot),
      exerciseImageMediaIdSnapshot:
          exerciseImageMediaIdSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(exerciseImageMediaIdSnapshot),
      exerciseImageMediaIdsSnapshotJson:
          exerciseImageMediaIdsSnapshotJson == null && nullToAbsent
          ? const Value.absent()
          : Value(exerciseImageMediaIdsSnapshotJson),
      exerciseStepsSnapshotJson:
          exerciseStepsSnapshotJson == null && nullToAbsent
          ? const Value.absent()
          : Value(exerciseStepsSnapshotJson),
      autoStartNextTimedStepSnapshot: Value(autoStartNextTimedStepSnapshot),
      autoStartNextTimedStepOverride:
          autoStartNextTimedStepOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(autoStartNextTimedStepOverride),
      exerciseVideoMediaIdSnapshot:
          exerciseVideoMediaIdSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(exerciseVideoMediaIdSnapshot),
      exerciseArchivedSnapshot: Value(exerciseArchivedSnapshot),
      availableTimeSnapshot: Value(availableTimeSnapshot),
      availableRepsSnapshot: Value(availableRepsSnapshot),
      availableScoreSnapshot: Value(availableScoreSnapshot),
      scoreInputModeSnapshot: Value(scoreInputModeSnapshot),
      scoreLabelSnapshot: scoreLabelSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabelSnapshot),
      scoreUnitSnapshot: scoreUnitSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnitSnapshot),
      setsCount: Value(setsCount),
      timeEnabled: Value(timeEnabled),
      repsEnabled: Value(repsEnabled),
      scoreEnabled: Value(scoreEnabled),
      targetTimeSeconds: targetTimeSeconds == null && nullToAbsent
          ? const Value.absent()
          : Value(targetTimeSeconds),
      targetReps: targetReps == null && nullToAbsent
          ? const Value.absent()
          : Value(targetReps),
      targetScore: targetScore == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScore),
      targetScoreTimeMs: targetScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreTimeMs),
      restSecondsOverride: restSecondsOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(restSecondsOverride),
    );
  }

  factory ProgramExercise.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ProgramExercise(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      programId: serializer.fromJson<String>(json['programId']),
      sourceExerciseId: serializer.fromJson<String?>(json['sourceExerciseId']),
      position: serializer.fromJson<int>(json['position']),
      exerciseNameSnapshot: serializer.fromJson<String>(
        json['exerciseNameSnapshot'],
      ),
      exerciseDescriptionSnapshot: serializer.fromJson<String?>(
        json['exerciseDescriptionSnapshot'],
      ),
      exerciseImageMediaIdSnapshot: serializer.fromJson<String?>(
        json['exerciseImageMediaIdSnapshot'],
      ),
      exerciseImageMediaIdsSnapshotJson: serializer.fromJson<String?>(
        json['exerciseImageMediaIdsSnapshotJson'],
      ),
      exerciseStepsSnapshotJson: serializer.fromJson<String?>(
        json['exerciseStepsSnapshotJson'],
      ),
      autoStartNextTimedStepSnapshot: serializer.fromJson<bool>(
        json['autoStartNextTimedStepSnapshot'],
      ),
      autoStartNextTimedStepOverride: serializer.fromJson<bool?>(
        json['autoStartNextTimedStepOverride'],
      ),
      exerciseVideoMediaIdSnapshot: serializer.fromJson<String?>(
        json['exerciseVideoMediaIdSnapshot'],
      ),
      exerciseArchivedSnapshot: serializer.fromJson<bool>(
        json['exerciseArchivedSnapshot'],
      ),
      availableTimeSnapshot: serializer.fromJson<bool>(
        json['availableTimeSnapshot'],
      ),
      availableRepsSnapshot: serializer.fromJson<bool>(
        json['availableRepsSnapshot'],
      ),
      availableScoreSnapshot: serializer.fromJson<bool>(
        json['availableScoreSnapshot'],
      ),
      scoreInputModeSnapshot: serializer.fromJson<String>(
        json['scoreInputModeSnapshot'],
      ),
      scoreLabelSnapshot: serializer.fromJson<String?>(
        json['scoreLabelSnapshot'],
      ),
      scoreUnitSnapshot: serializer.fromJson<String?>(
        json['scoreUnitSnapshot'],
      ),
      setsCount: serializer.fromJson<int>(json['setsCount']),
      timeEnabled: serializer.fromJson<bool>(json['timeEnabled']),
      repsEnabled: serializer.fromJson<bool>(json['repsEnabled']),
      scoreEnabled: serializer.fromJson<bool>(json['scoreEnabled']),
      targetTimeSeconds: serializer.fromJson<int?>(json['targetTimeSeconds']),
      targetReps: serializer.fromJson<int?>(json['targetReps']),
      targetScore: serializer.fromJson<double?>(json['targetScore']),
      targetScoreTimeMs: serializer.fromJson<int?>(json['targetScoreTimeMs']),
      restSecondsOverride: serializer.fromJson<int?>(
        json['restSecondsOverride'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'programId': serializer.toJson<String>(programId),
      'sourceExerciseId': serializer.toJson<String?>(sourceExerciseId),
      'position': serializer.toJson<int>(position),
      'exerciseNameSnapshot': serializer.toJson<String>(exerciseNameSnapshot),
      'exerciseDescriptionSnapshot': serializer.toJson<String?>(
        exerciseDescriptionSnapshot,
      ),
      'exerciseImageMediaIdSnapshot': serializer.toJson<String?>(
        exerciseImageMediaIdSnapshot,
      ),
      'exerciseImageMediaIdsSnapshotJson': serializer.toJson<String?>(
        exerciseImageMediaIdsSnapshotJson,
      ),
      'exerciseStepsSnapshotJson': serializer.toJson<String?>(
        exerciseStepsSnapshotJson,
      ),
      'autoStartNextTimedStepSnapshot': serializer.toJson<bool>(
        autoStartNextTimedStepSnapshot,
      ),
      'autoStartNextTimedStepOverride': serializer.toJson<bool?>(
        autoStartNextTimedStepOverride,
      ),
      'exerciseVideoMediaIdSnapshot': serializer.toJson<String?>(
        exerciseVideoMediaIdSnapshot,
      ),
      'exerciseArchivedSnapshot': serializer.toJson<bool>(
        exerciseArchivedSnapshot,
      ),
      'availableTimeSnapshot': serializer.toJson<bool>(availableTimeSnapshot),
      'availableRepsSnapshot': serializer.toJson<bool>(availableRepsSnapshot),
      'availableScoreSnapshot': serializer.toJson<bool>(availableScoreSnapshot),
      'scoreInputModeSnapshot': serializer.toJson<String>(
        scoreInputModeSnapshot,
      ),
      'scoreLabelSnapshot': serializer.toJson<String?>(scoreLabelSnapshot),
      'scoreUnitSnapshot': serializer.toJson<String?>(scoreUnitSnapshot),
      'setsCount': serializer.toJson<int>(setsCount),
      'timeEnabled': serializer.toJson<bool>(timeEnabled),
      'repsEnabled': serializer.toJson<bool>(repsEnabled),
      'scoreEnabled': serializer.toJson<bool>(scoreEnabled),
      'targetTimeSeconds': serializer.toJson<int?>(targetTimeSeconds),
      'targetReps': serializer.toJson<int?>(targetReps),
      'targetScore': serializer.toJson<double?>(targetScore),
      'targetScoreTimeMs': serializer.toJson<int?>(targetScoreTimeMs),
      'restSecondsOverride': serializer.toJson<int?>(restSecondsOverride),
    };
  }

  ProgramExercise copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? programId,
    Value<String?> sourceExerciseId = const Value.absent(),
    int? position,
    String? exerciseNameSnapshot,
    Value<String?> exerciseDescriptionSnapshot = const Value.absent(),
    Value<String?> exerciseImageMediaIdSnapshot = const Value.absent(),
    Value<String?> exerciseImageMediaIdsSnapshotJson = const Value.absent(),
    Value<String?> exerciseStepsSnapshotJson = const Value.absent(),
    bool? autoStartNextTimedStepSnapshot,
    Value<bool?> autoStartNextTimedStepOverride = const Value.absent(),
    Value<String?> exerciseVideoMediaIdSnapshot = const Value.absent(),
    bool? exerciseArchivedSnapshot,
    bool? availableTimeSnapshot,
    bool? availableRepsSnapshot,
    bool? availableScoreSnapshot,
    String? scoreInputModeSnapshot,
    Value<String?> scoreLabelSnapshot = const Value.absent(),
    Value<String?> scoreUnitSnapshot = const Value.absent(),
    int? setsCount,
    bool? timeEnabled,
    bool? repsEnabled,
    bool? scoreEnabled,
    Value<int?> targetTimeSeconds = const Value.absent(),
    Value<int?> targetReps = const Value.absent(),
    Value<double?> targetScore = const Value.absent(),
    Value<int?> targetScoreTimeMs = const Value.absent(),
    Value<int?> restSecondsOverride = const Value.absent(),
  }) => ProgramExercise(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    programId: programId ?? this.programId,
    sourceExerciseId: sourceExerciseId.present
        ? sourceExerciseId.value
        : this.sourceExerciseId,
    position: position ?? this.position,
    exerciseNameSnapshot: exerciseNameSnapshot ?? this.exerciseNameSnapshot,
    exerciseDescriptionSnapshot: exerciseDescriptionSnapshot.present
        ? exerciseDescriptionSnapshot.value
        : this.exerciseDescriptionSnapshot,
    exerciseImageMediaIdSnapshot: exerciseImageMediaIdSnapshot.present
        ? exerciseImageMediaIdSnapshot.value
        : this.exerciseImageMediaIdSnapshot,
    exerciseImageMediaIdsSnapshotJson: exerciseImageMediaIdsSnapshotJson.present
        ? exerciseImageMediaIdsSnapshotJson.value
        : this.exerciseImageMediaIdsSnapshotJson,
    exerciseStepsSnapshotJson: exerciseStepsSnapshotJson.present
        ? exerciseStepsSnapshotJson.value
        : this.exerciseStepsSnapshotJson,
    autoStartNextTimedStepSnapshot:
        autoStartNextTimedStepSnapshot ?? this.autoStartNextTimedStepSnapshot,
    autoStartNextTimedStepOverride: autoStartNextTimedStepOverride.present
        ? autoStartNextTimedStepOverride.value
        : this.autoStartNextTimedStepOverride,
    exerciseVideoMediaIdSnapshot: exerciseVideoMediaIdSnapshot.present
        ? exerciseVideoMediaIdSnapshot.value
        : this.exerciseVideoMediaIdSnapshot,
    exerciseArchivedSnapshot:
        exerciseArchivedSnapshot ?? this.exerciseArchivedSnapshot,
    availableTimeSnapshot: availableTimeSnapshot ?? this.availableTimeSnapshot,
    availableRepsSnapshot: availableRepsSnapshot ?? this.availableRepsSnapshot,
    availableScoreSnapshot:
        availableScoreSnapshot ?? this.availableScoreSnapshot,
    scoreInputModeSnapshot:
        scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
    scoreLabelSnapshot: scoreLabelSnapshot.present
        ? scoreLabelSnapshot.value
        : this.scoreLabelSnapshot,
    scoreUnitSnapshot: scoreUnitSnapshot.present
        ? scoreUnitSnapshot.value
        : this.scoreUnitSnapshot,
    setsCount: setsCount ?? this.setsCount,
    timeEnabled: timeEnabled ?? this.timeEnabled,
    repsEnabled: repsEnabled ?? this.repsEnabled,
    scoreEnabled: scoreEnabled ?? this.scoreEnabled,
    targetTimeSeconds: targetTimeSeconds.present
        ? targetTimeSeconds.value
        : this.targetTimeSeconds,
    targetReps: targetReps.present ? targetReps.value : this.targetReps,
    targetScore: targetScore.present ? targetScore.value : this.targetScore,
    targetScoreTimeMs: targetScoreTimeMs.present
        ? targetScoreTimeMs.value
        : this.targetScoreTimeMs,
    restSecondsOverride: restSecondsOverride.present
        ? restSecondsOverride.value
        : this.restSecondsOverride,
  );
  ProgramExercise copyWithCompanion(ProgramExercisesCompanion data) {
    return ProgramExercise(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      programId: data.programId.present ? data.programId.value : this.programId,
      sourceExerciseId: data.sourceExerciseId.present
          ? data.sourceExerciseId.value
          : this.sourceExerciseId,
      position: data.position.present ? data.position.value : this.position,
      exerciseNameSnapshot: data.exerciseNameSnapshot.present
          ? data.exerciseNameSnapshot.value
          : this.exerciseNameSnapshot,
      exerciseDescriptionSnapshot: data.exerciseDescriptionSnapshot.present
          ? data.exerciseDescriptionSnapshot.value
          : this.exerciseDescriptionSnapshot,
      exerciseImageMediaIdSnapshot: data.exerciseImageMediaIdSnapshot.present
          ? data.exerciseImageMediaIdSnapshot.value
          : this.exerciseImageMediaIdSnapshot,
      exerciseImageMediaIdsSnapshotJson:
          data.exerciseImageMediaIdsSnapshotJson.present
          ? data.exerciseImageMediaIdsSnapshotJson.value
          : this.exerciseImageMediaIdsSnapshotJson,
      exerciseStepsSnapshotJson: data.exerciseStepsSnapshotJson.present
          ? data.exerciseStepsSnapshotJson.value
          : this.exerciseStepsSnapshotJson,
      autoStartNextTimedStepSnapshot:
          data.autoStartNextTimedStepSnapshot.present
          ? data.autoStartNextTimedStepSnapshot.value
          : this.autoStartNextTimedStepSnapshot,
      autoStartNextTimedStepOverride:
          data.autoStartNextTimedStepOverride.present
          ? data.autoStartNextTimedStepOverride.value
          : this.autoStartNextTimedStepOverride,
      exerciseVideoMediaIdSnapshot: data.exerciseVideoMediaIdSnapshot.present
          ? data.exerciseVideoMediaIdSnapshot.value
          : this.exerciseVideoMediaIdSnapshot,
      exerciseArchivedSnapshot: data.exerciseArchivedSnapshot.present
          ? data.exerciseArchivedSnapshot.value
          : this.exerciseArchivedSnapshot,
      availableTimeSnapshot: data.availableTimeSnapshot.present
          ? data.availableTimeSnapshot.value
          : this.availableTimeSnapshot,
      availableRepsSnapshot: data.availableRepsSnapshot.present
          ? data.availableRepsSnapshot.value
          : this.availableRepsSnapshot,
      availableScoreSnapshot: data.availableScoreSnapshot.present
          ? data.availableScoreSnapshot.value
          : this.availableScoreSnapshot,
      scoreInputModeSnapshot: data.scoreInputModeSnapshot.present
          ? data.scoreInputModeSnapshot.value
          : this.scoreInputModeSnapshot,
      scoreLabelSnapshot: data.scoreLabelSnapshot.present
          ? data.scoreLabelSnapshot.value
          : this.scoreLabelSnapshot,
      scoreUnitSnapshot: data.scoreUnitSnapshot.present
          ? data.scoreUnitSnapshot.value
          : this.scoreUnitSnapshot,
      setsCount: data.setsCount.present ? data.setsCount.value : this.setsCount,
      timeEnabled: data.timeEnabled.present
          ? data.timeEnabled.value
          : this.timeEnabled,
      repsEnabled: data.repsEnabled.present
          ? data.repsEnabled.value
          : this.repsEnabled,
      scoreEnabled: data.scoreEnabled.present
          ? data.scoreEnabled.value
          : this.scoreEnabled,
      targetTimeSeconds: data.targetTimeSeconds.present
          ? data.targetTimeSeconds.value
          : this.targetTimeSeconds,
      targetReps: data.targetReps.present
          ? data.targetReps.value
          : this.targetReps,
      targetScore: data.targetScore.present
          ? data.targetScore.value
          : this.targetScore,
      targetScoreTimeMs: data.targetScoreTimeMs.present
          ? data.targetScoreTimeMs.value
          : this.targetScoreTimeMs,
      restSecondsOverride: data.restSecondsOverride.present
          ? data.restSecondsOverride.value
          : this.restSecondsOverride,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ProgramExercise(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('programId: $programId, ')
          ..write('sourceExerciseId: $sourceExerciseId, ')
          ..write('position: $position, ')
          ..write('exerciseNameSnapshot: $exerciseNameSnapshot, ')
          ..write('exerciseDescriptionSnapshot: $exerciseDescriptionSnapshot, ')
          ..write(
            'exerciseImageMediaIdSnapshot: $exerciseImageMediaIdSnapshot, ',
          )
          ..write(
            'exerciseImageMediaIdsSnapshotJson: $exerciseImageMediaIdsSnapshotJson, ',
          )
          ..write('exerciseStepsSnapshotJson: $exerciseStepsSnapshotJson, ')
          ..write(
            'autoStartNextTimedStepSnapshot: $autoStartNextTimedStepSnapshot, ',
          )
          ..write(
            'autoStartNextTimedStepOverride: $autoStartNextTimedStepOverride, ',
          )
          ..write(
            'exerciseVideoMediaIdSnapshot: $exerciseVideoMediaIdSnapshot, ',
          )
          ..write('exerciseArchivedSnapshot: $exerciseArchivedSnapshot, ')
          ..write('availableTimeSnapshot: $availableTimeSnapshot, ')
          ..write('availableRepsSnapshot: $availableRepsSnapshot, ')
          ..write('availableScoreSnapshot: $availableScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('setsCount: $setsCount, ')
          ..write('timeEnabled: $timeEnabled, ')
          ..write('repsEnabled: $repsEnabled, ')
          ..write('scoreEnabled: $scoreEnabled, ')
          ..write('targetTimeSeconds: $targetTimeSeconds, ')
          ..write('targetReps: $targetReps, ')
          ..write('targetScore: $targetScore, ')
          ..write('targetScoreTimeMs: $targetScoreTimeMs, ')
          ..write('restSecondsOverride: $restSecondsOverride')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    programId,
    sourceExerciseId,
    position,
    exerciseNameSnapshot,
    exerciseDescriptionSnapshot,
    exerciseImageMediaIdSnapshot,
    exerciseImageMediaIdsSnapshotJson,
    exerciseStepsSnapshotJson,
    autoStartNextTimedStepSnapshot,
    autoStartNextTimedStepOverride,
    exerciseVideoMediaIdSnapshot,
    exerciseArchivedSnapshot,
    availableTimeSnapshot,
    availableRepsSnapshot,
    availableScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    setsCount,
    timeEnabled,
    repsEnabled,
    scoreEnabled,
    targetTimeSeconds,
    targetReps,
    targetScore,
    targetScoreTimeMs,
    restSecondsOverride,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ProgramExercise &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.programId == this.programId &&
          other.sourceExerciseId == this.sourceExerciseId &&
          other.position == this.position &&
          other.exerciseNameSnapshot == this.exerciseNameSnapshot &&
          other.exerciseDescriptionSnapshot ==
              this.exerciseDescriptionSnapshot &&
          other.exerciseImageMediaIdSnapshot ==
              this.exerciseImageMediaIdSnapshot &&
          other.exerciseImageMediaIdsSnapshotJson ==
              this.exerciseImageMediaIdsSnapshotJson &&
          other.exerciseStepsSnapshotJson == this.exerciseStepsSnapshotJson &&
          other.autoStartNextTimedStepSnapshot ==
              this.autoStartNextTimedStepSnapshot &&
          other.autoStartNextTimedStepOverride ==
              this.autoStartNextTimedStepOverride &&
          other.exerciseVideoMediaIdSnapshot ==
              this.exerciseVideoMediaIdSnapshot &&
          other.exerciseArchivedSnapshot == this.exerciseArchivedSnapshot &&
          other.availableTimeSnapshot == this.availableTimeSnapshot &&
          other.availableRepsSnapshot == this.availableRepsSnapshot &&
          other.availableScoreSnapshot == this.availableScoreSnapshot &&
          other.scoreInputModeSnapshot == this.scoreInputModeSnapshot &&
          other.scoreLabelSnapshot == this.scoreLabelSnapshot &&
          other.scoreUnitSnapshot == this.scoreUnitSnapshot &&
          other.setsCount == this.setsCount &&
          other.timeEnabled == this.timeEnabled &&
          other.repsEnabled == this.repsEnabled &&
          other.scoreEnabled == this.scoreEnabled &&
          other.targetTimeSeconds == this.targetTimeSeconds &&
          other.targetReps == this.targetReps &&
          other.targetScore == this.targetScore &&
          other.targetScoreTimeMs == this.targetScoreTimeMs &&
          other.restSecondsOverride == this.restSecondsOverride);
}

class ProgramExercisesCompanion extends UpdateCompanion<ProgramExercise> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> programId;
  final Value<String?> sourceExerciseId;
  final Value<int> position;
  final Value<String> exerciseNameSnapshot;
  final Value<String?> exerciseDescriptionSnapshot;
  final Value<String?> exerciseImageMediaIdSnapshot;
  final Value<String?> exerciseImageMediaIdsSnapshotJson;
  final Value<String?> exerciseStepsSnapshotJson;
  final Value<bool> autoStartNextTimedStepSnapshot;
  final Value<bool?> autoStartNextTimedStepOverride;
  final Value<String?> exerciseVideoMediaIdSnapshot;
  final Value<bool> exerciseArchivedSnapshot;
  final Value<bool> availableTimeSnapshot;
  final Value<bool> availableRepsSnapshot;
  final Value<bool> availableScoreSnapshot;
  final Value<String> scoreInputModeSnapshot;
  final Value<String?> scoreLabelSnapshot;
  final Value<String?> scoreUnitSnapshot;
  final Value<int> setsCount;
  final Value<bool> timeEnabled;
  final Value<bool> repsEnabled;
  final Value<bool> scoreEnabled;
  final Value<int?> targetTimeSeconds;
  final Value<int?> targetReps;
  final Value<double?> targetScore;
  final Value<int?> targetScoreTimeMs;
  final Value<int?> restSecondsOverride;
  final Value<int> rowid;
  const ProgramExercisesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.programId = const Value.absent(),
    this.sourceExerciseId = const Value.absent(),
    this.position = const Value.absent(),
    this.exerciseNameSnapshot = const Value.absent(),
    this.exerciseDescriptionSnapshot = const Value.absent(),
    this.exerciseImageMediaIdSnapshot = const Value.absent(),
    this.exerciseImageMediaIdsSnapshotJson = const Value.absent(),
    this.exerciseStepsSnapshotJson = const Value.absent(),
    this.autoStartNextTimedStepSnapshot = const Value.absent(),
    this.autoStartNextTimedStepOverride = const Value.absent(),
    this.exerciseVideoMediaIdSnapshot = const Value.absent(),
    this.exerciseArchivedSnapshot = const Value.absent(),
    this.availableTimeSnapshot = const Value.absent(),
    this.availableRepsSnapshot = const Value.absent(),
    this.availableScoreSnapshot = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.setsCount = const Value.absent(),
    this.timeEnabled = const Value.absent(),
    this.repsEnabled = const Value.absent(),
    this.scoreEnabled = const Value.absent(),
    this.targetTimeSeconds = const Value.absent(),
    this.targetReps = const Value.absent(),
    this.targetScore = const Value.absent(),
    this.targetScoreTimeMs = const Value.absent(),
    this.restSecondsOverride = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ProgramExercisesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String programId,
    this.sourceExerciseId = const Value.absent(),
    required int position,
    required String exerciseNameSnapshot,
    this.exerciseDescriptionSnapshot = const Value.absent(),
    this.exerciseImageMediaIdSnapshot = const Value.absent(),
    this.exerciseImageMediaIdsSnapshotJson = const Value.absent(),
    this.exerciseStepsSnapshotJson = const Value.absent(),
    this.autoStartNextTimedStepSnapshot = const Value.absent(),
    this.autoStartNextTimedStepOverride = const Value.absent(),
    this.exerciseVideoMediaIdSnapshot = const Value.absent(),
    this.exerciseArchivedSnapshot = const Value.absent(),
    required bool availableTimeSnapshot,
    required bool availableRepsSnapshot,
    required bool availableScoreSnapshot,
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    required int setsCount,
    required bool timeEnabled,
    required bool repsEnabled,
    required bool scoreEnabled,
    this.targetTimeSeconds = const Value.absent(),
    this.targetReps = const Value.absent(),
    this.targetScore = const Value.absent(),
    this.targetScoreTimeMs = const Value.absent(),
    this.restSecondsOverride = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       programId = Value(programId),
       position = Value(position),
       exerciseNameSnapshot = Value(exerciseNameSnapshot),
       availableTimeSnapshot = Value(availableTimeSnapshot),
       availableRepsSnapshot = Value(availableRepsSnapshot),
       availableScoreSnapshot = Value(availableScoreSnapshot),
       setsCount = Value(setsCount),
       timeEnabled = Value(timeEnabled),
       repsEnabled = Value(repsEnabled),
       scoreEnabled = Value(scoreEnabled);
  static Insertable<ProgramExercise> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? programId,
    Expression<String>? sourceExerciseId,
    Expression<int>? position,
    Expression<String>? exerciseNameSnapshot,
    Expression<String>? exerciseDescriptionSnapshot,
    Expression<String>? exerciseImageMediaIdSnapshot,
    Expression<String>? exerciseImageMediaIdsSnapshotJson,
    Expression<String>? exerciseStepsSnapshotJson,
    Expression<bool>? autoStartNextTimedStepSnapshot,
    Expression<bool>? autoStartNextTimedStepOverride,
    Expression<String>? exerciseVideoMediaIdSnapshot,
    Expression<bool>? exerciseArchivedSnapshot,
    Expression<bool>? availableTimeSnapshot,
    Expression<bool>? availableRepsSnapshot,
    Expression<bool>? availableScoreSnapshot,
    Expression<String>? scoreInputModeSnapshot,
    Expression<String>? scoreLabelSnapshot,
    Expression<String>? scoreUnitSnapshot,
    Expression<int>? setsCount,
    Expression<bool>? timeEnabled,
    Expression<bool>? repsEnabled,
    Expression<bool>? scoreEnabled,
    Expression<int>? targetTimeSeconds,
    Expression<int>? targetReps,
    Expression<double>? targetScore,
    Expression<int>? targetScoreTimeMs,
    Expression<int>? restSecondsOverride,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (programId != null) 'program_id': programId,
      if (sourceExerciseId != null) 'source_exercise_id': sourceExerciseId,
      if (position != null) 'position': position,
      if (exerciseNameSnapshot != null)
        'exercise_name_snapshot': exerciseNameSnapshot,
      if (exerciseDescriptionSnapshot != null)
        'exercise_description_snapshot': exerciseDescriptionSnapshot,
      if (exerciseImageMediaIdSnapshot != null)
        'exercise_image_media_id_snapshot': exerciseImageMediaIdSnapshot,
      if (exerciseImageMediaIdsSnapshotJson != null)
        'exercise_image_media_ids_snapshot_json':
            exerciseImageMediaIdsSnapshotJson,
      if (exerciseStepsSnapshotJson != null)
        'exercise_steps_snapshot_json': exerciseStepsSnapshotJson,
      if (autoStartNextTimedStepSnapshot != null)
        'auto_start_next_timed_step_snapshot': autoStartNextTimedStepSnapshot,
      if (autoStartNextTimedStepOverride != null)
        'auto_start_next_timed_step_override': autoStartNextTimedStepOverride,
      if (exerciseVideoMediaIdSnapshot != null)
        'exercise_video_media_id_snapshot': exerciseVideoMediaIdSnapshot,
      if (exerciseArchivedSnapshot != null)
        'exercise_archived_snapshot': exerciseArchivedSnapshot,
      if (availableTimeSnapshot != null)
        'available_time_snapshot': availableTimeSnapshot,
      if (availableRepsSnapshot != null)
        'available_reps_snapshot': availableRepsSnapshot,
      if (availableScoreSnapshot != null)
        'available_score_snapshot': availableScoreSnapshot,
      if (scoreInputModeSnapshot != null)
        'score_input_mode_snapshot': scoreInputModeSnapshot,
      if (scoreLabelSnapshot != null)
        'score_label_snapshot': scoreLabelSnapshot,
      if (scoreUnitSnapshot != null) 'score_unit_snapshot': scoreUnitSnapshot,
      if (setsCount != null) 'sets_count': setsCount,
      if (timeEnabled != null) 'time_enabled': timeEnabled,
      if (repsEnabled != null) 'reps_enabled': repsEnabled,
      if (scoreEnabled != null) 'score_enabled': scoreEnabled,
      if (targetTimeSeconds != null) 'target_time_seconds': targetTimeSeconds,
      if (targetReps != null) 'target_reps': targetReps,
      if (targetScore != null) 'target_score': targetScore,
      if (targetScoreTimeMs != null) 'target_score_time_ms': targetScoreTimeMs,
      if (restSecondsOverride != null)
        'rest_seconds_override': restSecondsOverride,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ProgramExercisesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? programId,
    Value<String?>? sourceExerciseId,
    Value<int>? position,
    Value<String>? exerciseNameSnapshot,
    Value<String?>? exerciseDescriptionSnapshot,
    Value<String?>? exerciseImageMediaIdSnapshot,
    Value<String?>? exerciseImageMediaIdsSnapshotJson,
    Value<String?>? exerciseStepsSnapshotJson,
    Value<bool>? autoStartNextTimedStepSnapshot,
    Value<bool?>? autoStartNextTimedStepOverride,
    Value<String?>? exerciseVideoMediaIdSnapshot,
    Value<bool>? exerciseArchivedSnapshot,
    Value<bool>? availableTimeSnapshot,
    Value<bool>? availableRepsSnapshot,
    Value<bool>? availableScoreSnapshot,
    Value<String>? scoreInputModeSnapshot,
    Value<String?>? scoreLabelSnapshot,
    Value<String?>? scoreUnitSnapshot,
    Value<int>? setsCount,
    Value<bool>? timeEnabled,
    Value<bool>? repsEnabled,
    Value<bool>? scoreEnabled,
    Value<int?>? targetTimeSeconds,
    Value<int?>? targetReps,
    Value<double?>? targetScore,
    Value<int?>? targetScoreTimeMs,
    Value<int?>? restSecondsOverride,
    Value<int>? rowid,
  }) {
    return ProgramExercisesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      programId: programId ?? this.programId,
      sourceExerciseId: sourceExerciseId ?? this.sourceExerciseId,
      position: position ?? this.position,
      exerciseNameSnapshot: exerciseNameSnapshot ?? this.exerciseNameSnapshot,
      exerciseDescriptionSnapshot:
          exerciseDescriptionSnapshot ?? this.exerciseDescriptionSnapshot,
      exerciseImageMediaIdSnapshot:
          exerciseImageMediaIdSnapshot ?? this.exerciseImageMediaIdSnapshot,
      exerciseImageMediaIdsSnapshotJson:
          exerciseImageMediaIdsSnapshotJson ??
          this.exerciseImageMediaIdsSnapshotJson,
      exerciseStepsSnapshotJson:
          exerciseStepsSnapshotJson ?? this.exerciseStepsSnapshotJson,
      autoStartNextTimedStepSnapshot:
          autoStartNextTimedStepSnapshot ?? this.autoStartNextTimedStepSnapshot,
      autoStartNextTimedStepOverride:
          autoStartNextTimedStepOverride ?? this.autoStartNextTimedStepOverride,
      exerciseVideoMediaIdSnapshot:
          exerciseVideoMediaIdSnapshot ?? this.exerciseVideoMediaIdSnapshot,
      exerciseArchivedSnapshot:
          exerciseArchivedSnapshot ?? this.exerciseArchivedSnapshot,
      availableTimeSnapshot:
          availableTimeSnapshot ?? this.availableTimeSnapshot,
      availableRepsSnapshot:
          availableRepsSnapshot ?? this.availableRepsSnapshot,
      availableScoreSnapshot:
          availableScoreSnapshot ?? this.availableScoreSnapshot,
      scoreInputModeSnapshot:
          scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
      scoreLabelSnapshot: scoreLabelSnapshot ?? this.scoreLabelSnapshot,
      scoreUnitSnapshot: scoreUnitSnapshot ?? this.scoreUnitSnapshot,
      setsCount: setsCount ?? this.setsCount,
      timeEnabled: timeEnabled ?? this.timeEnabled,
      repsEnabled: repsEnabled ?? this.repsEnabled,
      scoreEnabled: scoreEnabled ?? this.scoreEnabled,
      targetTimeSeconds: targetTimeSeconds ?? this.targetTimeSeconds,
      targetReps: targetReps ?? this.targetReps,
      targetScore: targetScore ?? this.targetScore,
      targetScoreTimeMs: targetScoreTimeMs ?? this.targetScoreTimeMs,
      restSecondsOverride: restSecondsOverride ?? this.restSecondsOverride,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (programId.present) {
      map['program_id'] = Variable<String>(programId.value);
    }
    if (sourceExerciseId.present) {
      map['source_exercise_id'] = Variable<String>(sourceExerciseId.value);
    }
    if (position.present) {
      map['position'] = Variable<int>(position.value);
    }
    if (exerciseNameSnapshot.present) {
      map['exercise_name_snapshot'] = Variable<String>(
        exerciseNameSnapshot.value,
      );
    }
    if (exerciseDescriptionSnapshot.present) {
      map['exercise_description_snapshot'] = Variable<String>(
        exerciseDescriptionSnapshot.value,
      );
    }
    if (exerciseImageMediaIdSnapshot.present) {
      map['exercise_image_media_id_snapshot'] = Variable<String>(
        exerciseImageMediaIdSnapshot.value,
      );
    }
    if (exerciseImageMediaIdsSnapshotJson.present) {
      map['exercise_image_media_ids_snapshot_json'] = Variable<String>(
        exerciseImageMediaIdsSnapshotJson.value,
      );
    }
    if (exerciseStepsSnapshotJson.present) {
      map['exercise_steps_snapshot_json'] = Variable<String>(
        exerciseStepsSnapshotJson.value,
      );
    }
    if (autoStartNextTimedStepSnapshot.present) {
      map['auto_start_next_timed_step_snapshot'] = Variable<bool>(
        autoStartNextTimedStepSnapshot.value,
      );
    }
    if (autoStartNextTimedStepOverride.present) {
      map['auto_start_next_timed_step_override'] = Variable<bool>(
        autoStartNextTimedStepOverride.value,
      );
    }
    if (exerciseVideoMediaIdSnapshot.present) {
      map['exercise_video_media_id_snapshot'] = Variable<String>(
        exerciseVideoMediaIdSnapshot.value,
      );
    }
    if (exerciseArchivedSnapshot.present) {
      map['exercise_archived_snapshot'] = Variable<bool>(
        exerciseArchivedSnapshot.value,
      );
    }
    if (availableTimeSnapshot.present) {
      map['available_time_snapshot'] = Variable<bool>(
        availableTimeSnapshot.value,
      );
    }
    if (availableRepsSnapshot.present) {
      map['available_reps_snapshot'] = Variable<bool>(
        availableRepsSnapshot.value,
      );
    }
    if (availableScoreSnapshot.present) {
      map['available_score_snapshot'] = Variable<bool>(
        availableScoreSnapshot.value,
      );
    }
    if (scoreInputModeSnapshot.present) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot.value,
      );
    }
    if (scoreLabelSnapshot.present) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot.value);
    }
    if (scoreUnitSnapshot.present) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot.value);
    }
    if (setsCount.present) {
      map['sets_count'] = Variable<int>(setsCount.value);
    }
    if (timeEnabled.present) {
      map['time_enabled'] = Variable<bool>(timeEnabled.value);
    }
    if (repsEnabled.present) {
      map['reps_enabled'] = Variable<bool>(repsEnabled.value);
    }
    if (scoreEnabled.present) {
      map['score_enabled'] = Variable<bool>(scoreEnabled.value);
    }
    if (targetTimeSeconds.present) {
      map['target_time_seconds'] = Variable<int>(targetTimeSeconds.value);
    }
    if (targetReps.present) {
      map['target_reps'] = Variable<int>(targetReps.value);
    }
    if (targetScore.present) {
      map['target_score'] = Variable<double>(targetScore.value);
    }
    if (targetScoreTimeMs.present) {
      map['target_score_time_ms'] = Variable<int>(targetScoreTimeMs.value);
    }
    if (restSecondsOverride.present) {
      map['rest_seconds_override'] = Variable<int>(restSecondsOverride.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ProgramExercisesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('programId: $programId, ')
          ..write('sourceExerciseId: $sourceExerciseId, ')
          ..write('position: $position, ')
          ..write('exerciseNameSnapshot: $exerciseNameSnapshot, ')
          ..write('exerciseDescriptionSnapshot: $exerciseDescriptionSnapshot, ')
          ..write(
            'exerciseImageMediaIdSnapshot: $exerciseImageMediaIdSnapshot, ',
          )
          ..write(
            'exerciseImageMediaIdsSnapshotJson: $exerciseImageMediaIdsSnapshotJson, ',
          )
          ..write('exerciseStepsSnapshotJson: $exerciseStepsSnapshotJson, ')
          ..write(
            'autoStartNextTimedStepSnapshot: $autoStartNextTimedStepSnapshot, ',
          )
          ..write(
            'autoStartNextTimedStepOverride: $autoStartNextTimedStepOverride, ',
          )
          ..write(
            'exerciseVideoMediaIdSnapshot: $exerciseVideoMediaIdSnapshot, ',
          )
          ..write('exerciseArchivedSnapshot: $exerciseArchivedSnapshot, ')
          ..write('availableTimeSnapshot: $availableTimeSnapshot, ')
          ..write('availableRepsSnapshot: $availableRepsSnapshot, ')
          ..write('availableScoreSnapshot: $availableScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('setsCount: $setsCount, ')
          ..write('timeEnabled: $timeEnabled, ')
          ..write('repsEnabled: $repsEnabled, ')
          ..write('scoreEnabled: $scoreEnabled, ')
          ..write('targetTimeSeconds: $targetTimeSeconds, ')
          ..write('targetReps: $targetReps, ')
          ..write('targetScore: $targetScore, ')
          ..write('targetScoreTimeMs: $targetScoreTimeMs, ')
          ..write('restSecondsOverride: $restSecondsOverride, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $RemoteResourceMappingsTable extends RemoteResourceMappings
    with TableInfo<$RemoteResourceMappingsTable, RemoteResourceMapping> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $RemoteResourceMappingsTable(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 _resourceTypeMeta = const VerificationMeta(
    'resourceType',
  );
  @override
  late final GeneratedColumn<String> resourceType = GeneratedColumn<String>(
    'resource_type',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _clientIdMeta = const VerificationMeta(
    'clientId',
  );
  @override
  late final GeneratedColumn<String> clientId = GeneratedColumn<String>(
    'client_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _serverIdMeta = const VerificationMeta(
    'serverId',
  );
  @override
  late final GeneratedColumn<String> serverId = GeneratedColumn<String>(
    'server_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _serverUpdatedAtMeta = const VerificationMeta(
    'serverUpdatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> serverUpdatedAt =
      GeneratedColumn<DateTime>(
        'server_updated_at',
        aliasedName,
        false,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: true,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    resourceType,
    clientId,
    serverId,
    serverUpdatedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'remote_resource_mappings';
  @override
  VerificationContext validateIntegrity(
    Insertable<RemoteResourceMapping> 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('resource_type')) {
      context.handle(
        _resourceTypeMeta,
        resourceType.isAcceptableOrUnknown(
          data['resource_type']!,
          _resourceTypeMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_resourceTypeMeta);
    }
    if (data.containsKey('client_id')) {
      context.handle(
        _clientIdMeta,
        clientId.isAcceptableOrUnknown(data['client_id']!, _clientIdMeta),
      );
    } else if (isInserting) {
      context.missing(_clientIdMeta);
    }
    if (data.containsKey('server_id')) {
      context.handle(
        _serverIdMeta,
        serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta),
      );
    } else if (isInserting) {
      context.missing(_serverIdMeta);
    }
    if (data.containsKey('server_updated_at')) {
      context.handle(
        _serverUpdatedAtMeta,
        serverUpdatedAt.isAcceptableOrUnknown(
          data['server_updated_at']!,
          _serverUpdatedAtMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_serverUpdatedAtMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  RemoteResourceMapping map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return RemoteResourceMapping(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      resourceType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}resource_type'],
      )!,
      clientId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}client_id'],
      )!,
      serverId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}server_id'],
      )!,
      serverUpdatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}server_updated_at'],
      )!,
    );
  }

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

class RemoteResourceMapping extends DataClass
    implements Insertable<RemoteResourceMapping> {
  final String id;
  final String resourceType;
  final String clientId;
  final String serverId;
  final DateTime serverUpdatedAt;
  const RemoteResourceMapping({
    required this.id,
    required this.resourceType,
    required this.clientId,
    required this.serverId,
    required this.serverUpdatedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['resource_type'] = Variable<String>(resourceType);
    map['client_id'] = Variable<String>(clientId);
    map['server_id'] = Variable<String>(serverId);
    map['server_updated_at'] = Variable<DateTime>(serverUpdatedAt);
    return map;
  }

  RemoteResourceMappingsCompanion toCompanion(bool nullToAbsent) {
    return RemoteResourceMappingsCompanion(
      id: Value(id),
      resourceType: Value(resourceType),
      clientId: Value(clientId),
      serverId: Value(serverId),
      serverUpdatedAt: Value(serverUpdatedAt),
    );
  }

  factory RemoteResourceMapping.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return RemoteResourceMapping(
      id: serializer.fromJson<String>(json['id']),
      resourceType: serializer.fromJson<String>(json['resourceType']),
      clientId: serializer.fromJson<String>(json['clientId']),
      serverId: serializer.fromJson<String>(json['serverId']),
      serverUpdatedAt: serializer.fromJson<DateTime>(json['serverUpdatedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'resourceType': serializer.toJson<String>(resourceType),
      'clientId': serializer.toJson<String>(clientId),
      'serverId': serializer.toJson<String>(serverId),
      'serverUpdatedAt': serializer.toJson<DateTime>(serverUpdatedAt),
    };
  }

  RemoteResourceMapping copyWith({
    String? id,
    String? resourceType,
    String? clientId,
    String? serverId,
    DateTime? serverUpdatedAt,
  }) => RemoteResourceMapping(
    id: id ?? this.id,
    resourceType: resourceType ?? this.resourceType,
    clientId: clientId ?? this.clientId,
    serverId: serverId ?? this.serverId,
    serverUpdatedAt: serverUpdatedAt ?? this.serverUpdatedAt,
  );
  RemoteResourceMapping copyWithCompanion(
    RemoteResourceMappingsCompanion data,
  ) {
    return RemoteResourceMapping(
      id: data.id.present ? data.id.value : this.id,
      resourceType: data.resourceType.present
          ? data.resourceType.value
          : this.resourceType,
      clientId: data.clientId.present ? data.clientId.value : this.clientId,
      serverId: data.serverId.present ? data.serverId.value : this.serverId,
      serverUpdatedAt: data.serverUpdatedAt.present
          ? data.serverUpdatedAt.value
          : this.serverUpdatedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('RemoteResourceMapping(')
          ..write('id: $id, ')
          ..write('resourceType: $resourceType, ')
          ..write('clientId: $clientId, ')
          ..write('serverId: $serverId, ')
          ..write('serverUpdatedAt: $serverUpdatedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode =>
      Object.hash(id, resourceType, clientId, serverId, serverUpdatedAt);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is RemoteResourceMapping &&
          other.id == this.id &&
          other.resourceType == this.resourceType &&
          other.clientId == this.clientId &&
          other.serverId == this.serverId &&
          other.serverUpdatedAt == this.serverUpdatedAt);
}

class RemoteResourceMappingsCompanion
    extends UpdateCompanion<RemoteResourceMapping> {
  final Value<String> id;
  final Value<String> resourceType;
  final Value<String> clientId;
  final Value<String> serverId;
  final Value<DateTime> serverUpdatedAt;
  final Value<int> rowid;
  const RemoteResourceMappingsCompanion({
    this.id = const Value.absent(),
    this.resourceType = const Value.absent(),
    this.clientId = const Value.absent(),
    this.serverId = const Value.absent(),
    this.serverUpdatedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  RemoteResourceMappingsCompanion.insert({
    required String id,
    required String resourceType,
    required String clientId,
    required String serverId,
    required DateTime serverUpdatedAt,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       resourceType = Value(resourceType),
       clientId = Value(clientId),
       serverId = Value(serverId),
       serverUpdatedAt = Value(serverUpdatedAt);
  static Insertable<RemoteResourceMapping> custom({
    Expression<String>? id,
    Expression<String>? resourceType,
    Expression<String>? clientId,
    Expression<String>? serverId,
    Expression<DateTime>? serverUpdatedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (resourceType != null) 'resource_type': resourceType,
      if (clientId != null) 'client_id': clientId,
      if (serverId != null) 'server_id': serverId,
      if (serverUpdatedAt != null) 'server_updated_at': serverUpdatedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  RemoteResourceMappingsCompanion copyWith({
    Value<String>? id,
    Value<String>? resourceType,
    Value<String>? clientId,
    Value<String>? serverId,
    Value<DateTime>? serverUpdatedAt,
    Value<int>? rowid,
  }) {
    return RemoteResourceMappingsCompanion(
      id: id ?? this.id,
      resourceType: resourceType ?? this.resourceType,
      clientId: clientId ?? this.clientId,
      serverId: serverId ?? this.serverId,
      serverUpdatedAt: serverUpdatedAt ?? this.serverUpdatedAt,
      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 (resourceType.present) {
      map['resource_type'] = Variable<String>(resourceType.value);
    }
    if (clientId.present) {
      map['client_id'] = Variable<String>(clientId.value);
    }
    if (serverId.present) {
      map['server_id'] = Variable<String>(serverId.value);
    }
    if (serverUpdatedAt.present) {
      map['server_updated_at'] = Variable<DateTime>(serverUpdatedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('RemoteResourceMappingsCompanion(')
          ..write('id: $id, ')
          ..write('resourceType: $resourceType, ')
          ..write('clientId: $clientId, ')
          ..write('serverId: $serverId, ')
          ..write('serverUpdatedAt: $serverUpdatedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $ShareInboxItemsTable extends ShareInboxItems
    with TableInfo<$ShareInboxItemsTable, ShareInboxItem> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $ShareInboxItemsTable(this.attachedDatabase, [this._alias]);
  static const VerificationMeta _shareIdMeta = const VerificationMeta(
    'shareId',
  );
  @override
  late final GeneratedColumn<String> shareId = GeneratedColumn<String>(
    'share_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _senderUserIdMeta = const VerificationMeta(
    'senderUserId',
  );
  @override
  late final GeneratedColumn<String> senderUserId = GeneratedColumn<String>(
    'sender_user_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _resourceTypeMeta = const VerificationMeta(
    'resourceType',
  );
  @override
  late final GeneratedColumn<String> resourceType = GeneratedColumn<String>(
    'resource_type',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _payloadJsonMeta = const VerificationMeta(
    'payloadJson',
  );
  @override
  late final GeneratedColumn<String> payloadJson = GeneratedColumn<String>(
    'payload_json',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _createdAtMeta = const VerificationMeta(
    'createdAt',
  );
  @override
  late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _respondedAtMeta = const VerificationMeta(
    'respondedAt',
  );
  @override
  late final GeneratedColumn<DateTime> respondedAt = GeneratedColumn<DateTime>(
    'responded_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    shareId,
    senderUserId,
    resourceType,
    payloadJson,
    status,
    createdAt,
    updatedAt,
    respondedAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'share_inbox_items';
  @override
  VerificationContext validateIntegrity(
    Insertable<ShareInboxItem> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('share_id')) {
      context.handle(
        _shareIdMeta,
        shareId.isAcceptableOrUnknown(data['share_id']!, _shareIdMeta),
      );
    } else if (isInserting) {
      context.missing(_shareIdMeta);
    }
    if (data.containsKey('sender_user_id')) {
      context.handle(
        _senderUserIdMeta,
        senderUserId.isAcceptableOrUnknown(
          data['sender_user_id']!,
          _senderUserIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_senderUserIdMeta);
    }
    if (data.containsKey('resource_type')) {
      context.handle(
        _resourceTypeMeta,
        resourceType.isAcceptableOrUnknown(
          data['resource_type']!,
          _resourceTypeMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_resourceTypeMeta);
    }
    if (data.containsKey('payload_json')) {
      context.handle(
        _payloadJsonMeta,
        payloadJson.isAcceptableOrUnknown(
          data['payload_json']!,
          _payloadJsonMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_payloadJsonMeta);
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    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('responded_at')) {
      context.handle(
        _respondedAtMeta,
        respondedAt.isAcceptableOrUnknown(
          data['responded_at']!,
          _respondedAtMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {shareId};
  @override
  ShareInboxItem map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return ShareInboxItem(
      shareId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}share_id'],
      )!,
      senderUserId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sender_user_id'],
      )!,
      resourceType: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}resource_type'],
      )!,
      payloadJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}payload_json'],
      )!,
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      respondedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}responded_at'],
      ),
    );
  }

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

class ShareInboxItem extends DataClass implements Insertable<ShareInboxItem> {
  final String shareId;
  final String senderUserId;
  final String resourceType;
  final String payloadJson;
  final String status;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? respondedAt;
  const ShareInboxItem({
    required this.shareId,
    required this.senderUserId,
    required this.resourceType,
    required this.payloadJson,
    required this.status,
    required this.createdAt,
    required this.updatedAt,
    this.respondedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['share_id'] = Variable<String>(shareId);
    map['sender_user_id'] = Variable<String>(senderUserId);
    map['resource_type'] = Variable<String>(resourceType);
    map['payload_json'] = Variable<String>(payloadJson);
    map['status'] = Variable<String>(status);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || respondedAt != null) {
      map['responded_at'] = Variable<DateTime>(respondedAt);
    }
    return map;
  }

  ShareInboxItemsCompanion toCompanion(bool nullToAbsent) {
    return ShareInboxItemsCompanion(
      shareId: Value(shareId),
      senderUserId: Value(senderUserId),
      resourceType: Value(resourceType),
      payloadJson: Value(payloadJson),
      status: Value(status),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      respondedAt: respondedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(respondedAt),
    );
  }

  factory ShareInboxItem.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return ShareInboxItem(
      shareId: serializer.fromJson<String>(json['shareId']),
      senderUserId: serializer.fromJson<String>(json['senderUserId']),
      resourceType: serializer.fromJson<String>(json['resourceType']),
      payloadJson: serializer.fromJson<String>(json['payloadJson']),
      status: serializer.fromJson<String>(json['status']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      respondedAt: serializer.fromJson<DateTime?>(json['respondedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'shareId': serializer.toJson<String>(shareId),
      'senderUserId': serializer.toJson<String>(senderUserId),
      'resourceType': serializer.toJson<String>(resourceType),
      'payloadJson': serializer.toJson<String>(payloadJson),
      'status': serializer.toJson<String>(status),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'respondedAt': serializer.toJson<DateTime?>(respondedAt),
    };
  }

  ShareInboxItem copyWith({
    String? shareId,
    String? senderUserId,
    String? resourceType,
    String? payloadJson,
    String? status,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> respondedAt = const Value.absent(),
  }) => ShareInboxItem(
    shareId: shareId ?? this.shareId,
    senderUserId: senderUserId ?? this.senderUserId,
    resourceType: resourceType ?? this.resourceType,
    payloadJson: payloadJson ?? this.payloadJson,
    status: status ?? this.status,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    respondedAt: respondedAt.present ? respondedAt.value : this.respondedAt,
  );
  ShareInboxItem copyWithCompanion(ShareInboxItemsCompanion data) {
    return ShareInboxItem(
      shareId: data.shareId.present ? data.shareId.value : this.shareId,
      senderUserId: data.senderUserId.present
          ? data.senderUserId.value
          : this.senderUserId,
      resourceType: data.resourceType.present
          ? data.resourceType.value
          : this.resourceType,
      payloadJson: data.payloadJson.present
          ? data.payloadJson.value
          : this.payloadJson,
      status: data.status.present ? data.status.value : this.status,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
      updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
      respondedAt: data.respondedAt.present
          ? data.respondedAt.value
          : this.respondedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('ShareInboxItem(')
          ..write('shareId: $shareId, ')
          ..write('senderUserId: $senderUserId, ')
          ..write('resourceType: $resourceType, ')
          ..write('payloadJson: $payloadJson, ')
          ..write('status: $status, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('respondedAt: $respondedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    shareId,
    senderUserId,
    resourceType,
    payloadJson,
    status,
    createdAt,
    updatedAt,
    respondedAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is ShareInboxItem &&
          other.shareId == this.shareId &&
          other.senderUserId == this.senderUserId &&
          other.resourceType == this.resourceType &&
          other.payloadJson == this.payloadJson &&
          other.status == this.status &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.respondedAt == this.respondedAt);
}

class ShareInboxItemsCompanion extends UpdateCompanion<ShareInboxItem> {
  final Value<String> shareId;
  final Value<String> senderUserId;
  final Value<String> resourceType;
  final Value<String> payloadJson;
  final Value<String> status;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> respondedAt;
  final Value<int> rowid;
  const ShareInboxItemsCompanion({
    this.shareId = const Value.absent(),
    this.senderUserId = const Value.absent(),
    this.resourceType = const Value.absent(),
    this.payloadJson = const Value.absent(),
    this.status = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.respondedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  ShareInboxItemsCompanion.insert({
    required String shareId,
    required String senderUserId,
    required String resourceType,
    required String payloadJson,
    required String status,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.respondedAt = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : shareId = Value(shareId),
       senderUserId = Value(senderUserId),
       resourceType = Value(resourceType),
       payloadJson = Value(payloadJson),
       status = Value(status),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt);
  static Insertable<ShareInboxItem> custom({
    Expression<String>? shareId,
    Expression<String>? senderUserId,
    Expression<String>? resourceType,
    Expression<String>? payloadJson,
    Expression<String>? status,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? respondedAt,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (shareId != null) 'share_id': shareId,
      if (senderUserId != null) 'sender_user_id': senderUserId,
      if (resourceType != null) 'resource_type': resourceType,
      if (payloadJson != null) 'payload_json': payloadJson,
      if (status != null) 'status': status,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (respondedAt != null) 'responded_at': respondedAt,
      if (rowid != null) 'rowid': rowid,
    });
  }

  ShareInboxItemsCompanion copyWith({
    Value<String>? shareId,
    Value<String>? senderUserId,
    Value<String>? resourceType,
    Value<String>? payloadJson,
    Value<String>? status,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? respondedAt,
    Value<int>? rowid,
  }) {
    return ShareInboxItemsCompanion(
      shareId: shareId ?? this.shareId,
      senderUserId: senderUserId ?? this.senderUserId,
      resourceType: resourceType ?? this.resourceType,
      payloadJson: payloadJson ?? this.payloadJson,
      status: status ?? this.status,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      respondedAt: respondedAt ?? this.respondedAt,
      rowid: rowid ?? this.rowid,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (shareId.present) {
      map['share_id'] = Variable<String>(shareId.value);
    }
    if (senderUserId.present) {
      map['sender_user_id'] = Variable<String>(senderUserId.value);
    }
    if (resourceType.present) {
      map['resource_type'] = Variable<String>(resourceType.value);
    }
    if (payloadJson.present) {
      map['payload_json'] = Variable<String>(payloadJson.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (respondedAt.present) {
      map['responded_at'] = Variable<DateTime>(respondedAt.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('ShareInboxItemsCompanion(')
          ..write('shareId: $shareId, ')
          ..write('senderUserId: $senderUserId, ')
          ..write('resourceType: $resourceType, ')
          ..write('payloadJson: $payloadJson, ')
          ..write('status: $status, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('respondedAt: $respondedAt, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $SyncMetadataEntriesTable extends SyncMetadataEntries
    with TableInfo<$SyncMetadataEntriesTable, SyncMetadataEntry> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $SyncMetadataEntriesTable(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: false,
    defaultValue: const Constant('singleton'),
  );
  static const VerificationMeta _serverCursorMeta = const VerificationMeta(
    'serverCursor',
  );
  @override
  late final GeneratedColumn<String> serverCursor = GeneratedColumn<String>(
    'server_cursor',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _lastSuccessfulSyncAtMeta =
      const VerificationMeta('lastSuccessfulSyncAt');
  @override
  late final GeneratedColumn<DateTime> lastSuccessfulSyncAt =
      GeneratedColumn<DateTime>(
        'last_successful_sync_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastAttemptAtMeta = const VerificationMeta(
    'lastAttemptAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastAttemptAt =
      GeneratedColumn<DateTime>(
        'last_attempt_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastFailureAtMeta = const VerificationMeta(
    'lastFailureAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastFailureAt =
      GeneratedColumn<DateTime>(
        'last_failure_at',
        aliasedName,
        true,
        type: DriftSqlType.dateTime,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('idle'),
  );
  static const VerificationMeta _pendingPushCountMeta = const VerificationMeta(
    'pendingPushCount',
  );
  @override
  late final GeneratedColumn<int> pendingPushCount = GeneratedColumn<int>(
    'pending_push_count',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    serverCursor,
    lastSuccessfulSyncAt,
    lastAttemptAt,
    lastFailureAt,
    status,
    pendingPushCount,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'sync_metadata';
  @override
  VerificationContext validateIntegrity(
    Insertable<SyncMetadataEntry> instance, {
    bool isInserting = false,
  }) {
    final context = VerificationContext();
    final data = instance.toColumns(true);
    if (data.containsKey('id')) {
      context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
    }
    if (data.containsKey('server_cursor')) {
      context.handle(
        _serverCursorMeta,
        serverCursor.isAcceptableOrUnknown(
          data['server_cursor']!,
          _serverCursorMeta,
        ),
      );
    }
    if (data.containsKey('last_successful_sync_at')) {
      context.handle(
        _lastSuccessfulSyncAtMeta,
        lastSuccessfulSyncAt.isAcceptableOrUnknown(
          data['last_successful_sync_at']!,
          _lastSuccessfulSyncAtMeta,
        ),
      );
    }
    if (data.containsKey('last_attempt_at')) {
      context.handle(
        _lastAttemptAtMeta,
        lastAttemptAt.isAcceptableOrUnknown(
          data['last_attempt_at']!,
          _lastAttemptAtMeta,
        ),
      );
    }
    if (data.containsKey('last_failure_at')) {
      context.handle(
        _lastFailureAtMeta,
        lastFailureAt.isAcceptableOrUnknown(
          data['last_failure_at']!,
          _lastFailureAtMeta,
        ),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    }
    if (data.containsKey('pending_push_count')) {
      context.handle(
        _pendingPushCountMeta,
        pendingPushCount.isAcceptableOrUnknown(
          data['pending_push_count']!,
          _pendingPushCountMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  SyncMetadataEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return SyncMetadataEntry(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      serverCursor: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}server_cursor'],
      ),
      lastSuccessfulSyncAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_successful_sync_at'],
      ),
      lastAttemptAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_attempt_at'],
      ),
      lastFailureAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_failure_at'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      pendingPushCount: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}pending_push_count'],
      ),
    );
  }

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

class SyncMetadataEntry extends DataClass
    implements Insertable<SyncMetadataEntry> {
  final String id;
  final String? serverCursor;
  final DateTime? lastSuccessfulSyncAt;
  final DateTime? lastAttemptAt;
  final DateTime? lastFailureAt;
  final String status;
  final int? pendingPushCount;
  const SyncMetadataEntry({
    required this.id,
    this.serverCursor,
    this.lastSuccessfulSyncAt,
    this.lastAttemptAt,
    this.lastFailureAt,
    required this.status,
    this.pendingPushCount,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    if (!nullToAbsent || serverCursor != null) {
      map['server_cursor'] = Variable<String>(serverCursor);
    }
    if (!nullToAbsent || lastSuccessfulSyncAt != null) {
      map['last_successful_sync_at'] = Variable<DateTime>(lastSuccessfulSyncAt);
    }
    if (!nullToAbsent || lastAttemptAt != null) {
      map['last_attempt_at'] = Variable<DateTime>(lastAttemptAt);
    }
    if (!nullToAbsent || lastFailureAt != null) {
      map['last_failure_at'] = Variable<DateTime>(lastFailureAt);
    }
    map['status'] = Variable<String>(status);
    if (!nullToAbsent || pendingPushCount != null) {
      map['pending_push_count'] = Variable<int>(pendingPushCount);
    }
    return map;
  }

  SyncMetadataEntriesCompanion toCompanion(bool nullToAbsent) {
    return SyncMetadataEntriesCompanion(
      id: Value(id),
      serverCursor: serverCursor == null && nullToAbsent
          ? const Value.absent()
          : Value(serverCursor),
      lastSuccessfulSyncAt: lastSuccessfulSyncAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSuccessfulSyncAt),
      lastAttemptAt: lastAttemptAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastAttemptAt),
      lastFailureAt: lastFailureAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastFailureAt),
      status: Value(status),
      pendingPushCount: pendingPushCount == null && nullToAbsent
          ? const Value.absent()
          : Value(pendingPushCount),
    );
  }

  factory SyncMetadataEntry.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return SyncMetadataEntry(
      id: serializer.fromJson<String>(json['id']),
      serverCursor: serializer.fromJson<String?>(json['serverCursor']),
      lastSuccessfulSyncAt: serializer.fromJson<DateTime?>(
        json['lastSuccessfulSyncAt'],
      ),
      lastAttemptAt: serializer.fromJson<DateTime?>(json['lastAttemptAt']),
      lastFailureAt: serializer.fromJson<DateTime?>(json['lastFailureAt']),
      status: serializer.fromJson<String>(json['status']),
      pendingPushCount: serializer.fromJson<int?>(json['pendingPushCount']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'serverCursor': serializer.toJson<String?>(serverCursor),
      'lastSuccessfulSyncAt': serializer.toJson<DateTime?>(
        lastSuccessfulSyncAt,
      ),
      'lastAttemptAt': serializer.toJson<DateTime?>(lastAttemptAt),
      'lastFailureAt': serializer.toJson<DateTime?>(lastFailureAt),
      'status': serializer.toJson<String>(status),
      'pendingPushCount': serializer.toJson<int?>(pendingPushCount),
    };
  }

  SyncMetadataEntry copyWith({
    String? id,
    Value<String?> serverCursor = const Value.absent(),
    Value<DateTime?> lastSuccessfulSyncAt = const Value.absent(),
    Value<DateTime?> lastAttemptAt = const Value.absent(),
    Value<DateTime?> lastFailureAt = const Value.absent(),
    String? status,
    Value<int?> pendingPushCount = const Value.absent(),
  }) => SyncMetadataEntry(
    id: id ?? this.id,
    serverCursor: serverCursor.present ? serverCursor.value : this.serverCursor,
    lastSuccessfulSyncAt: lastSuccessfulSyncAt.present
        ? lastSuccessfulSyncAt.value
        : this.lastSuccessfulSyncAt,
    lastAttemptAt: lastAttemptAt.present
        ? lastAttemptAt.value
        : this.lastAttemptAt,
    lastFailureAt: lastFailureAt.present
        ? lastFailureAt.value
        : this.lastFailureAt,
    status: status ?? this.status,
    pendingPushCount: pendingPushCount.present
        ? pendingPushCount.value
        : this.pendingPushCount,
  );
  SyncMetadataEntry copyWithCompanion(SyncMetadataEntriesCompanion data) {
    return SyncMetadataEntry(
      id: data.id.present ? data.id.value : this.id,
      serverCursor: data.serverCursor.present
          ? data.serverCursor.value
          : this.serverCursor,
      lastSuccessfulSyncAt: data.lastSuccessfulSyncAt.present
          ? data.lastSuccessfulSyncAt.value
          : this.lastSuccessfulSyncAt,
      lastAttemptAt: data.lastAttemptAt.present
          ? data.lastAttemptAt.value
          : this.lastAttemptAt,
      lastFailureAt: data.lastFailureAt.present
          ? data.lastFailureAt.value
          : this.lastFailureAt,
      status: data.status.present ? data.status.value : this.status,
      pendingPushCount: data.pendingPushCount.present
          ? data.pendingPushCount.value
          : this.pendingPushCount,
    );
  }

  @override
  String toString() {
    return (StringBuffer('SyncMetadataEntry(')
          ..write('id: $id, ')
          ..write('serverCursor: $serverCursor, ')
          ..write('lastSuccessfulSyncAt: $lastSuccessfulSyncAt, ')
          ..write('lastAttemptAt: $lastAttemptAt, ')
          ..write('lastFailureAt: $lastFailureAt, ')
          ..write('status: $status, ')
          ..write('pendingPushCount: $pendingPushCount')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    serverCursor,
    lastSuccessfulSyncAt,
    lastAttemptAt,
    lastFailureAt,
    status,
    pendingPushCount,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is SyncMetadataEntry &&
          other.id == this.id &&
          other.serverCursor == this.serverCursor &&
          other.lastSuccessfulSyncAt == this.lastSuccessfulSyncAt &&
          other.lastAttemptAt == this.lastAttemptAt &&
          other.lastFailureAt == this.lastFailureAt &&
          other.status == this.status &&
          other.pendingPushCount == this.pendingPushCount);
}

class SyncMetadataEntriesCompanion extends UpdateCompanion<SyncMetadataEntry> {
  final Value<String> id;
  final Value<String?> serverCursor;
  final Value<DateTime?> lastSuccessfulSyncAt;
  final Value<DateTime?> lastAttemptAt;
  final Value<DateTime?> lastFailureAt;
  final Value<String> status;
  final Value<int?> pendingPushCount;
  final Value<int> rowid;
  const SyncMetadataEntriesCompanion({
    this.id = const Value.absent(),
    this.serverCursor = const Value.absent(),
    this.lastSuccessfulSyncAt = const Value.absent(),
    this.lastAttemptAt = const Value.absent(),
    this.lastFailureAt = const Value.absent(),
    this.status = const Value.absent(),
    this.pendingPushCount = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  SyncMetadataEntriesCompanion.insert({
    this.id = const Value.absent(),
    this.serverCursor = const Value.absent(),
    this.lastSuccessfulSyncAt = const Value.absent(),
    this.lastAttemptAt = const Value.absent(),
    this.lastFailureAt = const Value.absent(),
    this.status = const Value.absent(),
    this.pendingPushCount = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  static Insertable<SyncMetadataEntry> custom({
    Expression<String>? id,
    Expression<String>? serverCursor,
    Expression<DateTime>? lastSuccessfulSyncAt,
    Expression<DateTime>? lastAttemptAt,
    Expression<DateTime>? lastFailureAt,
    Expression<String>? status,
    Expression<int>? pendingPushCount,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (serverCursor != null) 'server_cursor': serverCursor,
      if (lastSuccessfulSyncAt != null)
        'last_successful_sync_at': lastSuccessfulSyncAt,
      if (lastAttemptAt != null) 'last_attempt_at': lastAttemptAt,
      if (lastFailureAt != null) 'last_failure_at': lastFailureAt,
      if (status != null) 'status': status,
      if (pendingPushCount != null) 'pending_push_count': pendingPushCount,
      if (rowid != null) 'rowid': rowid,
    });
  }

  SyncMetadataEntriesCompanion copyWith({
    Value<String>? id,
    Value<String?>? serverCursor,
    Value<DateTime?>? lastSuccessfulSyncAt,
    Value<DateTime?>? lastAttemptAt,
    Value<DateTime?>? lastFailureAt,
    Value<String>? status,
    Value<int?>? pendingPushCount,
    Value<int>? rowid,
  }) {
    return SyncMetadataEntriesCompanion(
      id: id ?? this.id,
      serverCursor: serverCursor ?? this.serverCursor,
      lastSuccessfulSyncAt: lastSuccessfulSyncAt ?? this.lastSuccessfulSyncAt,
      lastAttemptAt: lastAttemptAt ?? this.lastAttemptAt,
      lastFailureAt: lastFailureAt ?? this.lastFailureAt,
      status: status ?? this.status,
      pendingPushCount: pendingPushCount ?? this.pendingPushCount,
      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 (serverCursor.present) {
      map['server_cursor'] = Variable<String>(serverCursor.value);
    }
    if (lastSuccessfulSyncAt.present) {
      map['last_successful_sync_at'] = Variable<DateTime>(
        lastSuccessfulSyncAt.value,
      );
    }
    if (lastAttemptAt.present) {
      map['last_attempt_at'] = Variable<DateTime>(lastAttemptAt.value);
    }
    if (lastFailureAt.present) {
      map['last_failure_at'] = Variable<DateTime>(lastFailureAt.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (pendingPushCount.present) {
      map['pending_push_count'] = Variable<int>(pendingPushCount.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('SyncMetadataEntriesCompanion(')
          ..write('id: $id, ')
          ..write('serverCursor: $serverCursor, ')
          ..write('lastSuccessfulSyncAt: $lastSuccessfulSyncAt, ')
          ..write('lastAttemptAt: $lastAttemptAt, ')
          ..write('lastFailureAt: $lastFailureAt, ')
          ..write('status: $status, ')
          ..write('pendingPushCount: $pendingPushCount, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $WorkoutHistoriesTable extends WorkoutHistories
    with TableInfo<$WorkoutHistoriesTable, WorkoutHistory> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutHistoriesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _sourceWorkoutTemplateIdMeta =
      const VerificationMeta('sourceWorkoutTemplateId');
  @override
  late final GeneratedColumn<String> sourceWorkoutTemplateId =
      GeneratedColumn<String>(
        'source_workout_template_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES workout_templates (id)',
        ),
      );
  static const VerificationMeta _sourceActiveWorkoutSessionIdMeta =
      const VerificationMeta('sourceActiveWorkoutSessionId');
  @override
  late final GeneratedColumn<String> sourceActiveWorkoutSessionId =
      GeneratedColumn<String>(
        'source_active_workout_session_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES active_workout_sessions (id)',
        ),
      );
  static const VerificationMeta _nameSnapshotMeta = const VerificationMeta(
    'nameSnapshot',
  );
  @override
  late final GeneratedColumn<String> nameSnapshot = GeneratedColumn<String>(
    'name_snapshot',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _endedAtMeta = const VerificationMeta(
    'endedAt',
  );
  @override
  late final GeneratedColumn<DateTime> endedAt = GeneratedColumn<DateTime>(
    'ended_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _totalActiveMsMeta = const VerificationMeta(
    'totalActiveMs',
  );
  @override
  late final GeneratedColumn<int> totalActiveMs = GeneratedColumn<int>(
    'total_active_ms',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _completedMeta = const VerificationMeta(
    'completed',
  );
  @override
  late final GeneratedColumn<bool> completed = GeneratedColumn<bool>(
    'completed',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("completed" IN (0, 1))',
    ),
  );
  static const VerificationMeta _historySnapshotJsonMeta =
      const VerificationMeta('historySnapshotJson');
  @override
  late final GeneratedColumn<String> historySnapshotJson =
      GeneratedColumn<String>(
        'history_snapshot_json',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    sourceWorkoutTemplateId,
    sourceActiveWorkoutSessionId,
    nameSnapshot,
    startedAt,
    endedAt,
    totalActiveMs,
    completed,
    historySnapshotJson,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_history';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutHistory> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('source_workout_template_id')) {
      context.handle(
        _sourceWorkoutTemplateIdMeta,
        sourceWorkoutTemplateId.isAcceptableOrUnknown(
          data['source_workout_template_id']!,
          _sourceWorkoutTemplateIdMeta,
        ),
      );
    }
    if (data.containsKey('source_active_workout_session_id')) {
      context.handle(
        _sourceActiveWorkoutSessionIdMeta,
        sourceActiveWorkoutSessionId.isAcceptableOrUnknown(
          data['source_active_workout_session_id']!,
          _sourceActiveWorkoutSessionIdMeta,
        ),
      );
    }
    if (data.containsKey('name_snapshot')) {
      context.handle(
        _nameSnapshotMeta,
        nameSnapshot.isAcceptableOrUnknown(
          data['name_snapshot']!,
          _nameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_nameSnapshotMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_startedAtMeta);
    }
    if (data.containsKey('ended_at')) {
      context.handle(
        _endedAtMeta,
        endedAt.isAcceptableOrUnknown(data['ended_at']!, _endedAtMeta),
      );
    } else if (isInserting) {
      context.missing(_endedAtMeta);
    }
    if (data.containsKey('total_active_ms')) {
      context.handle(
        _totalActiveMsMeta,
        totalActiveMs.isAcceptableOrUnknown(
          data['total_active_ms']!,
          _totalActiveMsMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_totalActiveMsMeta);
    }
    if (data.containsKey('completed')) {
      context.handle(
        _completedMeta,
        completed.isAcceptableOrUnknown(data['completed']!, _completedMeta),
      );
    } else if (isInserting) {
      context.missing(_completedMeta);
    }
    if (data.containsKey('history_snapshot_json')) {
      context.handle(
        _historySnapshotJsonMeta,
        historySnapshotJson.isAcceptableOrUnknown(
          data['history_snapshot_json']!,
          _historySnapshotJsonMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_historySnapshotJsonMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutHistory map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutHistory(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      sourceWorkoutTemplateId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_workout_template_id'],
      ),
      sourceActiveWorkoutSessionId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_active_workout_session_id'],
      ),
      nameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name_snapshot'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      )!,
      endedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}ended_at'],
      )!,
      totalActiveMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}total_active_ms'],
      )!,
      completed: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}completed'],
      )!,
      historySnapshotJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}history_snapshot_json'],
      )!,
    );
  }

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

class WorkoutHistory extends DataClass implements Insertable<WorkoutHistory> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String? sourceWorkoutTemplateId;
  final String? sourceActiveWorkoutSessionId;
  final String nameSnapshot;
  final DateTime startedAt;
  final DateTime endedAt;
  final int totalActiveMs;
  final bool completed;
  final String historySnapshotJson;
  const WorkoutHistory({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    this.sourceWorkoutTemplateId,
    this.sourceActiveWorkoutSessionId,
    required this.nameSnapshot,
    required this.startedAt,
    required this.endedAt,
    required this.totalActiveMs,
    required this.completed,
    required this.historySnapshotJson,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    if (!nullToAbsent || sourceWorkoutTemplateId != null) {
      map['source_workout_template_id'] = Variable<String>(
        sourceWorkoutTemplateId,
      );
    }
    if (!nullToAbsent || sourceActiveWorkoutSessionId != null) {
      map['source_active_workout_session_id'] = Variable<String>(
        sourceActiveWorkoutSessionId,
      );
    }
    map['name_snapshot'] = Variable<String>(nameSnapshot);
    map['started_at'] = Variable<DateTime>(startedAt);
    map['ended_at'] = Variable<DateTime>(endedAt);
    map['total_active_ms'] = Variable<int>(totalActiveMs);
    map['completed'] = Variable<bool>(completed);
    map['history_snapshot_json'] = Variable<String>(historySnapshotJson);
    return map;
  }

  WorkoutHistoriesCompanion toCompanion(bool nullToAbsent) {
    return WorkoutHistoriesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      sourceWorkoutTemplateId: sourceWorkoutTemplateId == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceWorkoutTemplateId),
      sourceActiveWorkoutSessionId:
          sourceActiveWorkoutSessionId == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceActiveWorkoutSessionId),
      nameSnapshot: Value(nameSnapshot),
      startedAt: Value(startedAt),
      endedAt: Value(endedAt),
      totalActiveMs: Value(totalActiveMs),
      completed: Value(completed),
      historySnapshotJson: Value(historySnapshotJson),
    );
  }

  factory WorkoutHistory.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutHistory(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      sourceWorkoutTemplateId: serializer.fromJson<String?>(
        json['sourceWorkoutTemplateId'],
      ),
      sourceActiveWorkoutSessionId: serializer.fromJson<String?>(
        json['sourceActiveWorkoutSessionId'],
      ),
      nameSnapshot: serializer.fromJson<String>(json['nameSnapshot']),
      startedAt: serializer.fromJson<DateTime>(json['startedAt']),
      endedAt: serializer.fromJson<DateTime>(json['endedAt']),
      totalActiveMs: serializer.fromJson<int>(json['totalActiveMs']),
      completed: serializer.fromJson<bool>(json['completed']),
      historySnapshotJson: serializer.fromJson<String>(
        json['historySnapshotJson'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'sourceWorkoutTemplateId': serializer.toJson<String?>(
        sourceWorkoutTemplateId,
      ),
      'sourceActiveWorkoutSessionId': serializer.toJson<String?>(
        sourceActiveWorkoutSessionId,
      ),
      'nameSnapshot': serializer.toJson<String>(nameSnapshot),
      'startedAt': serializer.toJson<DateTime>(startedAt),
      'endedAt': serializer.toJson<DateTime>(endedAt),
      'totalActiveMs': serializer.toJson<int>(totalActiveMs),
      'completed': serializer.toJson<bool>(completed),
      'historySnapshotJson': serializer.toJson<String>(historySnapshotJson),
    };
  }

  WorkoutHistory copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    Value<String?> sourceWorkoutTemplateId = const Value.absent(),
    Value<String?> sourceActiveWorkoutSessionId = const Value.absent(),
    String? nameSnapshot,
    DateTime? startedAt,
    DateTime? endedAt,
    int? totalActiveMs,
    bool? completed,
    String? historySnapshotJson,
  }) => WorkoutHistory(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    sourceWorkoutTemplateId: sourceWorkoutTemplateId.present
        ? sourceWorkoutTemplateId.value
        : this.sourceWorkoutTemplateId,
    sourceActiveWorkoutSessionId: sourceActiveWorkoutSessionId.present
        ? sourceActiveWorkoutSessionId.value
        : this.sourceActiveWorkoutSessionId,
    nameSnapshot: nameSnapshot ?? this.nameSnapshot,
    startedAt: startedAt ?? this.startedAt,
    endedAt: endedAt ?? this.endedAt,
    totalActiveMs: totalActiveMs ?? this.totalActiveMs,
    completed: completed ?? this.completed,
    historySnapshotJson: historySnapshotJson ?? this.historySnapshotJson,
  );
  WorkoutHistory copyWithCompanion(WorkoutHistoriesCompanion data) {
    return WorkoutHistory(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      sourceWorkoutTemplateId: data.sourceWorkoutTemplateId.present
          ? data.sourceWorkoutTemplateId.value
          : this.sourceWorkoutTemplateId,
      sourceActiveWorkoutSessionId: data.sourceActiveWorkoutSessionId.present
          ? data.sourceActiveWorkoutSessionId.value
          : this.sourceActiveWorkoutSessionId,
      nameSnapshot: data.nameSnapshot.present
          ? data.nameSnapshot.value
          : this.nameSnapshot,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      endedAt: data.endedAt.present ? data.endedAt.value : this.endedAt,
      totalActiveMs: data.totalActiveMs.present
          ? data.totalActiveMs.value
          : this.totalActiveMs,
      completed: data.completed.present ? data.completed.value : this.completed,
      historySnapshotJson: data.historySnapshotJson.present
          ? data.historySnapshotJson.value
          : this.historySnapshotJson,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistory(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('sourceWorkoutTemplateId: $sourceWorkoutTemplateId, ')
          ..write(
            'sourceActiveWorkoutSessionId: $sourceActiveWorkoutSessionId, ',
          )
          ..write('nameSnapshot: $nameSnapshot, ')
          ..write('startedAt: $startedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('totalActiveMs: $totalActiveMs, ')
          ..write('completed: $completed, ')
          ..write('historySnapshotJson: $historySnapshotJson')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    sourceWorkoutTemplateId,
    sourceActiveWorkoutSessionId,
    nameSnapshot,
    startedAt,
    endedAt,
    totalActiveMs,
    completed,
    historySnapshotJson,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutHistory &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.sourceWorkoutTemplateId == this.sourceWorkoutTemplateId &&
          other.sourceActiveWorkoutSessionId ==
              this.sourceActiveWorkoutSessionId &&
          other.nameSnapshot == this.nameSnapshot &&
          other.startedAt == this.startedAt &&
          other.endedAt == this.endedAt &&
          other.totalActiveMs == this.totalActiveMs &&
          other.completed == this.completed &&
          other.historySnapshotJson == this.historySnapshotJson);
}

class WorkoutHistoriesCompanion extends UpdateCompanion<WorkoutHistory> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String?> sourceWorkoutTemplateId;
  final Value<String?> sourceActiveWorkoutSessionId;
  final Value<String> nameSnapshot;
  final Value<DateTime> startedAt;
  final Value<DateTime> endedAt;
  final Value<int> totalActiveMs;
  final Value<bool> completed;
  final Value<String> historySnapshotJson;
  final Value<int> rowid;
  const WorkoutHistoriesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.sourceWorkoutTemplateId = const Value.absent(),
    this.sourceActiveWorkoutSessionId = const Value.absent(),
    this.nameSnapshot = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.endedAt = const Value.absent(),
    this.totalActiveMs = const Value.absent(),
    this.completed = const Value.absent(),
    this.historySnapshotJson = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutHistoriesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.sourceWorkoutTemplateId = const Value.absent(),
    this.sourceActiveWorkoutSessionId = const Value.absent(),
    required String nameSnapshot,
    required DateTime startedAt,
    required DateTime endedAt,
    required int totalActiveMs,
    required bool completed,
    required String historySnapshotJson,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       nameSnapshot = Value(nameSnapshot),
       startedAt = Value(startedAt),
       endedAt = Value(endedAt),
       totalActiveMs = Value(totalActiveMs),
       completed = Value(completed),
       historySnapshotJson = Value(historySnapshotJson);
  static Insertable<WorkoutHistory> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? sourceWorkoutTemplateId,
    Expression<String>? sourceActiveWorkoutSessionId,
    Expression<String>? nameSnapshot,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? endedAt,
    Expression<int>? totalActiveMs,
    Expression<bool>? completed,
    Expression<String>? historySnapshotJson,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (sourceWorkoutTemplateId != null)
        'source_workout_template_id': sourceWorkoutTemplateId,
      if (sourceActiveWorkoutSessionId != null)
        'source_active_workout_session_id': sourceActiveWorkoutSessionId,
      if (nameSnapshot != null) 'name_snapshot': nameSnapshot,
      if (startedAt != null) 'started_at': startedAt,
      if (endedAt != null) 'ended_at': endedAt,
      if (totalActiveMs != null) 'total_active_ms': totalActiveMs,
      if (completed != null) 'completed': completed,
      if (historySnapshotJson != null)
        'history_snapshot_json': historySnapshotJson,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutHistoriesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String?>? sourceWorkoutTemplateId,
    Value<String?>? sourceActiveWorkoutSessionId,
    Value<String>? nameSnapshot,
    Value<DateTime>? startedAt,
    Value<DateTime>? endedAt,
    Value<int>? totalActiveMs,
    Value<bool>? completed,
    Value<String>? historySnapshotJson,
    Value<int>? rowid,
  }) {
    return WorkoutHistoriesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      sourceWorkoutTemplateId:
          sourceWorkoutTemplateId ?? this.sourceWorkoutTemplateId,
      sourceActiveWorkoutSessionId:
          sourceActiveWorkoutSessionId ?? this.sourceActiveWorkoutSessionId,
      nameSnapshot: nameSnapshot ?? this.nameSnapshot,
      startedAt: startedAt ?? this.startedAt,
      endedAt: endedAt ?? this.endedAt,
      totalActiveMs: totalActiveMs ?? this.totalActiveMs,
      completed: completed ?? this.completed,
      historySnapshotJson: historySnapshotJson ?? this.historySnapshotJson,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (sourceWorkoutTemplateId.present) {
      map['source_workout_template_id'] = Variable<String>(
        sourceWorkoutTemplateId.value,
      );
    }
    if (sourceActiveWorkoutSessionId.present) {
      map['source_active_workout_session_id'] = Variable<String>(
        sourceActiveWorkoutSessionId.value,
      );
    }
    if (nameSnapshot.present) {
      map['name_snapshot'] = Variable<String>(nameSnapshot.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (endedAt.present) {
      map['ended_at'] = Variable<DateTime>(endedAt.value);
    }
    if (totalActiveMs.present) {
      map['total_active_ms'] = Variable<int>(totalActiveMs.value);
    }
    if (completed.present) {
      map['completed'] = Variable<bool>(completed.value);
    }
    if (historySnapshotJson.present) {
      map['history_snapshot_json'] = Variable<String>(
        historySnapshotJson.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistoriesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('sourceWorkoutTemplateId: $sourceWorkoutTemplateId, ')
          ..write(
            'sourceActiveWorkoutSessionId: $sourceActiveWorkoutSessionId, ',
          )
          ..write('nameSnapshot: $nameSnapshot, ')
          ..write('startedAt: $startedAt, ')
          ..write('endedAt: $endedAt, ')
          ..write('totalActiveMs: $totalActiveMs, ')
          ..write('completed: $completed, ')
          ..write('historySnapshotJson: $historySnapshotJson, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $WorkoutHistorySetResultsTable extends WorkoutHistorySetResults
    with TableInfo<$WorkoutHistorySetResultsTable, WorkoutHistorySetResult> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutHistorySetResultsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _workoutHistoryIdMeta = const VerificationMeta(
    'workoutHistoryId',
  );
  @override
  late final GeneratedColumn<String> workoutHistoryId = GeneratedColumn<String>(
    'workout_history_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES workout_history (id)',
    ),
  );
  static const VerificationMeta _programSnapshotIdMeta = const VerificationMeta(
    'programSnapshotId',
  );
  @override
  late final GeneratedColumn<String> programSnapshotId =
      GeneratedColumn<String>(
        'program_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseSnapshotIdMeta =
      const VerificationMeta('exerciseSnapshotId');
  @override
  late final GeneratedColumn<String> exerciseSnapshotId =
      GeneratedColumn<String>(
        'exercise_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _programNameSnapshotMeta =
      const VerificationMeta('programNameSnapshot');
  @override
  late final GeneratedColumn<String> programNameSnapshot =
      GeneratedColumn<String>(
        'program_name_snapshot',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseNameSnapshotMeta =
      const VerificationMeta('exerciseNameSnapshot');
  @override
  late final GeneratedColumn<String> exerciseNameSnapshot =
      GeneratedColumn<String>(
        'exercise_name_snapshot',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _timeEnabledSnapshotMeta =
      const VerificationMeta('timeEnabledSnapshot');
  @override
  late final GeneratedColumn<bool> timeEnabledSnapshot = GeneratedColumn<bool>(
    'time_enabled_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("time_enabled_snapshot" IN (0, 1))',
    ),
  );
  static const VerificationMeta _repsEnabledSnapshotMeta =
      const VerificationMeta('repsEnabledSnapshot');
  @override
  late final GeneratedColumn<bool> repsEnabledSnapshot = GeneratedColumn<bool>(
    'reps_enabled_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("reps_enabled_snapshot" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreEnabledSnapshotMeta =
      const VerificationMeta('scoreEnabledSnapshot');
  @override
  late final GeneratedColumn<bool> scoreEnabledSnapshot = GeneratedColumn<bool>(
    'score_enabled_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("score_enabled_snapshot" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreInputModeSnapshotMeta =
      const VerificationMeta('scoreInputModeSnapshot');
  @override
  late final GeneratedColumn<String> scoreInputModeSnapshot =
      GeneratedColumn<String>(
        'score_input_mode_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
        defaultValue: const Constant('manual'),
      );
  static const VerificationMeta _targetTimeSecondsSnapshotMeta =
      const VerificationMeta('targetTimeSecondsSnapshot');
  @override
  late final GeneratedColumn<int> targetTimeSecondsSnapshot =
      GeneratedColumn<int>(
        'target_time_seconds_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetRepsSnapshotMeta =
      const VerificationMeta('targetRepsSnapshot');
  @override
  late final GeneratedColumn<int> targetRepsSnapshot = GeneratedColumn<int>(
    'target_reps_snapshot',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetScoreSnapshotMeta =
      const VerificationMeta('targetScoreSnapshot');
  @override
  late final GeneratedColumn<double> targetScoreSnapshot =
      GeneratedColumn<double>(
        'target_score_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreTimeMsSnapshotMeta =
      const VerificationMeta('targetScoreTimeMsSnapshot');
  @override
  late final GeneratedColumn<int> targetScoreTimeMsSnapshot =
      GeneratedColumn<int>(
        'target_score_time_ms_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _actualTimeMsMeta = const VerificationMeta(
    'actualTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualTimeMs = GeneratedColumn<int>(
    'actual_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualRepsMeta = const VerificationMeta(
    'actualReps',
  );
  @override
  late final GeneratedColumn<int> actualReps = GeneratedColumn<int>(
    'actual_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreMeta = const VerificationMeta(
    'actualScore',
  );
  @override
  late final GeneratedColumn<double> actualScore = GeneratedColumn<double>(
    'actual_score',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreTimeMsMeta = const VerificationMeta(
    'actualScoreTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualScoreTimeMs = GeneratedColumn<int>(
    'actual_score_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _scoreLabelSnapshotMeta =
      const VerificationMeta('scoreLabelSnapshot');
  @override
  late final GeneratedColumn<String> scoreLabelSnapshot =
      GeneratedColumn<String>(
        'score_label_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreUnitSnapshotMeta = const VerificationMeta(
    'scoreUnitSnapshot',
  );
  @override
  late final GeneratedColumn<String> scoreUnitSnapshot =
      GeneratedColumn<String>(
        'score_unit_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _sourceExerciseIdSnapshotMeta =
      const VerificationMeta('sourceExerciseIdSnapshot');
  @override
  late final GeneratedColumn<String> sourceExerciseIdSnapshot =
      GeneratedColumn<String>(
        'source_exercise_id_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _completedAtMeta = const VerificationMeta(
    'completedAt',
  );
  @override
  late final GeneratedColumn<DateTime> completedAt = GeneratedColumn<DateTime>(
    'completed_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultValue: const Constant('completed'),
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutHistoryId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    programNameSnapshot,
    exerciseNameSnapshot,
    timeEnabledSnapshot,
    repsEnabledSnapshot,
    scoreEnabledSnapshot,
    scoreInputModeSnapshot,
    targetTimeSecondsSnapshot,
    targetRepsSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    sourceExerciseIdSnapshot,
    startedAt,
    completedAt,
    status,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_history_set_results';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutHistorySetResult> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('workout_history_id')) {
      context.handle(
        _workoutHistoryIdMeta,
        workoutHistoryId.isAcceptableOrUnknown(
          data['workout_history_id']!,
          _workoutHistoryIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_workoutHistoryIdMeta);
    }
    if (data.containsKey('program_snapshot_id')) {
      context.handle(
        _programSnapshotIdMeta,
        programSnapshotId.isAcceptableOrUnknown(
          data['program_snapshot_id']!,
          _programSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programSnapshotIdMeta);
    }
    if (data.containsKey('exercise_snapshot_id')) {
      context.handle(
        _exerciseSnapshotIdMeta,
        exerciseSnapshotId.isAcceptableOrUnknown(
          data['exercise_snapshot_id']!,
          _exerciseSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseSnapshotIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('program_name_snapshot')) {
      context.handle(
        _programNameSnapshotMeta,
        programNameSnapshot.isAcceptableOrUnknown(
          data['program_name_snapshot']!,
          _programNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programNameSnapshotMeta);
    }
    if (data.containsKey('exercise_name_snapshot')) {
      context.handle(
        _exerciseNameSnapshotMeta,
        exerciseNameSnapshot.isAcceptableOrUnknown(
          data['exercise_name_snapshot']!,
          _exerciseNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseNameSnapshotMeta);
    }
    if (data.containsKey('time_enabled_snapshot')) {
      context.handle(
        _timeEnabledSnapshotMeta,
        timeEnabledSnapshot.isAcceptableOrUnknown(
          data['time_enabled_snapshot']!,
          _timeEnabledSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_timeEnabledSnapshotMeta);
    }
    if (data.containsKey('reps_enabled_snapshot')) {
      context.handle(
        _repsEnabledSnapshotMeta,
        repsEnabledSnapshot.isAcceptableOrUnknown(
          data['reps_enabled_snapshot']!,
          _repsEnabledSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_repsEnabledSnapshotMeta);
    }
    if (data.containsKey('score_enabled_snapshot')) {
      context.handle(
        _scoreEnabledSnapshotMeta,
        scoreEnabledSnapshot.isAcceptableOrUnknown(
          data['score_enabled_snapshot']!,
          _scoreEnabledSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_scoreEnabledSnapshotMeta);
    }
    if (data.containsKey('score_input_mode_snapshot')) {
      context.handle(
        _scoreInputModeSnapshotMeta,
        scoreInputModeSnapshot.isAcceptableOrUnknown(
          data['score_input_mode_snapshot']!,
          _scoreInputModeSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_time_seconds_snapshot')) {
      context.handle(
        _targetTimeSecondsSnapshotMeta,
        targetTimeSecondsSnapshot.isAcceptableOrUnknown(
          data['target_time_seconds_snapshot']!,
          _targetTimeSecondsSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_reps_snapshot')) {
      context.handle(
        _targetRepsSnapshotMeta,
        targetRepsSnapshot.isAcceptableOrUnknown(
          data['target_reps_snapshot']!,
          _targetRepsSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_snapshot')) {
      context.handle(
        _targetScoreSnapshotMeta,
        targetScoreSnapshot.isAcceptableOrUnknown(
          data['target_score_snapshot']!,
          _targetScoreSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_time_ms_snapshot')) {
      context.handle(
        _targetScoreTimeMsSnapshotMeta,
        targetScoreTimeMsSnapshot.isAcceptableOrUnknown(
          data['target_score_time_ms_snapshot']!,
          _targetScoreTimeMsSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('actual_time_ms')) {
      context.handle(
        _actualTimeMsMeta,
        actualTimeMs.isAcceptableOrUnknown(
          data['actual_time_ms']!,
          _actualTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('actual_reps')) {
      context.handle(
        _actualRepsMeta,
        actualReps.isAcceptableOrUnknown(data['actual_reps']!, _actualRepsMeta),
      );
    }
    if (data.containsKey('actual_score')) {
      context.handle(
        _actualScoreMeta,
        actualScore.isAcceptableOrUnknown(
          data['actual_score']!,
          _actualScoreMeta,
        ),
      );
    }
    if (data.containsKey('actual_score_time_ms')) {
      context.handle(
        _actualScoreTimeMsMeta,
        actualScoreTimeMs.isAcceptableOrUnknown(
          data['actual_score_time_ms']!,
          _actualScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('score_label_snapshot')) {
      context.handle(
        _scoreLabelSnapshotMeta,
        scoreLabelSnapshot.isAcceptableOrUnknown(
          data['score_label_snapshot']!,
          _scoreLabelSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_unit_snapshot')) {
      context.handle(
        _scoreUnitSnapshotMeta,
        scoreUnitSnapshot.isAcceptableOrUnknown(
          data['score_unit_snapshot']!,
          _scoreUnitSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('source_exercise_id_snapshot')) {
      context.handle(
        _sourceExerciseIdSnapshotMeta,
        sourceExerciseIdSnapshot.isAcceptableOrUnknown(
          data['source_exercise_id_snapshot']!,
          _sourceExerciseIdSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('completed_at')) {
      context.handle(
        _completedAtMeta,
        completedAt.isAcceptableOrUnknown(
          data['completed_at']!,
          _completedAtMeta,
        ),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutHistorySetResult map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutHistorySetResult(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      workoutHistoryId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}workout_history_id'],
      )!,
      programSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_snapshot_id'],
      )!,
      exerciseSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_snapshot_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      programNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_name_snapshot'],
      )!,
      exerciseNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_name_snapshot'],
      )!,
      timeEnabledSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}time_enabled_snapshot'],
      )!,
      repsEnabledSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}reps_enabled_snapshot'],
      )!,
      scoreEnabledSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}score_enabled_snapshot'],
      )!,
      scoreInputModeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode_snapshot'],
      )!,
      targetTimeSecondsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_time_seconds_snapshot'],
      ),
      targetRepsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_reps_snapshot'],
      ),
      targetScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}target_score_snapshot'],
      ),
      targetScoreTimeMsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_score_time_ms_snapshot'],
      ),
      actualTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_time_ms'],
      ),
      actualReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_reps'],
      ),
      actualScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}actual_score'],
      ),
      actualScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_score_time_ms'],
      ),
      scoreLabelSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label_snapshot'],
      ),
      scoreUnitSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit_snapshot'],
      ),
      sourceExerciseIdSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_exercise_id_snapshot'],
      ),
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      completedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}completed_at'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
    );
  }

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

class WorkoutHistorySetResult extends DataClass
    implements Insertable<WorkoutHistorySetResult> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String workoutHistoryId;
  final String programSnapshotId;
  final String exerciseSnapshotId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final String programNameSnapshot;
  final String exerciseNameSnapshot;
  final bool timeEnabledSnapshot;
  final bool repsEnabledSnapshot;
  final bool scoreEnabledSnapshot;
  final String scoreInputModeSnapshot;
  final int? targetTimeSecondsSnapshot;
  final int? targetRepsSnapshot;
  final double? targetScoreSnapshot;
  final int? targetScoreTimeMsSnapshot;
  final int? actualTimeMs;
  final int? actualReps;
  final double? actualScore;
  final int? actualScoreTimeMs;
  final String? scoreLabelSnapshot;
  final String? scoreUnitSnapshot;
  final String? sourceExerciseIdSnapshot;
  final DateTime? startedAt;
  final DateTime? completedAt;
  final String status;
  const WorkoutHistorySetResult({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.workoutHistoryId,
    required this.programSnapshotId,
    required this.exerciseSnapshotId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.programNameSnapshot,
    required this.exerciseNameSnapshot,
    required this.timeEnabledSnapshot,
    required this.repsEnabledSnapshot,
    required this.scoreEnabledSnapshot,
    required this.scoreInputModeSnapshot,
    this.targetTimeSecondsSnapshot,
    this.targetRepsSnapshot,
    this.targetScoreSnapshot,
    this.targetScoreTimeMsSnapshot,
    this.actualTimeMs,
    this.actualReps,
    this.actualScore,
    this.actualScoreTimeMs,
    this.scoreLabelSnapshot,
    this.scoreUnitSnapshot,
    this.sourceExerciseIdSnapshot,
    this.startedAt,
    this.completedAt,
    required this.status,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['workout_history_id'] = Variable<String>(workoutHistoryId);
    map['program_snapshot_id'] = Variable<String>(programSnapshotId);
    map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['program_name_snapshot'] = Variable<String>(programNameSnapshot);
    map['exercise_name_snapshot'] = Variable<String>(exerciseNameSnapshot);
    map['time_enabled_snapshot'] = Variable<bool>(timeEnabledSnapshot);
    map['reps_enabled_snapshot'] = Variable<bool>(repsEnabledSnapshot);
    map['score_enabled_snapshot'] = Variable<bool>(scoreEnabledSnapshot);
    map['score_input_mode_snapshot'] = Variable<String>(scoreInputModeSnapshot);
    if (!nullToAbsent || targetTimeSecondsSnapshot != null) {
      map['target_time_seconds_snapshot'] = Variable<int>(
        targetTimeSecondsSnapshot,
      );
    }
    if (!nullToAbsent || targetRepsSnapshot != null) {
      map['target_reps_snapshot'] = Variable<int>(targetRepsSnapshot);
    }
    if (!nullToAbsent || targetScoreSnapshot != null) {
      map['target_score_snapshot'] = Variable<double>(targetScoreSnapshot);
    }
    if (!nullToAbsent || targetScoreTimeMsSnapshot != null) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot,
      );
    }
    if (!nullToAbsent || actualTimeMs != null) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs);
    }
    if (!nullToAbsent || actualReps != null) {
      map['actual_reps'] = Variable<int>(actualReps);
    }
    if (!nullToAbsent || actualScore != null) {
      map['actual_score'] = Variable<double>(actualScore);
    }
    if (!nullToAbsent || actualScoreTimeMs != null) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs);
    }
    if (!nullToAbsent || scoreLabelSnapshot != null) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot);
    }
    if (!nullToAbsent || scoreUnitSnapshot != null) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot);
    }
    if (!nullToAbsent || sourceExerciseIdSnapshot != null) {
      map['source_exercise_id_snapshot'] = Variable<String>(
        sourceExerciseIdSnapshot,
      );
    }
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    if (!nullToAbsent || completedAt != null) {
      map['completed_at'] = Variable<DateTime>(completedAt);
    }
    map['status'] = Variable<String>(status);
    return map;
  }

  WorkoutHistorySetResultsCompanion toCompanion(bool nullToAbsent) {
    return WorkoutHistorySetResultsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      workoutHistoryId: Value(workoutHistoryId),
      programSnapshotId: Value(programSnapshotId),
      exerciseSnapshotId: Value(exerciseSnapshotId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      programNameSnapshot: Value(programNameSnapshot),
      exerciseNameSnapshot: Value(exerciseNameSnapshot),
      timeEnabledSnapshot: Value(timeEnabledSnapshot),
      repsEnabledSnapshot: Value(repsEnabledSnapshot),
      scoreEnabledSnapshot: Value(scoreEnabledSnapshot),
      scoreInputModeSnapshot: Value(scoreInputModeSnapshot),
      targetTimeSecondsSnapshot:
          targetTimeSecondsSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetTimeSecondsSnapshot),
      targetRepsSnapshot: targetRepsSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetRepsSnapshot),
      targetScoreSnapshot: targetScoreSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreSnapshot),
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreTimeMsSnapshot),
      actualTimeMs: actualTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualTimeMs),
      actualReps: actualReps == null && nullToAbsent
          ? const Value.absent()
          : Value(actualReps),
      actualScore: actualScore == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScore),
      actualScoreTimeMs: actualScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScoreTimeMs),
      scoreLabelSnapshot: scoreLabelSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabelSnapshot),
      scoreUnitSnapshot: scoreUnitSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnitSnapshot),
      sourceExerciseIdSnapshot: sourceExerciseIdSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceExerciseIdSnapshot),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      completedAt: completedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(completedAt),
      status: Value(status),
    );
  }

  factory WorkoutHistorySetResult.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutHistorySetResult(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      workoutHistoryId: serializer.fromJson<String>(json['workoutHistoryId']),
      programSnapshotId: serializer.fromJson<String>(json['programSnapshotId']),
      exerciseSnapshotId: serializer.fromJson<String>(
        json['exerciseSnapshotId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      programNameSnapshot: serializer.fromJson<String>(
        json['programNameSnapshot'],
      ),
      exerciseNameSnapshot: serializer.fromJson<String>(
        json['exerciseNameSnapshot'],
      ),
      timeEnabledSnapshot: serializer.fromJson<bool>(
        json['timeEnabledSnapshot'],
      ),
      repsEnabledSnapshot: serializer.fromJson<bool>(
        json['repsEnabledSnapshot'],
      ),
      scoreEnabledSnapshot: serializer.fromJson<bool>(
        json['scoreEnabledSnapshot'],
      ),
      scoreInputModeSnapshot: serializer.fromJson<String>(
        json['scoreInputModeSnapshot'],
      ),
      targetTimeSecondsSnapshot: serializer.fromJson<int?>(
        json['targetTimeSecondsSnapshot'],
      ),
      targetRepsSnapshot: serializer.fromJson<int?>(json['targetRepsSnapshot']),
      targetScoreSnapshot: serializer.fromJson<double?>(
        json['targetScoreSnapshot'],
      ),
      targetScoreTimeMsSnapshot: serializer.fromJson<int?>(
        json['targetScoreTimeMsSnapshot'],
      ),
      actualTimeMs: serializer.fromJson<int?>(json['actualTimeMs']),
      actualReps: serializer.fromJson<int?>(json['actualReps']),
      actualScore: serializer.fromJson<double?>(json['actualScore']),
      actualScoreTimeMs: serializer.fromJson<int?>(json['actualScoreTimeMs']),
      scoreLabelSnapshot: serializer.fromJson<String?>(
        json['scoreLabelSnapshot'],
      ),
      scoreUnitSnapshot: serializer.fromJson<String?>(
        json['scoreUnitSnapshot'],
      ),
      sourceExerciseIdSnapshot: serializer.fromJson<String?>(
        json['sourceExerciseIdSnapshot'],
      ),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      completedAt: serializer.fromJson<DateTime?>(json['completedAt']),
      status: serializer.fromJson<String>(json['status']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'workoutHistoryId': serializer.toJson<String>(workoutHistoryId),
      'programSnapshotId': serializer.toJson<String>(programSnapshotId),
      'exerciseSnapshotId': serializer.toJson<String>(exerciseSnapshotId),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'programNameSnapshot': serializer.toJson<String>(programNameSnapshot),
      'exerciseNameSnapshot': serializer.toJson<String>(exerciseNameSnapshot),
      'timeEnabledSnapshot': serializer.toJson<bool>(timeEnabledSnapshot),
      'repsEnabledSnapshot': serializer.toJson<bool>(repsEnabledSnapshot),
      'scoreEnabledSnapshot': serializer.toJson<bool>(scoreEnabledSnapshot),
      'scoreInputModeSnapshot': serializer.toJson<String>(
        scoreInputModeSnapshot,
      ),
      'targetTimeSecondsSnapshot': serializer.toJson<int?>(
        targetTimeSecondsSnapshot,
      ),
      'targetRepsSnapshot': serializer.toJson<int?>(targetRepsSnapshot),
      'targetScoreSnapshot': serializer.toJson<double?>(targetScoreSnapshot),
      'targetScoreTimeMsSnapshot': serializer.toJson<int?>(
        targetScoreTimeMsSnapshot,
      ),
      'actualTimeMs': serializer.toJson<int?>(actualTimeMs),
      'actualReps': serializer.toJson<int?>(actualReps),
      'actualScore': serializer.toJson<double?>(actualScore),
      'actualScoreTimeMs': serializer.toJson<int?>(actualScoreTimeMs),
      'scoreLabelSnapshot': serializer.toJson<String?>(scoreLabelSnapshot),
      'scoreUnitSnapshot': serializer.toJson<String?>(scoreUnitSnapshot),
      'sourceExerciseIdSnapshot': serializer.toJson<String?>(
        sourceExerciseIdSnapshot,
      ),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'completedAt': serializer.toJson<DateTime?>(completedAt),
      'status': serializer.toJson<String>(status),
    };
  }

  WorkoutHistorySetResult copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? workoutHistoryId,
    String? programSnapshotId,
    String? exerciseSnapshotId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    String? programNameSnapshot,
    String? exerciseNameSnapshot,
    bool? timeEnabledSnapshot,
    bool? repsEnabledSnapshot,
    bool? scoreEnabledSnapshot,
    String? scoreInputModeSnapshot,
    Value<int?> targetTimeSecondsSnapshot = const Value.absent(),
    Value<int?> targetRepsSnapshot = const Value.absent(),
    Value<double?> targetScoreSnapshot = const Value.absent(),
    Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
    Value<int?> actualTimeMs = const Value.absent(),
    Value<int?> actualReps = const Value.absent(),
    Value<double?> actualScore = const Value.absent(),
    Value<int?> actualScoreTimeMs = const Value.absent(),
    Value<String?> scoreLabelSnapshot = const Value.absent(),
    Value<String?> scoreUnitSnapshot = const Value.absent(),
    Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
    Value<DateTime?> startedAt = const Value.absent(),
    Value<DateTime?> completedAt = const Value.absent(),
    String? status,
  }) => WorkoutHistorySetResult(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    workoutHistoryId: workoutHistoryId ?? this.workoutHistoryId,
    programSnapshotId: programSnapshotId ?? this.programSnapshotId,
    exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    programNameSnapshot: programNameSnapshot ?? this.programNameSnapshot,
    exerciseNameSnapshot: exerciseNameSnapshot ?? this.exerciseNameSnapshot,
    timeEnabledSnapshot: timeEnabledSnapshot ?? this.timeEnabledSnapshot,
    repsEnabledSnapshot: repsEnabledSnapshot ?? this.repsEnabledSnapshot,
    scoreEnabledSnapshot: scoreEnabledSnapshot ?? this.scoreEnabledSnapshot,
    scoreInputModeSnapshot:
        scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
    targetTimeSecondsSnapshot: targetTimeSecondsSnapshot.present
        ? targetTimeSecondsSnapshot.value
        : this.targetTimeSecondsSnapshot,
    targetRepsSnapshot: targetRepsSnapshot.present
        ? targetRepsSnapshot.value
        : this.targetRepsSnapshot,
    targetScoreSnapshot: targetScoreSnapshot.present
        ? targetScoreSnapshot.value
        : this.targetScoreSnapshot,
    targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot.present
        ? targetScoreTimeMsSnapshot.value
        : this.targetScoreTimeMsSnapshot,
    actualTimeMs: actualTimeMs.present ? actualTimeMs.value : this.actualTimeMs,
    actualReps: actualReps.present ? actualReps.value : this.actualReps,
    actualScore: actualScore.present ? actualScore.value : this.actualScore,
    actualScoreTimeMs: actualScoreTimeMs.present
        ? actualScoreTimeMs.value
        : this.actualScoreTimeMs,
    scoreLabelSnapshot: scoreLabelSnapshot.present
        ? scoreLabelSnapshot.value
        : this.scoreLabelSnapshot,
    scoreUnitSnapshot: scoreUnitSnapshot.present
        ? scoreUnitSnapshot.value
        : this.scoreUnitSnapshot,
    sourceExerciseIdSnapshot: sourceExerciseIdSnapshot.present
        ? sourceExerciseIdSnapshot.value
        : this.sourceExerciseIdSnapshot,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    completedAt: completedAt.present ? completedAt.value : this.completedAt,
    status: status ?? this.status,
  );
  WorkoutHistorySetResult copyWithCompanion(
    WorkoutHistorySetResultsCompanion data,
  ) {
    return WorkoutHistorySetResult(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      workoutHistoryId: data.workoutHistoryId.present
          ? data.workoutHistoryId.value
          : this.workoutHistoryId,
      programSnapshotId: data.programSnapshotId.present
          ? data.programSnapshotId.value
          : this.programSnapshotId,
      exerciseSnapshotId: data.exerciseSnapshotId.present
          ? data.exerciseSnapshotId.value
          : this.exerciseSnapshotId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      programNameSnapshot: data.programNameSnapshot.present
          ? data.programNameSnapshot.value
          : this.programNameSnapshot,
      exerciseNameSnapshot: data.exerciseNameSnapshot.present
          ? data.exerciseNameSnapshot.value
          : this.exerciseNameSnapshot,
      timeEnabledSnapshot: data.timeEnabledSnapshot.present
          ? data.timeEnabledSnapshot.value
          : this.timeEnabledSnapshot,
      repsEnabledSnapshot: data.repsEnabledSnapshot.present
          ? data.repsEnabledSnapshot.value
          : this.repsEnabledSnapshot,
      scoreEnabledSnapshot: data.scoreEnabledSnapshot.present
          ? data.scoreEnabledSnapshot.value
          : this.scoreEnabledSnapshot,
      scoreInputModeSnapshot: data.scoreInputModeSnapshot.present
          ? data.scoreInputModeSnapshot.value
          : this.scoreInputModeSnapshot,
      targetTimeSecondsSnapshot: data.targetTimeSecondsSnapshot.present
          ? data.targetTimeSecondsSnapshot.value
          : this.targetTimeSecondsSnapshot,
      targetRepsSnapshot: data.targetRepsSnapshot.present
          ? data.targetRepsSnapshot.value
          : this.targetRepsSnapshot,
      targetScoreSnapshot: data.targetScoreSnapshot.present
          ? data.targetScoreSnapshot.value
          : this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot: data.targetScoreTimeMsSnapshot.present
          ? data.targetScoreTimeMsSnapshot.value
          : this.targetScoreTimeMsSnapshot,
      actualTimeMs: data.actualTimeMs.present
          ? data.actualTimeMs.value
          : this.actualTimeMs,
      actualReps: data.actualReps.present
          ? data.actualReps.value
          : this.actualReps,
      actualScore: data.actualScore.present
          ? data.actualScore.value
          : this.actualScore,
      actualScoreTimeMs: data.actualScoreTimeMs.present
          ? data.actualScoreTimeMs.value
          : this.actualScoreTimeMs,
      scoreLabelSnapshot: data.scoreLabelSnapshot.present
          ? data.scoreLabelSnapshot.value
          : this.scoreLabelSnapshot,
      scoreUnitSnapshot: data.scoreUnitSnapshot.present
          ? data.scoreUnitSnapshot.value
          : this.scoreUnitSnapshot,
      sourceExerciseIdSnapshot: data.sourceExerciseIdSnapshot.present
          ? data.sourceExerciseIdSnapshot.value
          : this.sourceExerciseIdSnapshot,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      completedAt: data.completedAt.present
          ? data.completedAt.value
          : this.completedAt,
      status: data.status.present ? data.status.value : this.status,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistorySetResult(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutHistoryId: $workoutHistoryId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('programNameSnapshot: $programNameSnapshot, ')
          ..write('exerciseNameSnapshot: $exerciseNameSnapshot, ')
          ..write('timeEnabledSnapshot: $timeEnabledSnapshot, ')
          ..write('repsEnabledSnapshot: $repsEnabledSnapshot, ')
          ..write('scoreEnabledSnapshot: $scoreEnabledSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('targetTimeSecondsSnapshot: $targetTimeSecondsSnapshot, ')
          ..write('targetRepsSnapshot: $targetRepsSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('sourceExerciseIdSnapshot: $sourceExerciseIdSnapshot, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('status: $status')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutHistoryId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    programNameSnapshot,
    exerciseNameSnapshot,
    timeEnabledSnapshot,
    repsEnabledSnapshot,
    scoreEnabledSnapshot,
    scoreInputModeSnapshot,
    targetTimeSecondsSnapshot,
    targetRepsSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    sourceExerciseIdSnapshot,
    startedAt,
    completedAt,
    status,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutHistorySetResult &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.workoutHistoryId == this.workoutHistoryId &&
          other.programSnapshotId == this.programSnapshotId &&
          other.exerciseSnapshotId == this.exerciseSnapshotId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.programNameSnapshot == this.programNameSnapshot &&
          other.exerciseNameSnapshot == this.exerciseNameSnapshot &&
          other.timeEnabledSnapshot == this.timeEnabledSnapshot &&
          other.repsEnabledSnapshot == this.repsEnabledSnapshot &&
          other.scoreEnabledSnapshot == this.scoreEnabledSnapshot &&
          other.scoreInputModeSnapshot == this.scoreInputModeSnapshot &&
          other.targetTimeSecondsSnapshot == this.targetTimeSecondsSnapshot &&
          other.targetRepsSnapshot == this.targetRepsSnapshot &&
          other.targetScoreSnapshot == this.targetScoreSnapshot &&
          other.targetScoreTimeMsSnapshot == this.targetScoreTimeMsSnapshot &&
          other.actualTimeMs == this.actualTimeMs &&
          other.actualReps == this.actualReps &&
          other.actualScore == this.actualScore &&
          other.actualScoreTimeMs == this.actualScoreTimeMs &&
          other.scoreLabelSnapshot == this.scoreLabelSnapshot &&
          other.scoreUnitSnapshot == this.scoreUnitSnapshot &&
          other.sourceExerciseIdSnapshot == this.sourceExerciseIdSnapshot &&
          other.startedAt == this.startedAt &&
          other.completedAt == this.completedAt &&
          other.status == this.status);
}

class WorkoutHistorySetResultsCompanion
    extends UpdateCompanion<WorkoutHistorySetResult> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> workoutHistoryId;
  final Value<String> programSnapshotId;
  final Value<String> exerciseSnapshotId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<String> programNameSnapshot;
  final Value<String> exerciseNameSnapshot;
  final Value<bool> timeEnabledSnapshot;
  final Value<bool> repsEnabledSnapshot;
  final Value<bool> scoreEnabledSnapshot;
  final Value<String> scoreInputModeSnapshot;
  final Value<int?> targetTimeSecondsSnapshot;
  final Value<int?> targetRepsSnapshot;
  final Value<double?> targetScoreSnapshot;
  final Value<int?> targetScoreTimeMsSnapshot;
  final Value<int?> actualTimeMs;
  final Value<int?> actualReps;
  final Value<double?> actualScore;
  final Value<int?> actualScoreTimeMs;
  final Value<String?> scoreLabelSnapshot;
  final Value<String?> scoreUnitSnapshot;
  final Value<String?> sourceExerciseIdSnapshot;
  final Value<DateTime?> startedAt;
  final Value<DateTime?> completedAt;
  final Value<String> status;
  final Value<int> rowid;
  const WorkoutHistorySetResultsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.workoutHistoryId = const Value.absent(),
    this.programSnapshotId = const Value.absent(),
    this.exerciseSnapshotId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.programNameSnapshot = const Value.absent(),
    this.exerciseNameSnapshot = const Value.absent(),
    this.timeEnabledSnapshot = const Value.absent(),
    this.repsEnabledSnapshot = const Value.absent(),
    this.scoreEnabledSnapshot = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.targetTimeSecondsSnapshot = const Value.absent(),
    this.targetRepsSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.sourceExerciseIdSnapshot = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.status = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutHistorySetResultsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String workoutHistoryId,
    required String programSnapshotId,
    required String exerciseSnapshotId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required String programNameSnapshot,
    required String exerciseNameSnapshot,
    required bool timeEnabledSnapshot,
    required bool repsEnabledSnapshot,
    required bool scoreEnabledSnapshot,
    this.scoreInputModeSnapshot = const Value.absent(),
    this.targetTimeSecondsSnapshot = const Value.absent(),
    this.targetRepsSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.sourceExerciseIdSnapshot = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.status = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       workoutHistoryId = Value(workoutHistoryId),
       programSnapshotId = Value(programSnapshotId),
       exerciseSnapshotId = Value(exerciseSnapshotId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       programNameSnapshot = Value(programNameSnapshot),
       exerciseNameSnapshot = Value(exerciseNameSnapshot),
       timeEnabledSnapshot = Value(timeEnabledSnapshot),
       repsEnabledSnapshot = Value(repsEnabledSnapshot),
       scoreEnabledSnapshot = Value(scoreEnabledSnapshot);
  static Insertable<WorkoutHistorySetResult> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? workoutHistoryId,
    Expression<String>? programSnapshotId,
    Expression<String>? exerciseSnapshotId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<String>? programNameSnapshot,
    Expression<String>? exerciseNameSnapshot,
    Expression<bool>? timeEnabledSnapshot,
    Expression<bool>? repsEnabledSnapshot,
    Expression<bool>? scoreEnabledSnapshot,
    Expression<String>? scoreInputModeSnapshot,
    Expression<int>? targetTimeSecondsSnapshot,
    Expression<int>? targetRepsSnapshot,
    Expression<double>? targetScoreSnapshot,
    Expression<int>? targetScoreTimeMsSnapshot,
    Expression<int>? actualTimeMs,
    Expression<int>? actualReps,
    Expression<double>? actualScore,
    Expression<int>? actualScoreTimeMs,
    Expression<String>? scoreLabelSnapshot,
    Expression<String>? scoreUnitSnapshot,
    Expression<String>? sourceExerciseIdSnapshot,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? completedAt,
    Expression<String>? status,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (workoutHistoryId != null) 'workout_history_id': workoutHistoryId,
      if (programSnapshotId != null) 'program_snapshot_id': programSnapshotId,
      if (exerciseSnapshotId != null)
        'exercise_snapshot_id': exerciseSnapshotId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (programNameSnapshot != null)
        'program_name_snapshot': programNameSnapshot,
      if (exerciseNameSnapshot != null)
        'exercise_name_snapshot': exerciseNameSnapshot,
      if (timeEnabledSnapshot != null)
        'time_enabled_snapshot': timeEnabledSnapshot,
      if (repsEnabledSnapshot != null)
        'reps_enabled_snapshot': repsEnabledSnapshot,
      if (scoreEnabledSnapshot != null)
        'score_enabled_snapshot': scoreEnabledSnapshot,
      if (scoreInputModeSnapshot != null)
        'score_input_mode_snapshot': scoreInputModeSnapshot,
      if (targetTimeSecondsSnapshot != null)
        'target_time_seconds_snapshot': targetTimeSecondsSnapshot,
      if (targetRepsSnapshot != null)
        'target_reps_snapshot': targetRepsSnapshot,
      if (targetScoreSnapshot != null)
        'target_score_snapshot': targetScoreSnapshot,
      if (targetScoreTimeMsSnapshot != null)
        'target_score_time_ms_snapshot': targetScoreTimeMsSnapshot,
      if (actualTimeMs != null) 'actual_time_ms': actualTimeMs,
      if (actualReps != null) 'actual_reps': actualReps,
      if (actualScore != null) 'actual_score': actualScore,
      if (actualScoreTimeMs != null) 'actual_score_time_ms': actualScoreTimeMs,
      if (scoreLabelSnapshot != null)
        'score_label_snapshot': scoreLabelSnapshot,
      if (scoreUnitSnapshot != null) 'score_unit_snapshot': scoreUnitSnapshot,
      if (sourceExerciseIdSnapshot != null)
        'source_exercise_id_snapshot': sourceExerciseIdSnapshot,
      if (startedAt != null) 'started_at': startedAt,
      if (completedAt != null) 'completed_at': completedAt,
      if (status != null) 'status': status,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutHistorySetResultsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? workoutHistoryId,
    Value<String>? programSnapshotId,
    Value<String>? exerciseSnapshotId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<String>? programNameSnapshot,
    Value<String>? exerciseNameSnapshot,
    Value<bool>? timeEnabledSnapshot,
    Value<bool>? repsEnabledSnapshot,
    Value<bool>? scoreEnabledSnapshot,
    Value<String>? scoreInputModeSnapshot,
    Value<int?>? targetTimeSecondsSnapshot,
    Value<int?>? targetRepsSnapshot,
    Value<double?>? targetScoreSnapshot,
    Value<int?>? targetScoreTimeMsSnapshot,
    Value<int?>? actualTimeMs,
    Value<int?>? actualReps,
    Value<double?>? actualScore,
    Value<int?>? actualScoreTimeMs,
    Value<String?>? scoreLabelSnapshot,
    Value<String?>? scoreUnitSnapshot,
    Value<String?>? sourceExerciseIdSnapshot,
    Value<DateTime?>? startedAt,
    Value<DateTime?>? completedAt,
    Value<String>? status,
    Value<int>? rowid,
  }) {
    return WorkoutHistorySetResultsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      workoutHistoryId: workoutHistoryId ?? this.workoutHistoryId,
      programSnapshotId: programSnapshotId ?? this.programSnapshotId,
      exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      programNameSnapshot: programNameSnapshot ?? this.programNameSnapshot,
      exerciseNameSnapshot: exerciseNameSnapshot ?? this.exerciseNameSnapshot,
      timeEnabledSnapshot: timeEnabledSnapshot ?? this.timeEnabledSnapshot,
      repsEnabledSnapshot: repsEnabledSnapshot ?? this.repsEnabledSnapshot,
      scoreEnabledSnapshot: scoreEnabledSnapshot ?? this.scoreEnabledSnapshot,
      scoreInputModeSnapshot:
          scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
      targetTimeSecondsSnapshot:
          targetTimeSecondsSnapshot ?? this.targetTimeSecondsSnapshot,
      targetRepsSnapshot: targetRepsSnapshot ?? this.targetRepsSnapshot,
      targetScoreSnapshot: targetScoreSnapshot ?? this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot ?? this.targetScoreTimeMsSnapshot,
      actualTimeMs: actualTimeMs ?? this.actualTimeMs,
      actualReps: actualReps ?? this.actualReps,
      actualScore: actualScore ?? this.actualScore,
      actualScoreTimeMs: actualScoreTimeMs ?? this.actualScoreTimeMs,
      scoreLabelSnapshot: scoreLabelSnapshot ?? this.scoreLabelSnapshot,
      scoreUnitSnapshot: scoreUnitSnapshot ?? this.scoreUnitSnapshot,
      sourceExerciseIdSnapshot:
          sourceExerciseIdSnapshot ?? this.sourceExerciseIdSnapshot,
      startedAt: startedAt ?? this.startedAt,
      completedAt: completedAt ?? this.completedAt,
      status: status ?? this.status,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (workoutHistoryId.present) {
      map['workout_history_id'] = Variable<String>(workoutHistoryId.value);
    }
    if (programSnapshotId.present) {
      map['program_snapshot_id'] = Variable<String>(programSnapshotId.value);
    }
    if (exerciseSnapshotId.present) {
      map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId.value);
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (programNameSnapshot.present) {
      map['program_name_snapshot'] = Variable<String>(
        programNameSnapshot.value,
      );
    }
    if (exerciseNameSnapshot.present) {
      map['exercise_name_snapshot'] = Variable<String>(
        exerciseNameSnapshot.value,
      );
    }
    if (timeEnabledSnapshot.present) {
      map['time_enabled_snapshot'] = Variable<bool>(timeEnabledSnapshot.value);
    }
    if (repsEnabledSnapshot.present) {
      map['reps_enabled_snapshot'] = Variable<bool>(repsEnabledSnapshot.value);
    }
    if (scoreEnabledSnapshot.present) {
      map['score_enabled_snapshot'] = Variable<bool>(
        scoreEnabledSnapshot.value,
      );
    }
    if (scoreInputModeSnapshot.present) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot.value,
      );
    }
    if (targetTimeSecondsSnapshot.present) {
      map['target_time_seconds_snapshot'] = Variable<int>(
        targetTimeSecondsSnapshot.value,
      );
    }
    if (targetRepsSnapshot.present) {
      map['target_reps_snapshot'] = Variable<int>(targetRepsSnapshot.value);
    }
    if (targetScoreSnapshot.present) {
      map['target_score_snapshot'] = Variable<double>(
        targetScoreSnapshot.value,
      );
    }
    if (targetScoreTimeMsSnapshot.present) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot.value,
      );
    }
    if (actualTimeMs.present) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs.value);
    }
    if (actualReps.present) {
      map['actual_reps'] = Variable<int>(actualReps.value);
    }
    if (actualScore.present) {
      map['actual_score'] = Variable<double>(actualScore.value);
    }
    if (actualScoreTimeMs.present) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs.value);
    }
    if (scoreLabelSnapshot.present) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot.value);
    }
    if (scoreUnitSnapshot.present) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot.value);
    }
    if (sourceExerciseIdSnapshot.present) {
      map['source_exercise_id_snapshot'] = Variable<String>(
        sourceExerciseIdSnapshot.value,
      );
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (completedAt.present) {
      map['completed_at'] = Variable<DateTime>(completedAt.value);
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistorySetResultsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutHistoryId: $workoutHistoryId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('programNameSnapshot: $programNameSnapshot, ')
          ..write('exerciseNameSnapshot: $exerciseNameSnapshot, ')
          ..write('timeEnabledSnapshot: $timeEnabledSnapshot, ')
          ..write('repsEnabledSnapshot: $repsEnabledSnapshot, ')
          ..write('scoreEnabledSnapshot: $scoreEnabledSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('targetTimeSecondsSnapshot: $targetTimeSecondsSnapshot, ')
          ..write('targetRepsSnapshot: $targetRepsSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('sourceExerciseIdSnapshot: $sourceExerciseIdSnapshot, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('status: $status, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $WorkoutHistoryStepResultsTable extends WorkoutHistoryStepResults
    with TableInfo<$WorkoutHistoryStepResultsTable, WorkoutHistoryStepResult> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutHistoryStepResultsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _workoutHistoryIdMeta = const VerificationMeta(
    'workoutHistoryId',
  );
  @override
  late final GeneratedColumn<String> workoutHistoryId = GeneratedColumn<String>(
    'workout_history_id',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES workout_history (id)',
    ),
  );
  static const VerificationMeta _programSnapshotIdMeta = const VerificationMeta(
    'programSnapshotId',
  );
  @override
  late final GeneratedColumn<String> programSnapshotId =
      GeneratedColumn<String>(
        'program_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _exerciseSnapshotIdMeta =
      const VerificationMeta('exerciseSnapshotId');
  @override
  late final GeneratedColumn<String> exerciseSnapshotId =
      GeneratedColumn<String>(
        'exercise_snapshot_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _programIndexMeta = const VerificationMeta(
    'programIndex',
  );
  @override
  late final GeneratedColumn<int> programIndex = GeneratedColumn<int>(
    'program_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _exerciseIndexMeta = const VerificationMeta(
    'exerciseIndex',
  );
  @override
  late final GeneratedColumn<int> exerciseIndex = GeneratedColumn<int>(
    'exercise_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _setIndexMeta = const VerificationMeta(
    'setIndex',
  );
  @override
  late final GeneratedColumn<int> setIndex = GeneratedColumn<int>(
    'set_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _passageIndexMeta = const VerificationMeta(
    'passageIndex',
  );
  @override
  late final GeneratedColumn<int> passageIndex = GeneratedColumn<int>(
    'passage_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepIndexMeta = const VerificationMeta(
    'stepIndex',
  );
  @override
  late final GeneratedColumn<int> stepIndex = GeneratedColumn<int>(
    'step_index',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepSnapshotIdMeta = const VerificationMeta(
    'stepSnapshotId',
  );
  @override
  late final GeneratedColumn<String> stepSnapshotId = GeneratedColumn<String>(
    'step_snapshot_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepNameSnapshotMeta = const VerificationMeta(
    'stepNameSnapshot',
  );
  @override
  late final GeneratedColumn<String> stepNameSnapshot = GeneratedColumn<String>(
    'step_name_snapshot',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _stepTypeSnapshotMeta = const VerificationMeta(
    'stepTypeSnapshot',
  );
  @override
  late final GeneratedColumn<String> stepTypeSnapshot = GeneratedColumn<String>(
    'step_type_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _targetValueSnapshotMeta =
      const VerificationMeta('targetValueSnapshot');
  @override
  late final GeneratedColumn<int> targetValueSnapshot = GeneratedColumn<int>(
    'target_value_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _hasScoreSnapshotMeta = const VerificationMeta(
    'hasScoreSnapshot',
  );
  @override
  late final GeneratedColumn<bool> hasScoreSnapshot = GeneratedColumn<bool>(
    'has_score_snapshot',
    aliasedName,
    false,
    type: DriftSqlType.bool,
    requiredDuringInsert: true,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'CHECK ("has_score_snapshot" IN (0, 1))',
    ),
  );
  static const VerificationMeta _scoreInputModeSnapshotMeta =
      const VerificationMeta('scoreInputModeSnapshot');
  @override
  late final GeneratedColumn<String> scoreInputModeSnapshot =
      GeneratedColumn<String>(
        'score_input_mode_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreLabelSnapshotMeta =
      const VerificationMeta('scoreLabelSnapshot');
  @override
  late final GeneratedColumn<String> scoreLabelSnapshot =
      GeneratedColumn<String>(
        'score_label_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _scoreUnitSnapshotMeta = const VerificationMeta(
    'scoreUnitSnapshot',
  );
  @override
  late final GeneratedColumn<String> scoreUnitSnapshot =
      GeneratedColumn<String>(
        'score_unit_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreSnapshotMeta =
      const VerificationMeta('targetScoreSnapshot');
  @override
  late final GeneratedColumn<double> targetScoreSnapshot =
      GeneratedColumn<double>(
        'target_score_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreTimeMsSnapshotMeta =
      const VerificationMeta('targetScoreTimeMsSnapshot');
  @override
  late final GeneratedColumn<int> targetScoreTimeMsSnapshot =
      GeneratedColumn<int>(
        'target_score_time_ms_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _statusMeta = const VerificationMeta('status');
  @override
  late final GeneratedColumn<String> status = GeneratedColumn<String>(
    'status',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _startedAtMeta = const VerificationMeta(
    'startedAt',
  );
  @override
  late final GeneratedColumn<DateTime> startedAt = GeneratedColumn<DateTime>(
    'started_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _completedAtMeta = const VerificationMeta(
    'completedAt',
  );
  @override
  late final GeneratedColumn<DateTime> completedAt = GeneratedColumn<DateTime>(
    'completed_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualTimeMsMeta = const VerificationMeta(
    'actualTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualTimeMs = GeneratedColumn<int>(
    'actual_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualRepsMeta = const VerificationMeta(
    'actualReps',
  );
  @override
  late final GeneratedColumn<int> actualReps = GeneratedColumn<int>(
    'actual_reps',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreMeta = const VerificationMeta(
    'actualScore',
  );
  @override
  late final GeneratedColumn<double> actualScore = GeneratedColumn<double>(
    'actual_score',
    aliasedName,
    true,
    type: DriftSqlType.double,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _actualScoreTimeMsMeta = const VerificationMeta(
    'actualScoreTimeMs',
  );
  @override
  late final GeneratedColumn<int> actualScoreTimeMs = GeneratedColumn<int>(
    'actual_score_time_ms',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _noteMeta = const VerificationMeta('note');
  @override
  late final GeneratedColumn<String> note = GeneratedColumn<String>(
    'note',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _sourceExerciseIdSnapshotMeta =
      const VerificationMeta('sourceExerciseIdSnapshot');
  @override
  late final GeneratedColumn<String> sourceExerciseIdSnapshot =
      GeneratedColumn<String>(
        'source_exercise_id_snapshot',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutHistoryId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    passageIndex,
    stepIndex,
    stepSnapshotId,
    stepNameSnapshot,
    stepTypeSnapshot,
    targetValueSnapshot,
    hasScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    status,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    note,
    sourceExerciseIdSnapshot,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_history_step_results';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutHistoryStepResult> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('workout_history_id')) {
      context.handle(
        _workoutHistoryIdMeta,
        workoutHistoryId.isAcceptableOrUnknown(
          data['workout_history_id']!,
          _workoutHistoryIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_workoutHistoryIdMeta);
    }
    if (data.containsKey('program_snapshot_id')) {
      context.handle(
        _programSnapshotIdMeta,
        programSnapshotId.isAcceptableOrUnknown(
          data['program_snapshot_id']!,
          _programSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programSnapshotIdMeta);
    }
    if (data.containsKey('exercise_snapshot_id')) {
      context.handle(
        _exerciseSnapshotIdMeta,
        exerciseSnapshotId.isAcceptableOrUnknown(
          data['exercise_snapshot_id']!,
          _exerciseSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseSnapshotIdMeta);
    }
    if (data.containsKey('program_index')) {
      context.handle(
        _programIndexMeta,
        programIndex.isAcceptableOrUnknown(
          data['program_index']!,
          _programIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programIndexMeta);
    }
    if (data.containsKey('exercise_index')) {
      context.handle(
        _exerciseIndexMeta,
        exerciseIndex.isAcceptableOrUnknown(
          data['exercise_index']!,
          _exerciseIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_exerciseIndexMeta);
    }
    if (data.containsKey('set_index')) {
      context.handle(
        _setIndexMeta,
        setIndex.isAcceptableOrUnknown(data['set_index']!, _setIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_setIndexMeta);
    }
    if (data.containsKey('passage_index')) {
      context.handle(
        _passageIndexMeta,
        passageIndex.isAcceptableOrUnknown(
          data['passage_index']!,
          _passageIndexMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_passageIndexMeta);
    }
    if (data.containsKey('step_index')) {
      context.handle(
        _stepIndexMeta,
        stepIndex.isAcceptableOrUnknown(data['step_index']!, _stepIndexMeta),
      );
    } else if (isInserting) {
      context.missing(_stepIndexMeta);
    }
    if (data.containsKey('step_snapshot_id')) {
      context.handle(
        _stepSnapshotIdMeta,
        stepSnapshotId.isAcceptableOrUnknown(
          data['step_snapshot_id']!,
          _stepSnapshotIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepSnapshotIdMeta);
    }
    if (data.containsKey('step_name_snapshot')) {
      context.handle(
        _stepNameSnapshotMeta,
        stepNameSnapshot.isAcceptableOrUnknown(
          data['step_name_snapshot']!,
          _stepNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepNameSnapshotMeta);
    }
    if (data.containsKey('step_type_snapshot')) {
      context.handle(
        _stepTypeSnapshotMeta,
        stepTypeSnapshot.isAcceptableOrUnknown(
          data['step_type_snapshot']!,
          _stepTypeSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_stepTypeSnapshotMeta);
    }
    if (data.containsKey('target_value_snapshot')) {
      context.handle(
        _targetValueSnapshotMeta,
        targetValueSnapshot.isAcceptableOrUnknown(
          data['target_value_snapshot']!,
          _targetValueSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_targetValueSnapshotMeta);
    }
    if (data.containsKey('has_score_snapshot')) {
      context.handle(
        _hasScoreSnapshotMeta,
        hasScoreSnapshot.isAcceptableOrUnknown(
          data['has_score_snapshot']!,
          _hasScoreSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_hasScoreSnapshotMeta);
    }
    if (data.containsKey('score_input_mode_snapshot')) {
      context.handle(
        _scoreInputModeSnapshotMeta,
        scoreInputModeSnapshot.isAcceptableOrUnknown(
          data['score_input_mode_snapshot']!,
          _scoreInputModeSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_label_snapshot')) {
      context.handle(
        _scoreLabelSnapshotMeta,
        scoreLabelSnapshot.isAcceptableOrUnknown(
          data['score_label_snapshot']!,
          _scoreLabelSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('score_unit_snapshot')) {
      context.handle(
        _scoreUnitSnapshotMeta,
        scoreUnitSnapshot.isAcceptableOrUnknown(
          data['score_unit_snapshot']!,
          _scoreUnitSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_snapshot')) {
      context.handle(
        _targetScoreSnapshotMeta,
        targetScoreSnapshot.isAcceptableOrUnknown(
          data['target_score_snapshot']!,
          _targetScoreSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('target_score_time_ms_snapshot')) {
      context.handle(
        _targetScoreTimeMsSnapshotMeta,
        targetScoreTimeMsSnapshot.isAcceptableOrUnknown(
          data['target_score_time_ms_snapshot']!,
          _targetScoreTimeMsSnapshotMeta,
        ),
      );
    }
    if (data.containsKey('status')) {
      context.handle(
        _statusMeta,
        status.isAcceptableOrUnknown(data['status']!, _statusMeta),
      );
    } else if (isInserting) {
      context.missing(_statusMeta);
    }
    if (data.containsKey('started_at')) {
      context.handle(
        _startedAtMeta,
        startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
      );
    }
    if (data.containsKey('completed_at')) {
      context.handle(
        _completedAtMeta,
        completedAt.isAcceptableOrUnknown(
          data['completed_at']!,
          _completedAtMeta,
        ),
      );
    }
    if (data.containsKey('actual_time_ms')) {
      context.handle(
        _actualTimeMsMeta,
        actualTimeMs.isAcceptableOrUnknown(
          data['actual_time_ms']!,
          _actualTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('actual_reps')) {
      context.handle(
        _actualRepsMeta,
        actualReps.isAcceptableOrUnknown(data['actual_reps']!, _actualRepsMeta),
      );
    }
    if (data.containsKey('actual_score')) {
      context.handle(
        _actualScoreMeta,
        actualScore.isAcceptableOrUnknown(
          data['actual_score']!,
          _actualScoreMeta,
        ),
      );
    }
    if (data.containsKey('actual_score_time_ms')) {
      context.handle(
        _actualScoreTimeMsMeta,
        actualScoreTimeMs.isAcceptableOrUnknown(
          data['actual_score_time_ms']!,
          _actualScoreTimeMsMeta,
        ),
      );
    }
    if (data.containsKey('note')) {
      context.handle(
        _noteMeta,
        note.isAcceptableOrUnknown(data['note']!, _noteMeta),
      );
    }
    if (data.containsKey('source_exercise_id_snapshot')) {
      context.handle(
        _sourceExerciseIdSnapshotMeta,
        sourceExerciseIdSnapshot.isAcceptableOrUnknown(
          data['source_exercise_id_snapshot']!,
          _sourceExerciseIdSnapshotMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutHistoryStepResult map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutHistoryStepResult(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      workoutHistoryId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}workout_history_id'],
      )!,
      programSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_snapshot_id'],
      )!,
      exerciseSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}exercise_snapshot_id'],
      )!,
      programIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}program_index'],
      )!,
      exerciseIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}exercise_index'],
      )!,
      setIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}set_index'],
      )!,
      passageIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}passage_index'],
      )!,
      stepIndex: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}step_index'],
      )!,
      stepSnapshotId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_snapshot_id'],
      )!,
      stepNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_name_snapshot'],
      )!,
      stepTypeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}step_type_snapshot'],
      )!,
      targetValueSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_value_snapshot'],
      )!,
      hasScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}has_score_snapshot'],
      )!,
      scoreInputModeSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_input_mode_snapshot'],
      ),
      scoreLabelSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_label_snapshot'],
      ),
      scoreUnitSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}score_unit_snapshot'],
      ),
      targetScoreSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}target_score_snapshot'],
      ),
      targetScoreTimeMsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_score_time_ms_snapshot'],
      ),
      status: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}status'],
      )!,
      startedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}started_at'],
      ),
      completedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}completed_at'],
      ),
      actualTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_time_ms'],
      ),
      actualReps: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_reps'],
      ),
      actualScore: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}actual_score'],
      ),
      actualScoreTimeMs: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}actual_score_time_ms'],
      ),
      note: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}note'],
      ),
      sourceExerciseIdSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_exercise_id_snapshot'],
      ),
    );
  }

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

class WorkoutHistoryStepResult extends DataClass
    implements Insertable<WorkoutHistoryStepResult> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String workoutHistoryId;
  final String programSnapshotId;
  final String exerciseSnapshotId;
  final int programIndex;
  final int exerciseIndex;
  final int setIndex;
  final int passageIndex;
  final int stepIndex;
  final String stepSnapshotId;
  final String stepNameSnapshot;
  final String stepTypeSnapshot;
  final int targetValueSnapshot;
  final bool hasScoreSnapshot;
  final String? scoreInputModeSnapshot;
  final String? scoreLabelSnapshot;
  final String? scoreUnitSnapshot;
  final double? targetScoreSnapshot;
  final int? targetScoreTimeMsSnapshot;
  final String status;
  final DateTime? startedAt;
  final DateTime? completedAt;
  final int? actualTimeMs;
  final int? actualReps;
  final double? actualScore;
  final int? actualScoreTimeMs;
  final String? note;
  final String? sourceExerciseIdSnapshot;
  const WorkoutHistoryStepResult({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.workoutHistoryId,
    required this.programSnapshotId,
    required this.exerciseSnapshotId,
    required this.programIndex,
    required this.exerciseIndex,
    required this.setIndex,
    required this.passageIndex,
    required this.stepIndex,
    required this.stepSnapshotId,
    required this.stepNameSnapshot,
    required this.stepTypeSnapshot,
    required this.targetValueSnapshot,
    required this.hasScoreSnapshot,
    this.scoreInputModeSnapshot,
    this.scoreLabelSnapshot,
    this.scoreUnitSnapshot,
    this.targetScoreSnapshot,
    this.targetScoreTimeMsSnapshot,
    required this.status,
    this.startedAt,
    this.completedAt,
    this.actualTimeMs,
    this.actualReps,
    this.actualScore,
    this.actualScoreTimeMs,
    this.note,
    this.sourceExerciseIdSnapshot,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['workout_history_id'] = Variable<String>(workoutHistoryId);
    map['program_snapshot_id'] = Variable<String>(programSnapshotId);
    map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId);
    map['program_index'] = Variable<int>(programIndex);
    map['exercise_index'] = Variable<int>(exerciseIndex);
    map['set_index'] = Variable<int>(setIndex);
    map['passage_index'] = Variable<int>(passageIndex);
    map['step_index'] = Variable<int>(stepIndex);
    map['step_snapshot_id'] = Variable<String>(stepSnapshotId);
    map['step_name_snapshot'] = Variable<String>(stepNameSnapshot);
    map['step_type_snapshot'] = Variable<String>(stepTypeSnapshot);
    map['target_value_snapshot'] = Variable<int>(targetValueSnapshot);
    map['has_score_snapshot'] = Variable<bool>(hasScoreSnapshot);
    if (!nullToAbsent || scoreInputModeSnapshot != null) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot,
      );
    }
    if (!nullToAbsent || scoreLabelSnapshot != null) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot);
    }
    if (!nullToAbsent || scoreUnitSnapshot != null) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot);
    }
    if (!nullToAbsent || targetScoreSnapshot != null) {
      map['target_score_snapshot'] = Variable<double>(targetScoreSnapshot);
    }
    if (!nullToAbsent || targetScoreTimeMsSnapshot != null) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot,
      );
    }
    map['status'] = Variable<String>(status);
    if (!nullToAbsent || startedAt != null) {
      map['started_at'] = Variable<DateTime>(startedAt);
    }
    if (!nullToAbsent || completedAt != null) {
      map['completed_at'] = Variable<DateTime>(completedAt);
    }
    if (!nullToAbsent || actualTimeMs != null) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs);
    }
    if (!nullToAbsent || actualReps != null) {
      map['actual_reps'] = Variable<int>(actualReps);
    }
    if (!nullToAbsent || actualScore != null) {
      map['actual_score'] = Variable<double>(actualScore);
    }
    if (!nullToAbsent || actualScoreTimeMs != null) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs);
    }
    if (!nullToAbsent || note != null) {
      map['note'] = Variable<String>(note);
    }
    if (!nullToAbsent || sourceExerciseIdSnapshot != null) {
      map['source_exercise_id_snapshot'] = Variable<String>(
        sourceExerciseIdSnapshot,
      );
    }
    return map;
  }

  WorkoutHistoryStepResultsCompanion toCompanion(bool nullToAbsent) {
    return WorkoutHistoryStepResultsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      workoutHistoryId: Value(workoutHistoryId),
      programSnapshotId: Value(programSnapshotId),
      exerciseSnapshotId: Value(exerciseSnapshotId),
      programIndex: Value(programIndex),
      exerciseIndex: Value(exerciseIndex),
      setIndex: Value(setIndex),
      passageIndex: Value(passageIndex),
      stepIndex: Value(stepIndex),
      stepSnapshotId: Value(stepSnapshotId),
      stepNameSnapshot: Value(stepNameSnapshot),
      stepTypeSnapshot: Value(stepTypeSnapshot),
      targetValueSnapshot: Value(targetValueSnapshot),
      hasScoreSnapshot: Value(hasScoreSnapshot),
      scoreInputModeSnapshot: scoreInputModeSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreInputModeSnapshot),
      scoreLabelSnapshot: scoreLabelSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreLabelSnapshot),
      scoreUnitSnapshot: scoreUnitSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(scoreUnitSnapshot),
      targetScoreSnapshot: targetScoreSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreSnapshot),
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreTimeMsSnapshot),
      status: Value(status),
      startedAt: startedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(startedAt),
      completedAt: completedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(completedAt),
      actualTimeMs: actualTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualTimeMs),
      actualReps: actualReps == null && nullToAbsent
          ? const Value.absent()
          : Value(actualReps),
      actualScore: actualScore == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScore),
      actualScoreTimeMs: actualScoreTimeMs == null && nullToAbsent
          ? const Value.absent()
          : Value(actualScoreTimeMs),
      note: note == null && nullToAbsent ? const Value.absent() : Value(note),
      sourceExerciseIdSnapshot: sourceExerciseIdSnapshot == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceExerciseIdSnapshot),
    );
  }

  factory WorkoutHistoryStepResult.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutHistoryStepResult(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      workoutHistoryId: serializer.fromJson<String>(json['workoutHistoryId']),
      programSnapshotId: serializer.fromJson<String>(json['programSnapshotId']),
      exerciseSnapshotId: serializer.fromJson<String>(
        json['exerciseSnapshotId'],
      ),
      programIndex: serializer.fromJson<int>(json['programIndex']),
      exerciseIndex: serializer.fromJson<int>(json['exerciseIndex']),
      setIndex: serializer.fromJson<int>(json['setIndex']),
      passageIndex: serializer.fromJson<int>(json['passageIndex']),
      stepIndex: serializer.fromJson<int>(json['stepIndex']),
      stepSnapshotId: serializer.fromJson<String>(json['stepSnapshotId']),
      stepNameSnapshot: serializer.fromJson<String>(json['stepNameSnapshot']),
      stepTypeSnapshot: serializer.fromJson<String>(json['stepTypeSnapshot']),
      targetValueSnapshot: serializer.fromJson<int>(
        json['targetValueSnapshot'],
      ),
      hasScoreSnapshot: serializer.fromJson<bool>(json['hasScoreSnapshot']),
      scoreInputModeSnapshot: serializer.fromJson<String?>(
        json['scoreInputModeSnapshot'],
      ),
      scoreLabelSnapshot: serializer.fromJson<String?>(
        json['scoreLabelSnapshot'],
      ),
      scoreUnitSnapshot: serializer.fromJson<String?>(
        json['scoreUnitSnapshot'],
      ),
      targetScoreSnapshot: serializer.fromJson<double?>(
        json['targetScoreSnapshot'],
      ),
      targetScoreTimeMsSnapshot: serializer.fromJson<int?>(
        json['targetScoreTimeMsSnapshot'],
      ),
      status: serializer.fromJson<String>(json['status']),
      startedAt: serializer.fromJson<DateTime?>(json['startedAt']),
      completedAt: serializer.fromJson<DateTime?>(json['completedAt']),
      actualTimeMs: serializer.fromJson<int?>(json['actualTimeMs']),
      actualReps: serializer.fromJson<int?>(json['actualReps']),
      actualScore: serializer.fromJson<double?>(json['actualScore']),
      actualScoreTimeMs: serializer.fromJson<int?>(json['actualScoreTimeMs']),
      note: serializer.fromJson<String?>(json['note']),
      sourceExerciseIdSnapshot: serializer.fromJson<String?>(
        json['sourceExerciseIdSnapshot'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'workoutHistoryId': serializer.toJson<String>(workoutHistoryId),
      'programSnapshotId': serializer.toJson<String>(programSnapshotId),
      'exerciseSnapshotId': serializer.toJson<String>(exerciseSnapshotId),
      'programIndex': serializer.toJson<int>(programIndex),
      'exerciseIndex': serializer.toJson<int>(exerciseIndex),
      'setIndex': serializer.toJson<int>(setIndex),
      'passageIndex': serializer.toJson<int>(passageIndex),
      'stepIndex': serializer.toJson<int>(stepIndex),
      'stepSnapshotId': serializer.toJson<String>(stepSnapshotId),
      'stepNameSnapshot': serializer.toJson<String>(stepNameSnapshot),
      'stepTypeSnapshot': serializer.toJson<String>(stepTypeSnapshot),
      'targetValueSnapshot': serializer.toJson<int>(targetValueSnapshot),
      'hasScoreSnapshot': serializer.toJson<bool>(hasScoreSnapshot),
      'scoreInputModeSnapshot': serializer.toJson<String?>(
        scoreInputModeSnapshot,
      ),
      'scoreLabelSnapshot': serializer.toJson<String?>(scoreLabelSnapshot),
      'scoreUnitSnapshot': serializer.toJson<String?>(scoreUnitSnapshot),
      'targetScoreSnapshot': serializer.toJson<double?>(targetScoreSnapshot),
      'targetScoreTimeMsSnapshot': serializer.toJson<int?>(
        targetScoreTimeMsSnapshot,
      ),
      'status': serializer.toJson<String>(status),
      'startedAt': serializer.toJson<DateTime?>(startedAt),
      'completedAt': serializer.toJson<DateTime?>(completedAt),
      'actualTimeMs': serializer.toJson<int?>(actualTimeMs),
      'actualReps': serializer.toJson<int?>(actualReps),
      'actualScore': serializer.toJson<double?>(actualScore),
      'actualScoreTimeMs': serializer.toJson<int?>(actualScoreTimeMs),
      'note': serializer.toJson<String?>(note),
      'sourceExerciseIdSnapshot': serializer.toJson<String?>(
        sourceExerciseIdSnapshot,
      ),
    };
  }

  WorkoutHistoryStepResult copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? workoutHistoryId,
    String? programSnapshotId,
    String? exerciseSnapshotId,
    int? programIndex,
    int? exerciseIndex,
    int? setIndex,
    int? passageIndex,
    int? stepIndex,
    String? stepSnapshotId,
    String? stepNameSnapshot,
    String? stepTypeSnapshot,
    int? targetValueSnapshot,
    bool? hasScoreSnapshot,
    Value<String?> scoreInputModeSnapshot = const Value.absent(),
    Value<String?> scoreLabelSnapshot = const Value.absent(),
    Value<String?> scoreUnitSnapshot = const Value.absent(),
    Value<double?> targetScoreSnapshot = const Value.absent(),
    Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
    String? status,
    Value<DateTime?> startedAt = const Value.absent(),
    Value<DateTime?> completedAt = const Value.absent(),
    Value<int?> actualTimeMs = const Value.absent(),
    Value<int?> actualReps = const Value.absent(),
    Value<double?> actualScore = const Value.absent(),
    Value<int?> actualScoreTimeMs = const Value.absent(),
    Value<String?> note = const Value.absent(),
    Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
  }) => WorkoutHistoryStepResult(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    workoutHistoryId: workoutHistoryId ?? this.workoutHistoryId,
    programSnapshotId: programSnapshotId ?? this.programSnapshotId,
    exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
    programIndex: programIndex ?? this.programIndex,
    exerciseIndex: exerciseIndex ?? this.exerciseIndex,
    setIndex: setIndex ?? this.setIndex,
    passageIndex: passageIndex ?? this.passageIndex,
    stepIndex: stepIndex ?? this.stepIndex,
    stepSnapshotId: stepSnapshotId ?? this.stepSnapshotId,
    stepNameSnapshot: stepNameSnapshot ?? this.stepNameSnapshot,
    stepTypeSnapshot: stepTypeSnapshot ?? this.stepTypeSnapshot,
    targetValueSnapshot: targetValueSnapshot ?? this.targetValueSnapshot,
    hasScoreSnapshot: hasScoreSnapshot ?? this.hasScoreSnapshot,
    scoreInputModeSnapshot: scoreInputModeSnapshot.present
        ? scoreInputModeSnapshot.value
        : this.scoreInputModeSnapshot,
    scoreLabelSnapshot: scoreLabelSnapshot.present
        ? scoreLabelSnapshot.value
        : this.scoreLabelSnapshot,
    scoreUnitSnapshot: scoreUnitSnapshot.present
        ? scoreUnitSnapshot.value
        : this.scoreUnitSnapshot,
    targetScoreSnapshot: targetScoreSnapshot.present
        ? targetScoreSnapshot.value
        : this.targetScoreSnapshot,
    targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot.present
        ? targetScoreTimeMsSnapshot.value
        : this.targetScoreTimeMsSnapshot,
    status: status ?? this.status,
    startedAt: startedAt.present ? startedAt.value : this.startedAt,
    completedAt: completedAt.present ? completedAt.value : this.completedAt,
    actualTimeMs: actualTimeMs.present ? actualTimeMs.value : this.actualTimeMs,
    actualReps: actualReps.present ? actualReps.value : this.actualReps,
    actualScore: actualScore.present ? actualScore.value : this.actualScore,
    actualScoreTimeMs: actualScoreTimeMs.present
        ? actualScoreTimeMs.value
        : this.actualScoreTimeMs,
    note: note.present ? note.value : this.note,
    sourceExerciseIdSnapshot: sourceExerciseIdSnapshot.present
        ? sourceExerciseIdSnapshot.value
        : this.sourceExerciseIdSnapshot,
  );
  WorkoutHistoryStepResult copyWithCompanion(
    WorkoutHistoryStepResultsCompanion data,
  ) {
    return WorkoutHistoryStepResult(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      workoutHistoryId: data.workoutHistoryId.present
          ? data.workoutHistoryId.value
          : this.workoutHistoryId,
      programSnapshotId: data.programSnapshotId.present
          ? data.programSnapshotId.value
          : this.programSnapshotId,
      exerciseSnapshotId: data.exerciseSnapshotId.present
          ? data.exerciseSnapshotId.value
          : this.exerciseSnapshotId,
      programIndex: data.programIndex.present
          ? data.programIndex.value
          : this.programIndex,
      exerciseIndex: data.exerciseIndex.present
          ? data.exerciseIndex.value
          : this.exerciseIndex,
      setIndex: data.setIndex.present ? data.setIndex.value : this.setIndex,
      passageIndex: data.passageIndex.present
          ? data.passageIndex.value
          : this.passageIndex,
      stepIndex: data.stepIndex.present ? data.stepIndex.value : this.stepIndex,
      stepSnapshotId: data.stepSnapshotId.present
          ? data.stepSnapshotId.value
          : this.stepSnapshotId,
      stepNameSnapshot: data.stepNameSnapshot.present
          ? data.stepNameSnapshot.value
          : this.stepNameSnapshot,
      stepTypeSnapshot: data.stepTypeSnapshot.present
          ? data.stepTypeSnapshot.value
          : this.stepTypeSnapshot,
      targetValueSnapshot: data.targetValueSnapshot.present
          ? data.targetValueSnapshot.value
          : this.targetValueSnapshot,
      hasScoreSnapshot: data.hasScoreSnapshot.present
          ? data.hasScoreSnapshot.value
          : this.hasScoreSnapshot,
      scoreInputModeSnapshot: data.scoreInputModeSnapshot.present
          ? data.scoreInputModeSnapshot.value
          : this.scoreInputModeSnapshot,
      scoreLabelSnapshot: data.scoreLabelSnapshot.present
          ? data.scoreLabelSnapshot.value
          : this.scoreLabelSnapshot,
      scoreUnitSnapshot: data.scoreUnitSnapshot.present
          ? data.scoreUnitSnapshot.value
          : this.scoreUnitSnapshot,
      targetScoreSnapshot: data.targetScoreSnapshot.present
          ? data.targetScoreSnapshot.value
          : this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot: data.targetScoreTimeMsSnapshot.present
          ? data.targetScoreTimeMsSnapshot.value
          : this.targetScoreTimeMsSnapshot,
      status: data.status.present ? data.status.value : this.status,
      startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
      completedAt: data.completedAt.present
          ? data.completedAt.value
          : this.completedAt,
      actualTimeMs: data.actualTimeMs.present
          ? data.actualTimeMs.value
          : this.actualTimeMs,
      actualReps: data.actualReps.present
          ? data.actualReps.value
          : this.actualReps,
      actualScore: data.actualScore.present
          ? data.actualScore.value
          : this.actualScore,
      actualScoreTimeMs: data.actualScoreTimeMs.present
          ? data.actualScoreTimeMs.value
          : this.actualScoreTimeMs,
      note: data.note.present ? data.note.value : this.note,
      sourceExerciseIdSnapshot: data.sourceExerciseIdSnapshot.present
          ? data.sourceExerciseIdSnapshot.value
          : this.sourceExerciseIdSnapshot,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistoryStepResult(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutHistoryId: $workoutHistoryId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('passageIndex: $passageIndex, ')
          ..write('stepIndex: $stepIndex, ')
          ..write('stepSnapshotId: $stepSnapshotId, ')
          ..write('stepNameSnapshot: $stepNameSnapshot, ')
          ..write('stepTypeSnapshot: $stepTypeSnapshot, ')
          ..write('targetValueSnapshot: $targetValueSnapshot, ')
          ..write('hasScoreSnapshot: $hasScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('note: $note, ')
          ..write('sourceExerciseIdSnapshot: $sourceExerciseIdSnapshot')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hashAll([
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutHistoryId,
    programSnapshotId,
    exerciseSnapshotId,
    programIndex,
    exerciseIndex,
    setIndex,
    passageIndex,
    stepIndex,
    stepSnapshotId,
    stepNameSnapshot,
    stepTypeSnapshot,
    targetValueSnapshot,
    hasScoreSnapshot,
    scoreInputModeSnapshot,
    scoreLabelSnapshot,
    scoreUnitSnapshot,
    targetScoreSnapshot,
    targetScoreTimeMsSnapshot,
    status,
    startedAt,
    completedAt,
    actualTimeMs,
    actualReps,
    actualScore,
    actualScoreTimeMs,
    note,
    sourceExerciseIdSnapshot,
  ]);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutHistoryStepResult &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.workoutHistoryId == this.workoutHistoryId &&
          other.programSnapshotId == this.programSnapshotId &&
          other.exerciseSnapshotId == this.exerciseSnapshotId &&
          other.programIndex == this.programIndex &&
          other.exerciseIndex == this.exerciseIndex &&
          other.setIndex == this.setIndex &&
          other.passageIndex == this.passageIndex &&
          other.stepIndex == this.stepIndex &&
          other.stepSnapshotId == this.stepSnapshotId &&
          other.stepNameSnapshot == this.stepNameSnapshot &&
          other.stepTypeSnapshot == this.stepTypeSnapshot &&
          other.targetValueSnapshot == this.targetValueSnapshot &&
          other.hasScoreSnapshot == this.hasScoreSnapshot &&
          other.scoreInputModeSnapshot == this.scoreInputModeSnapshot &&
          other.scoreLabelSnapshot == this.scoreLabelSnapshot &&
          other.scoreUnitSnapshot == this.scoreUnitSnapshot &&
          other.targetScoreSnapshot == this.targetScoreSnapshot &&
          other.targetScoreTimeMsSnapshot == this.targetScoreTimeMsSnapshot &&
          other.status == this.status &&
          other.startedAt == this.startedAt &&
          other.completedAt == this.completedAt &&
          other.actualTimeMs == this.actualTimeMs &&
          other.actualReps == this.actualReps &&
          other.actualScore == this.actualScore &&
          other.actualScoreTimeMs == this.actualScoreTimeMs &&
          other.note == this.note &&
          other.sourceExerciseIdSnapshot == this.sourceExerciseIdSnapshot);
}

class WorkoutHistoryStepResultsCompanion
    extends UpdateCompanion<WorkoutHistoryStepResult> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> workoutHistoryId;
  final Value<String> programSnapshotId;
  final Value<String> exerciseSnapshotId;
  final Value<int> programIndex;
  final Value<int> exerciseIndex;
  final Value<int> setIndex;
  final Value<int> passageIndex;
  final Value<int> stepIndex;
  final Value<String> stepSnapshotId;
  final Value<String> stepNameSnapshot;
  final Value<String> stepTypeSnapshot;
  final Value<int> targetValueSnapshot;
  final Value<bool> hasScoreSnapshot;
  final Value<String?> scoreInputModeSnapshot;
  final Value<String?> scoreLabelSnapshot;
  final Value<String?> scoreUnitSnapshot;
  final Value<double?> targetScoreSnapshot;
  final Value<int?> targetScoreTimeMsSnapshot;
  final Value<String> status;
  final Value<DateTime?> startedAt;
  final Value<DateTime?> completedAt;
  final Value<int?> actualTimeMs;
  final Value<int?> actualReps;
  final Value<double?> actualScore;
  final Value<int?> actualScoreTimeMs;
  final Value<String?> note;
  final Value<String?> sourceExerciseIdSnapshot;
  final Value<int> rowid;
  const WorkoutHistoryStepResultsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.workoutHistoryId = const Value.absent(),
    this.programSnapshotId = const Value.absent(),
    this.exerciseSnapshotId = const Value.absent(),
    this.programIndex = const Value.absent(),
    this.exerciseIndex = const Value.absent(),
    this.setIndex = const Value.absent(),
    this.passageIndex = const Value.absent(),
    this.stepIndex = const Value.absent(),
    this.stepSnapshotId = const Value.absent(),
    this.stepNameSnapshot = const Value.absent(),
    this.stepTypeSnapshot = const Value.absent(),
    this.targetValueSnapshot = const Value.absent(),
    this.hasScoreSnapshot = const Value.absent(),
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    this.status = const Value.absent(),
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.note = const Value.absent(),
    this.sourceExerciseIdSnapshot = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutHistoryStepResultsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String workoutHistoryId,
    required String programSnapshotId,
    required String exerciseSnapshotId,
    required int programIndex,
    required int exerciseIndex,
    required int setIndex,
    required int passageIndex,
    required int stepIndex,
    required String stepSnapshotId,
    required String stepNameSnapshot,
    required String stepTypeSnapshot,
    required int targetValueSnapshot,
    required bool hasScoreSnapshot,
    this.scoreInputModeSnapshot = const Value.absent(),
    this.scoreLabelSnapshot = const Value.absent(),
    this.scoreUnitSnapshot = const Value.absent(),
    this.targetScoreSnapshot = const Value.absent(),
    this.targetScoreTimeMsSnapshot = const Value.absent(),
    required String status,
    this.startedAt = const Value.absent(),
    this.completedAt = const Value.absent(),
    this.actualTimeMs = const Value.absent(),
    this.actualReps = const Value.absent(),
    this.actualScore = const Value.absent(),
    this.actualScoreTimeMs = const Value.absent(),
    this.note = const Value.absent(),
    this.sourceExerciseIdSnapshot = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       workoutHistoryId = Value(workoutHistoryId),
       programSnapshotId = Value(programSnapshotId),
       exerciseSnapshotId = Value(exerciseSnapshotId),
       programIndex = Value(programIndex),
       exerciseIndex = Value(exerciseIndex),
       setIndex = Value(setIndex),
       passageIndex = Value(passageIndex),
       stepIndex = Value(stepIndex),
       stepSnapshotId = Value(stepSnapshotId),
       stepNameSnapshot = Value(stepNameSnapshot),
       stepTypeSnapshot = Value(stepTypeSnapshot),
       targetValueSnapshot = Value(targetValueSnapshot),
       hasScoreSnapshot = Value(hasScoreSnapshot),
       status = Value(status);
  static Insertable<WorkoutHistoryStepResult> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? workoutHistoryId,
    Expression<String>? programSnapshotId,
    Expression<String>? exerciseSnapshotId,
    Expression<int>? programIndex,
    Expression<int>? exerciseIndex,
    Expression<int>? setIndex,
    Expression<int>? passageIndex,
    Expression<int>? stepIndex,
    Expression<String>? stepSnapshotId,
    Expression<String>? stepNameSnapshot,
    Expression<String>? stepTypeSnapshot,
    Expression<int>? targetValueSnapshot,
    Expression<bool>? hasScoreSnapshot,
    Expression<String>? scoreInputModeSnapshot,
    Expression<String>? scoreLabelSnapshot,
    Expression<String>? scoreUnitSnapshot,
    Expression<double>? targetScoreSnapshot,
    Expression<int>? targetScoreTimeMsSnapshot,
    Expression<String>? status,
    Expression<DateTime>? startedAt,
    Expression<DateTime>? completedAt,
    Expression<int>? actualTimeMs,
    Expression<int>? actualReps,
    Expression<double>? actualScore,
    Expression<int>? actualScoreTimeMs,
    Expression<String>? note,
    Expression<String>? sourceExerciseIdSnapshot,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (workoutHistoryId != null) 'workout_history_id': workoutHistoryId,
      if (programSnapshotId != null) 'program_snapshot_id': programSnapshotId,
      if (exerciseSnapshotId != null)
        'exercise_snapshot_id': exerciseSnapshotId,
      if (programIndex != null) 'program_index': programIndex,
      if (exerciseIndex != null) 'exercise_index': exerciseIndex,
      if (setIndex != null) 'set_index': setIndex,
      if (passageIndex != null) 'passage_index': passageIndex,
      if (stepIndex != null) 'step_index': stepIndex,
      if (stepSnapshotId != null) 'step_snapshot_id': stepSnapshotId,
      if (stepNameSnapshot != null) 'step_name_snapshot': stepNameSnapshot,
      if (stepTypeSnapshot != null) 'step_type_snapshot': stepTypeSnapshot,
      if (targetValueSnapshot != null)
        'target_value_snapshot': targetValueSnapshot,
      if (hasScoreSnapshot != null) 'has_score_snapshot': hasScoreSnapshot,
      if (scoreInputModeSnapshot != null)
        'score_input_mode_snapshot': scoreInputModeSnapshot,
      if (scoreLabelSnapshot != null)
        'score_label_snapshot': scoreLabelSnapshot,
      if (scoreUnitSnapshot != null) 'score_unit_snapshot': scoreUnitSnapshot,
      if (targetScoreSnapshot != null)
        'target_score_snapshot': targetScoreSnapshot,
      if (targetScoreTimeMsSnapshot != null)
        'target_score_time_ms_snapshot': targetScoreTimeMsSnapshot,
      if (status != null) 'status': status,
      if (startedAt != null) 'started_at': startedAt,
      if (completedAt != null) 'completed_at': completedAt,
      if (actualTimeMs != null) 'actual_time_ms': actualTimeMs,
      if (actualReps != null) 'actual_reps': actualReps,
      if (actualScore != null) 'actual_score': actualScore,
      if (actualScoreTimeMs != null) 'actual_score_time_ms': actualScoreTimeMs,
      if (note != null) 'note': note,
      if (sourceExerciseIdSnapshot != null)
        'source_exercise_id_snapshot': sourceExerciseIdSnapshot,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutHistoryStepResultsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? workoutHistoryId,
    Value<String>? programSnapshotId,
    Value<String>? exerciseSnapshotId,
    Value<int>? programIndex,
    Value<int>? exerciseIndex,
    Value<int>? setIndex,
    Value<int>? passageIndex,
    Value<int>? stepIndex,
    Value<String>? stepSnapshotId,
    Value<String>? stepNameSnapshot,
    Value<String>? stepTypeSnapshot,
    Value<int>? targetValueSnapshot,
    Value<bool>? hasScoreSnapshot,
    Value<String?>? scoreInputModeSnapshot,
    Value<String?>? scoreLabelSnapshot,
    Value<String?>? scoreUnitSnapshot,
    Value<double?>? targetScoreSnapshot,
    Value<int?>? targetScoreTimeMsSnapshot,
    Value<String>? status,
    Value<DateTime?>? startedAt,
    Value<DateTime?>? completedAt,
    Value<int?>? actualTimeMs,
    Value<int?>? actualReps,
    Value<double?>? actualScore,
    Value<int?>? actualScoreTimeMs,
    Value<String?>? note,
    Value<String?>? sourceExerciseIdSnapshot,
    Value<int>? rowid,
  }) {
    return WorkoutHistoryStepResultsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      workoutHistoryId: workoutHistoryId ?? this.workoutHistoryId,
      programSnapshotId: programSnapshotId ?? this.programSnapshotId,
      exerciseSnapshotId: exerciseSnapshotId ?? this.exerciseSnapshotId,
      programIndex: programIndex ?? this.programIndex,
      exerciseIndex: exerciseIndex ?? this.exerciseIndex,
      setIndex: setIndex ?? this.setIndex,
      passageIndex: passageIndex ?? this.passageIndex,
      stepIndex: stepIndex ?? this.stepIndex,
      stepSnapshotId: stepSnapshotId ?? this.stepSnapshotId,
      stepNameSnapshot: stepNameSnapshot ?? this.stepNameSnapshot,
      stepTypeSnapshot: stepTypeSnapshot ?? this.stepTypeSnapshot,
      targetValueSnapshot: targetValueSnapshot ?? this.targetValueSnapshot,
      hasScoreSnapshot: hasScoreSnapshot ?? this.hasScoreSnapshot,
      scoreInputModeSnapshot:
          scoreInputModeSnapshot ?? this.scoreInputModeSnapshot,
      scoreLabelSnapshot: scoreLabelSnapshot ?? this.scoreLabelSnapshot,
      scoreUnitSnapshot: scoreUnitSnapshot ?? this.scoreUnitSnapshot,
      targetScoreSnapshot: targetScoreSnapshot ?? this.targetScoreSnapshot,
      targetScoreTimeMsSnapshot:
          targetScoreTimeMsSnapshot ?? this.targetScoreTimeMsSnapshot,
      status: status ?? this.status,
      startedAt: startedAt ?? this.startedAt,
      completedAt: completedAt ?? this.completedAt,
      actualTimeMs: actualTimeMs ?? this.actualTimeMs,
      actualReps: actualReps ?? this.actualReps,
      actualScore: actualScore ?? this.actualScore,
      actualScoreTimeMs: actualScoreTimeMs ?? this.actualScoreTimeMs,
      note: note ?? this.note,
      sourceExerciseIdSnapshot:
          sourceExerciseIdSnapshot ?? this.sourceExerciseIdSnapshot,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (workoutHistoryId.present) {
      map['workout_history_id'] = Variable<String>(workoutHistoryId.value);
    }
    if (programSnapshotId.present) {
      map['program_snapshot_id'] = Variable<String>(programSnapshotId.value);
    }
    if (exerciseSnapshotId.present) {
      map['exercise_snapshot_id'] = Variable<String>(exerciseSnapshotId.value);
    }
    if (programIndex.present) {
      map['program_index'] = Variable<int>(programIndex.value);
    }
    if (exerciseIndex.present) {
      map['exercise_index'] = Variable<int>(exerciseIndex.value);
    }
    if (setIndex.present) {
      map['set_index'] = Variable<int>(setIndex.value);
    }
    if (passageIndex.present) {
      map['passage_index'] = Variable<int>(passageIndex.value);
    }
    if (stepIndex.present) {
      map['step_index'] = Variable<int>(stepIndex.value);
    }
    if (stepSnapshotId.present) {
      map['step_snapshot_id'] = Variable<String>(stepSnapshotId.value);
    }
    if (stepNameSnapshot.present) {
      map['step_name_snapshot'] = Variable<String>(stepNameSnapshot.value);
    }
    if (stepTypeSnapshot.present) {
      map['step_type_snapshot'] = Variable<String>(stepTypeSnapshot.value);
    }
    if (targetValueSnapshot.present) {
      map['target_value_snapshot'] = Variable<int>(targetValueSnapshot.value);
    }
    if (hasScoreSnapshot.present) {
      map['has_score_snapshot'] = Variable<bool>(hasScoreSnapshot.value);
    }
    if (scoreInputModeSnapshot.present) {
      map['score_input_mode_snapshot'] = Variable<String>(
        scoreInputModeSnapshot.value,
      );
    }
    if (scoreLabelSnapshot.present) {
      map['score_label_snapshot'] = Variable<String>(scoreLabelSnapshot.value);
    }
    if (scoreUnitSnapshot.present) {
      map['score_unit_snapshot'] = Variable<String>(scoreUnitSnapshot.value);
    }
    if (targetScoreSnapshot.present) {
      map['target_score_snapshot'] = Variable<double>(
        targetScoreSnapshot.value,
      );
    }
    if (targetScoreTimeMsSnapshot.present) {
      map['target_score_time_ms_snapshot'] = Variable<int>(
        targetScoreTimeMsSnapshot.value,
      );
    }
    if (status.present) {
      map['status'] = Variable<String>(status.value);
    }
    if (startedAt.present) {
      map['started_at'] = Variable<DateTime>(startedAt.value);
    }
    if (completedAt.present) {
      map['completed_at'] = Variable<DateTime>(completedAt.value);
    }
    if (actualTimeMs.present) {
      map['actual_time_ms'] = Variable<int>(actualTimeMs.value);
    }
    if (actualReps.present) {
      map['actual_reps'] = Variable<int>(actualReps.value);
    }
    if (actualScore.present) {
      map['actual_score'] = Variable<double>(actualScore.value);
    }
    if (actualScoreTimeMs.present) {
      map['actual_score_time_ms'] = Variable<int>(actualScoreTimeMs.value);
    }
    if (note.present) {
      map['note'] = Variable<String>(note.value);
    }
    if (sourceExerciseIdSnapshot.present) {
      map['source_exercise_id_snapshot'] = Variable<String>(
        sourceExerciseIdSnapshot.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutHistoryStepResultsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutHistoryId: $workoutHistoryId, ')
          ..write('programSnapshotId: $programSnapshotId, ')
          ..write('exerciseSnapshotId: $exerciseSnapshotId, ')
          ..write('programIndex: $programIndex, ')
          ..write('exerciseIndex: $exerciseIndex, ')
          ..write('setIndex: $setIndex, ')
          ..write('passageIndex: $passageIndex, ')
          ..write('stepIndex: $stepIndex, ')
          ..write('stepSnapshotId: $stepSnapshotId, ')
          ..write('stepNameSnapshot: $stepNameSnapshot, ')
          ..write('stepTypeSnapshot: $stepTypeSnapshot, ')
          ..write('targetValueSnapshot: $targetValueSnapshot, ')
          ..write('hasScoreSnapshot: $hasScoreSnapshot, ')
          ..write('scoreInputModeSnapshot: $scoreInputModeSnapshot, ')
          ..write('scoreLabelSnapshot: $scoreLabelSnapshot, ')
          ..write('scoreUnitSnapshot: $scoreUnitSnapshot, ')
          ..write('targetScoreSnapshot: $targetScoreSnapshot, ')
          ..write('targetScoreTimeMsSnapshot: $targetScoreTimeMsSnapshot, ')
          ..write('status: $status, ')
          ..write('startedAt: $startedAt, ')
          ..write('completedAt: $completedAt, ')
          ..write('actualTimeMs: $actualTimeMs, ')
          ..write('actualReps: $actualReps, ')
          ..write('actualScore: $actualScore, ')
          ..write('actualScoreTimeMs: $actualScoreTimeMs, ')
          ..write('note: $note, ')
          ..write('sourceExerciseIdSnapshot: $sourceExerciseIdSnapshot, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $WorkoutTemplateProgramsTable extends WorkoutTemplatePrograms
    with TableInfo<$WorkoutTemplateProgramsTable, WorkoutTemplateProgram> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutTemplateProgramsTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _workoutTemplateIdMeta = const VerificationMeta(
    'workoutTemplateId',
  );
  @override
  late final GeneratedColumn<String> workoutTemplateId =
      GeneratedColumn<String>(
        'workout_template_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES workout_templates (id)',
        ),
      );
  static const VerificationMeta _sourceProgramIdMeta = const VerificationMeta(
    'sourceProgramId',
  );
  @override
  late final GeneratedColumn<String> sourceProgramId = GeneratedColumn<String>(
    'source_program_id',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    defaultConstraints: GeneratedColumn.constraintIsAlways(
      'REFERENCES programs (id)',
    ),
  );
  static const VerificationMeta _positionMeta = const VerificationMeta(
    'position',
  );
  @override
  late final GeneratedColumn<int> position = GeneratedColumn<int>(
    'position',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _programNameSnapshotMeta =
      const VerificationMeta('programNameSnapshot');
  @override
  late final GeneratedColumn<String> programNameSnapshot =
      GeneratedColumn<String>(
        'program_name_snapshot',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _defaultRestSecondsSnapshotMeta =
      const VerificationMeta('defaultRestSecondsSnapshot');
  @override
  late final GeneratedColumn<int> defaultRestSecondsSnapshot =
      GeneratedColumn<int>(
        'default_rest_seconds_snapshot',
        aliasedName,
        false,
        type: DriftSqlType.int,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _programSnapshotJsonMeta =
      const VerificationMeta('programSnapshotJson');
  @override
  late final GeneratedColumn<String> programSnapshotJson =
      GeneratedColumn<String>(
        'program_snapshot_json',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutTemplateId,
    sourceProgramId,
    position,
    programNameSnapshot,
    defaultRestSecondsSnapshot,
    programSnapshotJson,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_template_programs';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutTemplateProgram> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('workout_template_id')) {
      context.handle(
        _workoutTemplateIdMeta,
        workoutTemplateId.isAcceptableOrUnknown(
          data['workout_template_id']!,
          _workoutTemplateIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_workoutTemplateIdMeta);
    }
    if (data.containsKey('source_program_id')) {
      context.handle(
        _sourceProgramIdMeta,
        sourceProgramId.isAcceptableOrUnknown(
          data['source_program_id']!,
          _sourceProgramIdMeta,
        ),
      );
    }
    if (data.containsKey('position')) {
      context.handle(
        _positionMeta,
        position.isAcceptableOrUnknown(data['position']!, _positionMeta),
      );
    } else if (isInserting) {
      context.missing(_positionMeta);
    }
    if (data.containsKey('program_name_snapshot')) {
      context.handle(
        _programNameSnapshotMeta,
        programNameSnapshot.isAcceptableOrUnknown(
          data['program_name_snapshot']!,
          _programNameSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programNameSnapshotMeta);
    }
    if (data.containsKey('default_rest_seconds_snapshot')) {
      context.handle(
        _defaultRestSecondsSnapshotMeta,
        defaultRestSecondsSnapshot.isAcceptableOrUnknown(
          data['default_rest_seconds_snapshot']!,
          _defaultRestSecondsSnapshotMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_defaultRestSecondsSnapshotMeta);
    }
    if (data.containsKey('program_snapshot_json')) {
      context.handle(
        _programSnapshotJsonMeta,
        programSnapshotJson.isAcceptableOrUnknown(
          data['program_snapshot_json']!,
          _programSnapshotJsonMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_programSnapshotJsonMeta);
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutTemplateProgram map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutTemplateProgram(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      workoutTemplateId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}workout_template_id'],
      )!,
      sourceProgramId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}source_program_id'],
      ),
      position: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}position'],
      )!,
      programNameSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_name_snapshot'],
      )!,
      defaultRestSecondsSnapshot: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}default_rest_seconds_snapshot'],
      )!,
      programSnapshotJson: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}program_snapshot_json'],
      )!,
    );
  }

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

class WorkoutTemplateProgram extends DataClass
    implements Insertable<WorkoutTemplateProgram> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String workoutTemplateId;
  final String? sourceProgramId;
  final int position;
  final String programNameSnapshot;
  final int defaultRestSecondsSnapshot;
  final String programSnapshotJson;
  const WorkoutTemplateProgram({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.workoutTemplateId,
    this.sourceProgramId,
    required this.position,
    required this.programNameSnapshot,
    required this.defaultRestSecondsSnapshot,
    required this.programSnapshotJson,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['workout_template_id'] = Variable<String>(workoutTemplateId);
    if (!nullToAbsent || sourceProgramId != null) {
      map['source_program_id'] = Variable<String>(sourceProgramId);
    }
    map['position'] = Variable<int>(position);
    map['program_name_snapshot'] = Variable<String>(programNameSnapshot);
    map['default_rest_seconds_snapshot'] = Variable<int>(
      defaultRestSecondsSnapshot,
    );
    map['program_snapshot_json'] = Variable<String>(programSnapshotJson);
    return map;
  }

  WorkoutTemplateProgramsCompanion toCompanion(bool nullToAbsent) {
    return WorkoutTemplateProgramsCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      workoutTemplateId: Value(workoutTemplateId),
      sourceProgramId: sourceProgramId == null && nullToAbsent
          ? const Value.absent()
          : Value(sourceProgramId),
      position: Value(position),
      programNameSnapshot: Value(programNameSnapshot),
      defaultRestSecondsSnapshot: Value(defaultRestSecondsSnapshot),
      programSnapshotJson: Value(programSnapshotJson),
    );
  }

  factory WorkoutTemplateProgram.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutTemplateProgram(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      workoutTemplateId: serializer.fromJson<String>(json['workoutTemplateId']),
      sourceProgramId: serializer.fromJson<String?>(json['sourceProgramId']),
      position: serializer.fromJson<int>(json['position']),
      programNameSnapshot: serializer.fromJson<String>(
        json['programNameSnapshot'],
      ),
      defaultRestSecondsSnapshot: serializer.fromJson<int>(
        json['defaultRestSecondsSnapshot'],
      ),
      programSnapshotJson: serializer.fromJson<String>(
        json['programSnapshotJson'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'workoutTemplateId': serializer.toJson<String>(workoutTemplateId),
      'sourceProgramId': serializer.toJson<String?>(sourceProgramId),
      'position': serializer.toJson<int>(position),
      'programNameSnapshot': serializer.toJson<String>(programNameSnapshot),
      'defaultRestSecondsSnapshot': serializer.toJson<int>(
        defaultRestSecondsSnapshot,
      ),
      'programSnapshotJson': serializer.toJson<String>(programSnapshotJson),
    };
  }

  WorkoutTemplateProgram copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? workoutTemplateId,
    Value<String?> sourceProgramId = const Value.absent(),
    int? position,
    String? programNameSnapshot,
    int? defaultRestSecondsSnapshot,
    String? programSnapshotJson,
  }) => WorkoutTemplateProgram(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    workoutTemplateId: workoutTemplateId ?? this.workoutTemplateId,
    sourceProgramId: sourceProgramId.present
        ? sourceProgramId.value
        : this.sourceProgramId,
    position: position ?? this.position,
    programNameSnapshot: programNameSnapshot ?? this.programNameSnapshot,
    defaultRestSecondsSnapshot:
        defaultRestSecondsSnapshot ?? this.defaultRestSecondsSnapshot,
    programSnapshotJson: programSnapshotJson ?? this.programSnapshotJson,
  );
  WorkoutTemplateProgram copyWithCompanion(
    WorkoutTemplateProgramsCompanion data,
  ) {
    return WorkoutTemplateProgram(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      workoutTemplateId: data.workoutTemplateId.present
          ? data.workoutTemplateId.value
          : this.workoutTemplateId,
      sourceProgramId: data.sourceProgramId.present
          ? data.sourceProgramId.value
          : this.sourceProgramId,
      position: data.position.present ? data.position.value : this.position,
      programNameSnapshot: data.programNameSnapshot.present
          ? data.programNameSnapshot.value
          : this.programNameSnapshot,
      defaultRestSecondsSnapshot: data.defaultRestSecondsSnapshot.present
          ? data.defaultRestSecondsSnapshot.value
          : this.defaultRestSecondsSnapshot,
      programSnapshotJson: data.programSnapshotJson.present
          ? data.programSnapshotJson.value
          : this.programSnapshotJson,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplateProgram(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutTemplateId: $workoutTemplateId, ')
          ..write('sourceProgramId: $sourceProgramId, ')
          ..write('position: $position, ')
          ..write('programNameSnapshot: $programNameSnapshot, ')
          ..write('defaultRestSecondsSnapshot: $defaultRestSecondsSnapshot, ')
          ..write('programSnapshotJson: $programSnapshotJson')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutTemplateId,
    sourceProgramId,
    position,
    programNameSnapshot,
    defaultRestSecondsSnapshot,
    programSnapshotJson,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutTemplateProgram &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.workoutTemplateId == this.workoutTemplateId &&
          other.sourceProgramId == this.sourceProgramId &&
          other.position == this.position &&
          other.programNameSnapshot == this.programNameSnapshot &&
          other.defaultRestSecondsSnapshot == this.defaultRestSecondsSnapshot &&
          other.programSnapshotJson == this.programSnapshotJson);
}

class WorkoutTemplateProgramsCompanion
    extends UpdateCompanion<WorkoutTemplateProgram> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> workoutTemplateId;
  final Value<String?> sourceProgramId;
  final Value<int> position;
  final Value<String> programNameSnapshot;
  final Value<int> defaultRestSecondsSnapshot;
  final Value<String> programSnapshotJson;
  final Value<int> rowid;
  const WorkoutTemplateProgramsCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.workoutTemplateId = const Value.absent(),
    this.sourceProgramId = const Value.absent(),
    this.position = const Value.absent(),
    this.programNameSnapshot = const Value.absent(),
    this.defaultRestSecondsSnapshot = const Value.absent(),
    this.programSnapshotJson = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutTemplateProgramsCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String workoutTemplateId,
    this.sourceProgramId = const Value.absent(),
    required int position,
    required String programNameSnapshot,
    required int defaultRestSecondsSnapshot,
    required String programSnapshotJson,
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       workoutTemplateId = Value(workoutTemplateId),
       position = Value(position),
       programNameSnapshot = Value(programNameSnapshot),
       defaultRestSecondsSnapshot = Value(defaultRestSecondsSnapshot),
       programSnapshotJson = Value(programSnapshotJson);
  static Insertable<WorkoutTemplateProgram> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? workoutTemplateId,
    Expression<String>? sourceProgramId,
    Expression<int>? position,
    Expression<String>? programNameSnapshot,
    Expression<int>? defaultRestSecondsSnapshot,
    Expression<String>? programSnapshotJson,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (workoutTemplateId != null) 'workout_template_id': workoutTemplateId,
      if (sourceProgramId != null) 'source_program_id': sourceProgramId,
      if (position != null) 'position': position,
      if (programNameSnapshot != null)
        'program_name_snapshot': programNameSnapshot,
      if (defaultRestSecondsSnapshot != null)
        'default_rest_seconds_snapshot': defaultRestSecondsSnapshot,
      if (programSnapshotJson != null)
        'program_snapshot_json': programSnapshotJson,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutTemplateProgramsCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? workoutTemplateId,
    Value<String?>? sourceProgramId,
    Value<int>? position,
    Value<String>? programNameSnapshot,
    Value<int>? defaultRestSecondsSnapshot,
    Value<String>? programSnapshotJson,
    Value<int>? rowid,
  }) {
    return WorkoutTemplateProgramsCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      workoutTemplateId: workoutTemplateId ?? this.workoutTemplateId,
      sourceProgramId: sourceProgramId ?? this.sourceProgramId,
      position: position ?? this.position,
      programNameSnapshot: programNameSnapshot ?? this.programNameSnapshot,
      defaultRestSecondsSnapshot:
          defaultRestSecondsSnapshot ?? this.defaultRestSecondsSnapshot,
      programSnapshotJson: programSnapshotJson ?? this.programSnapshotJson,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (workoutTemplateId.present) {
      map['workout_template_id'] = Variable<String>(workoutTemplateId.value);
    }
    if (sourceProgramId.present) {
      map['source_program_id'] = Variable<String>(sourceProgramId.value);
    }
    if (position.present) {
      map['position'] = Variable<int>(position.value);
    }
    if (programNameSnapshot.present) {
      map['program_name_snapshot'] = Variable<String>(
        programNameSnapshot.value,
      );
    }
    if (defaultRestSecondsSnapshot.present) {
      map['default_rest_seconds_snapshot'] = Variable<int>(
        defaultRestSecondsSnapshot.value,
      );
    }
    if (programSnapshotJson.present) {
      map['program_snapshot_json'] = Variable<String>(
        programSnapshotJson.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplateProgramsCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutTemplateId: $workoutTemplateId, ')
          ..write('sourceProgramId: $sourceProgramId, ')
          ..write('position: $position, ')
          ..write('programNameSnapshot: $programNameSnapshot, ')
          ..write('defaultRestSecondsSnapshot: $defaultRestSecondsSnapshot, ')
          ..write('programSnapshotJson: $programSnapshotJson, ')
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

class $WorkoutTemplateExerciseOverridesTable
    extends WorkoutTemplateExerciseOverrides
    with
        TableInfo<
          $WorkoutTemplateExerciseOverridesTable,
          WorkoutTemplateExerciseOverride
        > {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  $WorkoutTemplateExerciseOverridesTable(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<DateTime> createdAt = GeneratedColumn<DateTime>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _updatedAtMeta = const VerificationMeta(
    'updatedAt',
  );
  @override
  late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
    'updated_at',
    aliasedName,
    false,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _deletedAtMeta = const VerificationMeta(
    'deletedAt',
  );
  @override
  late final GeneratedColumn<DateTime> deletedAt = GeneratedColumn<DateTime>(
    'deleted_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _schemaVersionMeta = const VerificationMeta(
    'schemaVersion',
  );
  @override
  late final GeneratedColumn<int> schemaVersion = GeneratedColumn<int>(
    'schema_version',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    defaultValue: const Constant(1),
  );
  static const VerificationMeta _syncStateMeta = const VerificationMeta(
    'syncState',
  );
  @override
  late final GeneratedColumn<String> syncState = GeneratedColumn<String>(
    'sync_state',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints:
        'NOT NULL CHECK (sync_state IN (\'localOnly\', \'dirty\', \'synced\', \'deleted\'))',
  );
  static const VerificationMeta _localRevisionMeta = const VerificationMeta(
    'localRevision',
  );
  @override
  late final GeneratedColumn<int> localRevision = GeneratedColumn<int>(
    'local_revision',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL CHECK (local_revision >= 0)',
  );
  static const VerificationMeta _originDeviceIdMeta = const VerificationMeta(
    'originDeviceId',
  );
  @override
  late final GeneratedColumn<String> originDeviceId = GeneratedColumn<String>(
    'origin_device_id',
    aliasedName,
    false,
    additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
    type: DriftSqlType.string,
    requiredDuringInsert: true,
  );
  static const VerificationMeta _futureOwnerProfileIdMeta =
      const VerificationMeta('futureOwnerProfileId');
  @override
  late final GeneratedColumn<String> futureOwnerProfileId =
      GeneratedColumn<String>(
        'future_owner_profile_id',
        aliasedName,
        true,
        type: DriftSqlType.string,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _lastSyncedAtMeta = const VerificationMeta(
    'lastSyncedAt',
  );
  @override
  late final GeneratedColumn<DateTime> lastSyncedAt = GeneratedColumn<DateTime>(
    'last_synced_at',
    aliasedName,
    true,
    type: DriftSqlType.dateTime,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _remoteRevisionMeta = const VerificationMeta(
    'remoteRevision',
  );
  @override
  late final GeneratedColumn<String> remoteRevision = GeneratedColumn<String>(
    'remote_revision',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _workoutTemplateProgramIdMeta =
      const VerificationMeta('workoutTemplateProgramId');
  @override
  late final GeneratedColumn<String> workoutTemplateProgramId =
      GeneratedColumn<String>(
        'workout_template_program_id',
        aliasedName,
        false,
        type: DriftSqlType.string,
        requiredDuringInsert: true,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'REFERENCES workout_template_programs (id)',
        ),
      );
  static const VerificationMeta _snapshotProgramExerciseIdMeta =
      const VerificationMeta('snapshotProgramExerciseId');
  @override
  late final GeneratedColumn<String> snapshotProgramExerciseId =
      GeneratedColumn<String>(
        'snapshot_program_exercise_id',
        aliasedName,
        false,
        additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 1),
        type: DriftSqlType.string,
        requiredDuringInsert: true,
      );
  static const VerificationMeta _setsCountOverrideMeta = const VerificationMeta(
    'setsCountOverride',
  );
  @override
  late final GeneratedColumn<int> setsCountOverride = GeneratedColumn<int>(
    'sets_count_override',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetTimeSecondsOverrideMeta =
      const VerificationMeta('targetTimeSecondsOverride');
  @override
  late final GeneratedColumn<int> targetTimeSecondsOverride =
      GeneratedColumn<int>(
        'target_time_seconds_override',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetRepsOverrideMeta =
      const VerificationMeta('targetRepsOverride');
  @override
  late final GeneratedColumn<int> targetRepsOverride = GeneratedColumn<int>(
    'target_reps_override',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
  );
  static const VerificationMeta _targetScoreOverrideMeta =
      const VerificationMeta('targetScoreOverride');
  @override
  late final GeneratedColumn<double> targetScoreOverride =
      GeneratedColumn<double>(
        'target_score_override',
        aliasedName,
        true,
        type: DriftSqlType.double,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _targetScoreTimeMsOverrideMeta =
      const VerificationMeta('targetScoreTimeMsOverride');
  @override
  late final GeneratedColumn<int> targetScoreTimeMsOverride =
      GeneratedColumn<int>(
        'target_score_time_ms_override',
        aliasedName,
        true,
        type: DriftSqlType.int,
        requiredDuringInsert: false,
      );
  static const VerificationMeta _autoStartNextTimedStepOverrideMeta =
      const VerificationMeta('autoStartNextTimedStepOverride');
  @override
  late final GeneratedColumn<bool> autoStartNextTimedStepOverride =
      GeneratedColumn<bool>(
        'auto_start_next_timed_step_override',
        aliasedName,
        true,
        type: DriftSqlType.bool,
        requiredDuringInsert: false,
        defaultConstraints: GeneratedColumn.constraintIsAlways(
          'CHECK ("auto_start_next_timed_step_override" IN (0, 1))',
        ),
      );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutTemplateProgramId,
    snapshotProgramExerciseId,
    setsCountOverride,
    targetTimeSecondsOverride,
    targetRepsOverride,
    targetScoreOverride,
    targetScoreTimeMsOverride,
    autoStartNextTimedStepOverride,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'workout_template_exercise_overrides';
  @override
  VerificationContext validateIntegrity(
    Insertable<WorkoutTemplateExerciseOverride> 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('deleted_at')) {
      context.handle(
        _deletedAtMeta,
        deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
      );
    }
    if (data.containsKey('schema_version')) {
      context.handle(
        _schemaVersionMeta,
        schemaVersion.isAcceptableOrUnknown(
          data['schema_version']!,
          _schemaVersionMeta,
        ),
      );
    }
    if (data.containsKey('sync_state')) {
      context.handle(
        _syncStateMeta,
        syncState.isAcceptableOrUnknown(data['sync_state']!, _syncStateMeta),
      );
    } else if (isInserting) {
      context.missing(_syncStateMeta);
    }
    if (data.containsKey('local_revision')) {
      context.handle(
        _localRevisionMeta,
        localRevision.isAcceptableOrUnknown(
          data['local_revision']!,
          _localRevisionMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_localRevisionMeta);
    }
    if (data.containsKey('origin_device_id')) {
      context.handle(
        _originDeviceIdMeta,
        originDeviceId.isAcceptableOrUnknown(
          data['origin_device_id']!,
          _originDeviceIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_originDeviceIdMeta);
    }
    if (data.containsKey('future_owner_profile_id')) {
      context.handle(
        _futureOwnerProfileIdMeta,
        futureOwnerProfileId.isAcceptableOrUnknown(
          data['future_owner_profile_id']!,
          _futureOwnerProfileIdMeta,
        ),
      );
    }
    if (data.containsKey('last_synced_at')) {
      context.handle(
        _lastSyncedAtMeta,
        lastSyncedAt.isAcceptableOrUnknown(
          data['last_synced_at']!,
          _lastSyncedAtMeta,
        ),
      );
    }
    if (data.containsKey('remote_revision')) {
      context.handle(
        _remoteRevisionMeta,
        remoteRevision.isAcceptableOrUnknown(
          data['remote_revision']!,
          _remoteRevisionMeta,
        ),
      );
    }
    if (data.containsKey('workout_template_program_id')) {
      context.handle(
        _workoutTemplateProgramIdMeta,
        workoutTemplateProgramId.isAcceptableOrUnknown(
          data['workout_template_program_id']!,
          _workoutTemplateProgramIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_workoutTemplateProgramIdMeta);
    }
    if (data.containsKey('snapshot_program_exercise_id')) {
      context.handle(
        _snapshotProgramExerciseIdMeta,
        snapshotProgramExerciseId.isAcceptableOrUnknown(
          data['snapshot_program_exercise_id']!,
          _snapshotProgramExerciseIdMeta,
        ),
      );
    } else if (isInserting) {
      context.missing(_snapshotProgramExerciseIdMeta);
    }
    if (data.containsKey('sets_count_override')) {
      context.handle(
        _setsCountOverrideMeta,
        setsCountOverride.isAcceptableOrUnknown(
          data['sets_count_override']!,
          _setsCountOverrideMeta,
        ),
      );
    }
    if (data.containsKey('target_time_seconds_override')) {
      context.handle(
        _targetTimeSecondsOverrideMeta,
        targetTimeSecondsOverride.isAcceptableOrUnknown(
          data['target_time_seconds_override']!,
          _targetTimeSecondsOverrideMeta,
        ),
      );
    }
    if (data.containsKey('target_reps_override')) {
      context.handle(
        _targetRepsOverrideMeta,
        targetRepsOverride.isAcceptableOrUnknown(
          data['target_reps_override']!,
          _targetRepsOverrideMeta,
        ),
      );
    }
    if (data.containsKey('target_score_override')) {
      context.handle(
        _targetScoreOverrideMeta,
        targetScoreOverride.isAcceptableOrUnknown(
          data['target_score_override']!,
          _targetScoreOverrideMeta,
        ),
      );
    }
    if (data.containsKey('target_score_time_ms_override')) {
      context.handle(
        _targetScoreTimeMsOverrideMeta,
        targetScoreTimeMsOverride.isAcceptableOrUnknown(
          data['target_score_time_ms_override']!,
          _targetScoreTimeMsOverrideMeta,
        ),
      );
    }
    if (data.containsKey('auto_start_next_timed_step_override')) {
      context.handle(
        _autoStartNextTimedStepOverrideMeta,
        autoStartNextTimedStepOverride.isAcceptableOrUnknown(
          data['auto_start_next_timed_step_override']!,
          _autoStartNextTimedStepOverrideMeta,
        ),
      );
    }
    return context;
  }

  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  WorkoutTemplateExerciseOverride map(
    Map<String, dynamic> data, {
    String? tablePrefix,
  }) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return WorkoutTemplateExerciseOverride(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}id'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}created_at'],
      )!,
      updatedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}updated_at'],
      )!,
      deletedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}deleted_at'],
      ),
      schemaVersion: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}schema_version'],
      )!,
      syncState: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}sync_state'],
      )!,
      localRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}local_revision'],
      )!,
      originDeviceId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}origin_device_id'],
      )!,
      futureOwnerProfileId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}future_owner_profile_id'],
      ),
      lastSyncedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.dateTime,
        data['${effectivePrefix}last_synced_at'],
      ),
      remoteRevision: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}remote_revision'],
      ),
      workoutTemplateProgramId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}workout_template_program_id'],
      )!,
      snapshotProgramExerciseId: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}snapshot_program_exercise_id'],
      )!,
      setsCountOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sets_count_override'],
      ),
      targetTimeSecondsOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_time_seconds_override'],
      ),
      targetRepsOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_reps_override'],
      ),
      targetScoreOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.double,
        data['${effectivePrefix}target_score_override'],
      ),
      targetScoreTimeMsOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}target_score_time_ms_override'],
      ),
      autoStartNextTimedStepOverride: attachedDatabase.typeMapping.read(
        DriftSqlType.bool,
        data['${effectivePrefix}auto_start_next_timed_step_override'],
      ),
    );
  }

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

class WorkoutTemplateExerciseOverride extends DataClass
    implements Insertable<WorkoutTemplateExerciseOverride> {
  final String id;
  final DateTime createdAt;
  final DateTime updatedAt;
  final DateTime? deletedAt;
  final int schemaVersion;
  final String syncState;
  final int localRevision;
  final String originDeviceId;
  final String? futureOwnerProfileId;
  final DateTime? lastSyncedAt;
  final String? remoteRevision;
  final String workoutTemplateProgramId;
  final String snapshotProgramExerciseId;
  final int? setsCountOverride;
  final int? targetTimeSecondsOverride;
  final int? targetRepsOverride;
  final double? targetScoreOverride;
  final int? targetScoreTimeMsOverride;
  final bool? autoStartNextTimedStepOverride;
  const WorkoutTemplateExerciseOverride({
    required this.id,
    required this.createdAt,
    required this.updatedAt,
    this.deletedAt,
    required this.schemaVersion,
    required this.syncState,
    required this.localRevision,
    required this.originDeviceId,
    this.futureOwnerProfileId,
    this.lastSyncedAt,
    this.remoteRevision,
    required this.workoutTemplateProgramId,
    required this.snapshotProgramExerciseId,
    this.setsCountOverride,
    this.targetTimeSecondsOverride,
    this.targetRepsOverride,
    this.targetScoreOverride,
    this.targetScoreTimeMsOverride,
    this.autoStartNextTimedStepOverride,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<String>(id);
    map['created_at'] = Variable<DateTime>(createdAt);
    map['updated_at'] = Variable<DateTime>(updatedAt);
    if (!nullToAbsent || deletedAt != null) {
      map['deleted_at'] = Variable<DateTime>(deletedAt);
    }
    map['schema_version'] = Variable<int>(schemaVersion);
    map['sync_state'] = Variable<String>(syncState);
    map['local_revision'] = Variable<int>(localRevision);
    map['origin_device_id'] = Variable<String>(originDeviceId);
    if (!nullToAbsent || futureOwnerProfileId != null) {
      map['future_owner_profile_id'] = Variable<String>(futureOwnerProfileId);
    }
    if (!nullToAbsent || lastSyncedAt != null) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt);
    }
    if (!nullToAbsent || remoteRevision != null) {
      map['remote_revision'] = Variable<String>(remoteRevision);
    }
    map['workout_template_program_id'] = Variable<String>(
      workoutTemplateProgramId,
    );
    map['snapshot_program_exercise_id'] = Variable<String>(
      snapshotProgramExerciseId,
    );
    if (!nullToAbsent || setsCountOverride != null) {
      map['sets_count_override'] = Variable<int>(setsCountOverride);
    }
    if (!nullToAbsent || targetTimeSecondsOverride != null) {
      map['target_time_seconds_override'] = Variable<int>(
        targetTimeSecondsOverride,
      );
    }
    if (!nullToAbsent || targetRepsOverride != null) {
      map['target_reps_override'] = Variable<int>(targetRepsOverride);
    }
    if (!nullToAbsent || targetScoreOverride != null) {
      map['target_score_override'] = Variable<double>(targetScoreOverride);
    }
    if (!nullToAbsent || targetScoreTimeMsOverride != null) {
      map['target_score_time_ms_override'] = Variable<int>(
        targetScoreTimeMsOverride,
      );
    }
    if (!nullToAbsent || autoStartNextTimedStepOverride != null) {
      map['auto_start_next_timed_step_override'] = Variable<bool>(
        autoStartNextTimedStepOverride,
      );
    }
    return map;
  }

  WorkoutTemplateExerciseOverridesCompanion toCompanion(bool nullToAbsent) {
    return WorkoutTemplateExerciseOverridesCompanion(
      id: Value(id),
      createdAt: Value(createdAt),
      updatedAt: Value(updatedAt),
      deletedAt: deletedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(deletedAt),
      schemaVersion: Value(schemaVersion),
      syncState: Value(syncState),
      localRevision: Value(localRevision),
      originDeviceId: Value(originDeviceId),
      futureOwnerProfileId: futureOwnerProfileId == null && nullToAbsent
          ? const Value.absent()
          : Value(futureOwnerProfileId),
      lastSyncedAt: lastSyncedAt == null && nullToAbsent
          ? const Value.absent()
          : Value(lastSyncedAt),
      remoteRevision: remoteRevision == null && nullToAbsent
          ? const Value.absent()
          : Value(remoteRevision),
      workoutTemplateProgramId: Value(workoutTemplateProgramId),
      snapshotProgramExerciseId: Value(snapshotProgramExerciseId),
      setsCountOverride: setsCountOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(setsCountOverride),
      targetTimeSecondsOverride:
          targetTimeSecondsOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(targetTimeSecondsOverride),
      targetRepsOverride: targetRepsOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(targetRepsOverride),
      targetScoreOverride: targetScoreOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreOverride),
      targetScoreTimeMsOverride:
          targetScoreTimeMsOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(targetScoreTimeMsOverride),
      autoStartNextTimedStepOverride:
          autoStartNextTimedStepOverride == null && nullToAbsent
          ? const Value.absent()
          : Value(autoStartNextTimedStepOverride),
    );
  }

  factory WorkoutTemplateExerciseOverride.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return WorkoutTemplateExerciseOverride(
      id: serializer.fromJson<String>(json['id']),
      createdAt: serializer.fromJson<DateTime>(json['createdAt']),
      updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
      deletedAt: serializer.fromJson<DateTime?>(json['deletedAt']),
      schemaVersion: serializer.fromJson<int>(json['schemaVersion']),
      syncState: serializer.fromJson<String>(json['syncState']),
      localRevision: serializer.fromJson<int>(json['localRevision']),
      originDeviceId: serializer.fromJson<String>(json['originDeviceId']),
      futureOwnerProfileId: serializer.fromJson<String?>(
        json['futureOwnerProfileId'],
      ),
      lastSyncedAt: serializer.fromJson<DateTime?>(json['lastSyncedAt']),
      remoteRevision: serializer.fromJson<String?>(json['remoteRevision']),
      workoutTemplateProgramId: serializer.fromJson<String>(
        json['workoutTemplateProgramId'],
      ),
      snapshotProgramExerciseId: serializer.fromJson<String>(
        json['snapshotProgramExerciseId'],
      ),
      setsCountOverride: serializer.fromJson<int?>(json['setsCountOverride']),
      targetTimeSecondsOverride: serializer.fromJson<int?>(
        json['targetTimeSecondsOverride'],
      ),
      targetRepsOverride: serializer.fromJson<int?>(json['targetRepsOverride']),
      targetScoreOverride: serializer.fromJson<double?>(
        json['targetScoreOverride'],
      ),
      targetScoreTimeMsOverride: serializer.fromJson<int?>(
        json['targetScoreTimeMsOverride'],
      ),
      autoStartNextTimedStepOverride: serializer.fromJson<bool?>(
        json['autoStartNextTimedStepOverride'],
      ),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<String>(id),
      'createdAt': serializer.toJson<DateTime>(createdAt),
      'updatedAt': serializer.toJson<DateTime>(updatedAt),
      'deletedAt': serializer.toJson<DateTime?>(deletedAt),
      'schemaVersion': serializer.toJson<int>(schemaVersion),
      'syncState': serializer.toJson<String>(syncState),
      'localRevision': serializer.toJson<int>(localRevision),
      'originDeviceId': serializer.toJson<String>(originDeviceId),
      'futureOwnerProfileId': serializer.toJson<String?>(futureOwnerProfileId),
      'lastSyncedAt': serializer.toJson<DateTime?>(lastSyncedAt),
      'remoteRevision': serializer.toJson<String?>(remoteRevision),
      'workoutTemplateProgramId': serializer.toJson<String>(
        workoutTemplateProgramId,
      ),
      'snapshotProgramExerciseId': serializer.toJson<String>(
        snapshotProgramExerciseId,
      ),
      'setsCountOverride': serializer.toJson<int?>(setsCountOverride),
      'targetTimeSecondsOverride': serializer.toJson<int?>(
        targetTimeSecondsOverride,
      ),
      'targetRepsOverride': serializer.toJson<int?>(targetRepsOverride),
      'targetScoreOverride': serializer.toJson<double?>(targetScoreOverride),
      'targetScoreTimeMsOverride': serializer.toJson<int?>(
        targetScoreTimeMsOverride,
      ),
      'autoStartNextTimedStepOverride': serializer.toJson<bool?>(
        autoStartNextTimedStepOverride,
      ),
    };
  }

  WorkoutTemplateExerciseOverride copyWith({
    String? id,
    DateTime? createdAt,
    DateTime? updatedAt,
    Value<DateTime?> deletedAt = const Value.absent(),
    int? schemaVersion,
    String? syncState,
    int? localRevision,
    String? originDeviceId,
    Value<String?> futureOwnerProfileId = const Value.absent(),
    Value<DateTime?> lastSyncedAt = const Value.absent(),
    Value<String?> remoteRevision = const Value.absent(),
    String? workoutTemplateProgramId,
    String? snapshotProgramExerciseId,
    Value<int?> setsCountOverride = const Value.absent(),
    Value<int?> targetTimeSecondsOverride = const Value.absent(),
    Value<int?> targetRepsOverride = const Value.absent(),
    Value<double?> targetScoreOverride = const Value.absent(),
    Value<int?> targetScoreTimeMsOverride = const Value.absent(),
    Value<bool?> autoStartNextTimedStepOverride = const Value.absent(),
  }) => WorkoutTemplateExerciseOverride(
    id: id ?? this.id,
    createdAt: createdAt ?? this.createdAt,
    updatedAt: updatedAt ?? this.updatedAt,
    deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
    schemaVersion: schemaVersion ?? this.schemaVersion,
    syncState: syncState ?? this.syncState,
    localRevision: localRevision ?? this.localRevision,
    originDeviceId: originDeviceId ?? this.originDeviceId,
    futureOwnerProfileId: futureOwnerProfileId.present
        ? futureOwnerProfileId.value
        : this.futureOwnerProfileId,
    lastSyncedAt: lastSyncedAt.present ? lastSyncedAt.value : this.lastSyncedAt,
    remoteRevision: remoteRevision.present
        ? remoteRevision.value
        : this.remoteRevision,
    workoutTemplateProgramId:
        workoutTemplateProgramId ?? this.workoutTemplateProgramId,
    snapshotProgramExerciseId:
        snapshotProgramExerciseId ?? this.snapshotProgramExerciseId,
    setsCountOverride: setsCountOverride.present
        ? setsCountOverride.value
        : this.setsCountOverride,
    targetTimeSecondsOverride: targetTimeSecondsOverride.present
        ? targetTimeSecondsOverride.value
        : this.targetTimeSecondsOverride,
    targetRepsOverride: targetRepsOverride.present
        ? targetRepsOverride.value
        : this.targetRepsOverride,
    targetScoreOverride: targetScoreOverride.present
        ? targetScoreOverride.value
        : this.targetScoreOverride,
    targetScoreTimeMsOverride: targetScoreTimeMsOverride.present
        ? targetScoreTimeMsOverride.value
        : this.targetScoreTimeMsOverride,
    autoStartNextTimedStepOverride: autoStartNextTimedStepOverride.present
        ? autoStartNextTimedStepOverride.value
        : this.autoStartNextTimedStepOverride,
  );
  WorkoutTemplateExerciseOverride copyWithCompanion(
    WorkoutTemplateExerciseOverridesCompanion data,
  ) {
    return WorkoutTemplateExerciseOverride(
      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,
      deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
      schemaVersion: data.schemaVersion.present
          ? data.schemaVersion.value
          : this.schemaVersion,
      syncState: data.syncState.present ? data.syncState.value : this.syncState,
      localRevision: data.localRevision.present
          ? data.localRevision.value
          : this.localRevision,
      originDeviceId: data.originDeviceId.present
          ? data.originDeviceId.value
          : this.originDeviceId,
      futureOwnerProfileId: data.futureOwnerProfileId.present
          ? data.futureOwnerProfileId.value
          : this.futureOwnerProfileId,
      lastSyncedAt: data.lastSyncedAt.present
          ? data.lastSyncedAt.value
          : this.lastSyncedAt,
      remoteRevision: data.remoteRevision.present
          ? data.remoteRevision.value
          : this.remoteRevision,
      workoutTemplateProgramId: data.workoutTemplateProgramId.present
          ? data.workoutTemplateProgramId.value
          : this.workoutTemplateProgramId,
      snapshotProgramExerciseId: data.snapshotProgramExerciseId.present
          ? data.snapshotProgramExerciseId.value
          : this.snapshotProgramExerciseId,
      setsCountOverride: data.setsCountOverride.present
          ? data.setsCountOverride.value
          : this.setsCountOverride,
      targetTimeSecondsOverride: data.targetTimeSecondsOverride.present
          ? data.targetTimeSecondsOverride.value
          : this.targetTimeSecondsOverride,
      targetRepsOverride: data.targetRepsOverride.present
          ? data.targetRepsOverride.value
          : this.targetRepsOverride,
      targetScoreOverride: data.targetScoreOverride.present
          ? data.targetScoreOverride.value
          : this.targetScoreOverride,
      targetScoreTimeMsOverride: data.targetScoreTimeMsOverride.present
          ? data.targetScoreTimeMsOverride.value
          : this.targetScoreTimeMsOverride,
      autoStartNextTimedStepOverride:
          data.autoStartNextTimedStepOverride.present
          ? data.autoStartNextTimedStepOverride.value
          : this.autoStartNextTimedStepOverride,
    );
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplateExerciseOverride(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutTemplateProgramId: $workoutTemplateProgramId, ')
          ..write('snapshotProgramExerciseId: $snapshotProgramExerciseId, ')
          ..write('setsCountOverride: $setsCountOverride, ')
          ..write('targetTimeSecondsOverride: $targetTimeSecondsOverride, ')
          ..write('targetRepsOverride: $targetRepsOverride, ')
          ..write('targetScoreOverride: $targetScoreOverride, ')
          ..write('targetScoreTimeMsOverride: $targetScoreTimeMsOverride, ')
          ..write(
            'autoStartNextTimedStepOverride: $autoStartNextTimedStepOverride',
          )
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    createdAt,
    updatedAt,
    deletedAt,
    schemaVersion,
    syncState,
    localRevision,
    originDeviceId,
    futureOwnerProfileId,
    lastSyncedAt,
    remoteRevision,
    workoutTemplateProgramId,
    snapshotProgramExerciseId,
    setsCountOverride,
    targetTimeSecondsOverride,
    targetRepsOverride,
    targetScoreOverride,
    targetScoreTimeMsOverride,
    autoStartNextTimedStepOverride,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is WorkoutTemplateExerciseOverride &&
          other.id == this.id &&
          other.createdAt == this.createdAt &&
          other.updatedAt == this.updatedAt &&
          other.deletedAt == this.deletedAt &&
          other.schemaVersion == this.schemaVersion &&
          other.syncState == this.syncState &&
          other.localRevision == this.localRevision &&
          other.originDeviceId == this.originDeviceId &&
          other.futureOwnerProfileId == this.futureOwnerProfileId &&
          other.lastSyncedAt == this.lastSyncedAt &&
          other.remoteRevision == this.remoteRevision &&
          other.workoutTemplateProgramId == this.workoutTemplateProgramId &&
          other.snapshotProgramExerciseId == this.snapshotProgramExerciseId &&
          other.setsCountOverride == this.setsCountOverride &&
          other.targetTimeSecondsOverride == this.targetTimeSecondsOverride &&
          other.targetRepsOverride == this.targetRepsOverride &&
          other.targetScoreOverride == this.targetScoreOverride &&
          other.targetScoreTimeMsOverride == this.targetScoreTimeMsOverride &&
          other.autoStartNextTimedStepOverride ==
              this.autoStartNextTimedStepOverride);
}

class WorkoutTemplateExerciseOverridesCompanion
    extends UpdateCompanion<WorkoutTemplateExerciseOverride> {
  final Value<String> id;
  final Value<DateTime> createdAt;
  final Value<DateTime> updatedAt;
  final Value<DateTime?> deletedAt;
  final Value<int> schemaVersion;
  final Value<String> syncState;
  final Value<int> localRevision;
  final Value<String> originDeviceId;
  final Value<String?> futureOwnerProfileId;
  final Value<DateTime?> lastSyncedAt;
  final Value<String?> remoteRevision;
  final Value<String> workoutTemplateProgramId;
  final Value<String> snapshotProgramExerciseId;
  final Value<int?> setsCountOverride;
  final Value<int?> targetTimeSecondsOverride;
  final Value<int?> targetRepsOverride;
  final Value<double?> targetScoreOverride;
  final Value<int?> targetScoreTimeMsOverride;
  final Value<bool?> autoStartNextTimedStepOverride;
  final Value<int> rowid;
  const WorkoutTemplateExerciseOverridesCompanion({
    this.id = const Value.absent(),
    this.createdAt = const Value.absent(),
    this.updatedAt = const Value.absent(),
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    this.syncState = const Value.absent(),
    this.localRevision = const Value.absent(),
    this.originDeviceId = const Value.absent(),
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    this.workoutTemplateProgramId = const Value.absent(),
    this.snapshotProgramExerciseId = const Value.absent(),
    this.setsCountOverride = const Value.absent(),
    this.targetTimeSecondsOverride = const Value.absent(),
    this.targetRepsOverride = const Value.absent(),
    this.targetScoreOverride = const Value.absent(),
    this.targetScoreTimeMsOverride = const Value.absent(),
    this.autoStartNextTimedStepOverride = const Value.absent(),
    this.rowid = const Value.absent(),
  });
  WorkoutTemplateExerciseOverridesCompanion.insert({
    required String id,
    required DateTime createdAt,
    required DateTime updatedAt,
    this.deletedAt = const Value.absent(),
    this.schemaVersion = const Value.absent(),
    required String syncState,
    required int localRevision,
    required String originDeviceId,
    this.futureOwnerProfileId = const Value.absent(),
    this.lastSyncedAt = const Value.absent(),
    this.remoteRevision = const Value.absent(),
    required String workoutTemplateProgramId,
    required String snapshotProgramExerciseId,
    this.setsCountOverride = const Value.absent(),
    this.targetTimeSecondsOverride = const Value.absent(),
    this.targetRepsOverride = const Value.absent(),
    this.targetScoreOverride = const Value.absent(),
    this.targetScoreTimeMsOverride = const Value.absent(),
    this.autoStartNextTimedStepOverride = const Value.absent(),
    this.rowid = const Value.absent(),
  }) : id = Value(id),
       createdAt = Value(createdAt),
       updatedAt = Value(updatedAt),
       syncState = Value(syncState),
       localRevision = Value(localRevision),
       originDeviceId = Value(originDeviceId),
       workoutTemplateProgramId = Value(workoutTemplateProgramId),
       snapshotProgramExerciseId = Value(snapshotProgramExerciseId);
  static Insertable<WorkoutTemplateExerciseOverride> custom({
    Expression<String>? id,
    Expression<DateTime>? createdAt,
    Expression<DateTime>? updatedAt,
    Expression<DateTime>? deletedAt,
    Expression<int>? schemaVersion,
    Expression<String>? syncState,
    Expression<int>? localRevision,
    Expression<String>? originDeviceId,
    Expression<String>? futureOwnerProfileId,
    Expression<DateTime>? lastSyncedAt,
    Expression<String>? remoteRevision,
    Expression<String>? workoutTemplateProgramId,
    Expression<String>? snapshotProgramExerciseId,
    Expression<int>? setsCountOverride,
    Expression<int>? targetTimeSecondsOverride,
    Expression<int>? targetRepsOverride,
    Expression<double>? targetScoreOverride,
    Expression<int>? targetScoreTimeMsOverride,
    Expression<bool>? autoStartNextTimedStepOverride,
    Expression<int>? rowid,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (createdAt != null) 'created_at': createdAt,
      if (updatedAt != null) 'updated_at': updatedAt,
      if (deletedAt != null) 'deleted_at': deletedAt,
      if (schemaVersion != null) 'schema_version': schemaVersion,
      if (syncState != null) 'sync_state': syncState,
      if (localRevision != null) 'local_revision': localRevision,
      if (originDeviceId != null) 'origin_device_id': originDeviceId,
      if (futureOwnerProfileId != null)
        'future_owner_profile_id': futureOwnerProfileId,
      if (lastSyncedAt != null) 'last_synced_at': lastSyncedAt,
      if (remoteRevision != null) 'remote_revision': remoteRevision,
      if (workoutTemplateProgramId != null)
        'workout_template_program_id': workoutTemplateProgramId,
      if (snapshotProgramExerciseId != null)
        'snapshot_program_exercise_id': snapshotProgramExerciseId,
      if (setsCountOverride != null) 'sets_count_override': setsCountOverride,
      if (targetTimeSecondsOverride != null)
        'target_time_seconds_override': targetTimeSecondsOverride,
      if (targetRepsOverride != null)
        'target_reps_override': targetRepsOverride,
      if (targetScoreOverride != null)
        'target_score_override': targetScoreOverride,
      if (targetScoreTimeMsOverride != null)
        'target_score_time_ms_override': targetScoreTimeMsOverride,
      if (autoStartNextTimedStepOverride != null)
        'auto_start_next_timed_step_override': autoStartNextTimedStepOverride,
      if (rowid != null) 'rowid': rowid,
    });
  }

  WorkoutTemplateExerciseOverridesCompanion copyWith({
    Value<String>? id,
    Value<DateTime>? createdAt,
    Value<DateTime>? updatedAt,
    Value<DateTime?>? deletedAt,
    Value<int>? schemaVersion,
    Value<String>? syncState,
    Value<int>? localRevision,
    Value<String>? originDeviceId,
    Value<String?>? futureOwnerProfileId,
    Value<DateTime?>? lastSyncedAt,
    Value<String?>? remoteRevision,
    Value<String>? workoutTemplateProgramId,
    Value<String>? snapshotProgramExerciseId,
    Value<int?>? setsCountOverride,
    Value<int?>? targetTimeSecondsOverride,
    Value<int?>? targetRepsOverride,
    Value<double?>? targetScoreOverride,
    Value<int?>? targetScoreTimeMsOverride,
    Value<bool?>? autoStartNextTimedStepOverride,
    Value<int>? rowid,
  }) {
    return WorkoutTemplateExerciseOverridesCompanion(
      id: id ?? this.id,
      createdAt: createdAt ?? this.createdAt,
      updatedAt: updatedAt ?? this.updatedAt,
      deletedAt: deletedAt ?? this.deletedAt,
      schemaVersion: schemaVersion ?? this.schemaVersion,
      syncState: syncState ?? this.syncState,
      localRevision: localRevision ?? this.localRevision,
      originDeviceId: originDeviceId ?? this.originDeviceId,
      futureOwnerProfileId: futureOwnerProfileId ?? this.futureOwnerProfileId,
      lastSyncedAt: lastSyncedAt ?? this.lastSyncedAt,
      remoteRevision: remoteRevision ?? this.remoteRevision,
      workoutTemplateProgramId:
          workoutTemplateProgramId ?? this.workoutTemplateProgramId,
      snapshotProgramExerciseId:
          snapshotProgramExerciseId ?? this.snapshotProgramExerciseId,
      setsCountOverride: setsCountOverride ?? this.setsCountOverride,
      targetTimeSecondsOverride:
          targetTimeSecondsOverride ?? this.targetTimeSecondsOverride,
      targetRepsOverride: targetRepsOverride ?? this.targetRepsOverride,
      targetScoreOverride: targetScoreOverride ?? this.targetScoreOverride,
      targetScoreTimeMsOverride:
          targetScoreTimeMsOverride ?? this.targetScoreTimeMsOverride,
      autoStartNextTimedStepOverride:
          autoStartNextTimedStepOverride ?? this.autoStartNextTimedStepOverride,
      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<DateTime>(createdAt.value);
    }
    if (updatedAt.present) {
      map['updated_at'] = Variable<DateTime>(updatedAt.value);
    }
    if (deletedAt.present) {
      map['deleted_at'] = Variable<DateTime>(deletedAt.value);
    }
    if (schemaVersion.present) {
      map['schema_version'] = Variable<int>(schemaVersion.value);
    }
    if (syncState.present) {
      map['sync_state'] = Variable<String>(syncState.value);
    }
    if (localRevision.present) {
      map['local_revision'] = Variable<int>(localRevision.value);
    }
    if (originDeviceId.present) {
      map['origin_device_id'] = Variable<String>(originDeviceId.value);
    }
    if (futureOwnerProfileId.present) {
      map['future_owner_profile_id'] = Variable<String>(
        futureOwnerProfileId.value,
      );
    }
    if (lastSyncedAt.present) {
      map['last_synced_at'] = Variable<DateTime>(lastSyncedAt.value);
    }
    if (remoteRevision.present) {
      map['remote_revision'] = Variable<String>(remoteRevision.value);
    }
    if (workoutTemplateProgramId.present) {
      map['workout_template_program_id'] = Variable<String>(
        workoutTemplateProgramId.value,
      );
    }
    if (snapshotProgramExerciseId.present) {
      map['snapshot_program_exercise_id'] = Variable<String>(
        snapshotProgramExerciseId.value,
      );
    }
    if (setsCountOverride.present) {
      map['sets_count_override'] = Variable<int>(setsCountOverride.value);
    }
    if (targetTimeSecondsOverride.present) {
      map['target_time_seconds_override'] = Variable<int>(
        targetTimeSecondsOverride.value,
      );
    }
    if (targetRepsOverride.present) {
      map['target_reps_override'] = Variable<int>(targetRepsOverride.value);
    }
    if (targetScoreOverride.present) {
      map['target_score_override'] = Variable<double>(
        targetScoreOverride.value,
      );
    }
    if (targetScoreTimeMsOverride.present) {
      map['target_score_time_ms_override'] = Variable<int>(
        targetScoreTimeMsOverride.value,
      );
    }
    if (autoStartNextTimedStepOverride.present) {
      map['auto_start_next_timed_step_override'] = Variable<bool>(
        autoStartNextTimedStepOverride.value,
      );
    }
    if (rowid.present) {
      map['rowid'] = Variable<int>(rowid.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('WorkoutTemplateExerciseOverridesCompanion(')
          ..write('id: $id, ')
          ..write('createdAt: $createdAt, ')
          ..write('updatedAt: $updatedAt, ')
          ..write('deletedAt: $deletedAt, ')
          ..write('schemaVersion: $schemaVersion, ')
          ..write('syncState: $syncState, ')
          ..write('localRevision: $localRevision, ')
          ..write('originDeviceId: $originDeviceId, ')
          ..write('futureOwnerProfileId: $futureOwnerProfileId, ')
          ..write('lastSyncedAt: $lastSyncedAt, ')
          ..write('remoteRevision: $remoteRevision, ')
          ..write('workoutTemplateProgramId: $workoutTemplateProgramId, ')
          ..write('snapshotProgramExerciseId: $snapshotProgramExerciseId, ')
          ..write('setsCountOverride: $setsCountOverride, ')
          ..write('targetTimeSecondsOverride: $targetTimeSecondsOverride, ')
          ..write('targetRepsOverride: $targetRepsOverride, ')
          ..write('targetScoreOverride: $targetScoreOverride, ')
          ..write('targetScoreTimeMsOverride: $targetScoreTimeMsOverride, ')
          ..write(
            'autoStartNextTimedStepOverride: $autoStartNextTimedStepOverride, ',
          )
          ..write('rowid: $rowid')
          ..write(')'))
        .toString();
  }
}

abstract class _$AppDatabase extends GeneratedDatabase {
  _$AppDatabase(QueryExecutor e) : super(e);
  $AppDatabaseManager get managers => $AppDatabaseManager(this);
  late final $WorkoutTemplatesTable workoutTemplates = $WorkoutTemplatesTable(
    this,
  );
  late final $ActiveWorkoutSessionsTable activeWorkoutSessions =
      $ActiveWorkoutSessionsTable(this);
  late final $ActiveExerciseStepProgressStatesTable
  activeExerciseStepProgressStates = $ActiveExerciseStepProgressStatesTable(
    this,
  );
  late final $ActiveExerciseStepResultsTable activeExerciseStepResults =
      $ActiveExerciseStepResultsTable(this);
  late final $ActiveRestStatesTable activeRestStates = $ActiveRestStatesTable(
    this,
  );
  late final $ActiveScoreStopwatchStatesTable activeScoreStopwatchStates =
      $ActiveScoreStopwatchStatesTable(this);
  late final $ActiveSetTimerStatesTable activeSetTimerStates =
      $ActiveSetTimerStatesTable(this);
  late final $ActiveSetResultsTable activeSetResults = $ActiveSetResultsTable(
    this,
  );
  late final $ChangeLogEntriesTable changeLogEntries = $ChangeLogEntriesTable(
    this,
  );
  late final $MediaAssetsTable mediaAssets = $MediaAssetsTable(this);
  late final $ExercisesTable exercises = $ExercisesTable(this);
  late final $ExerciseImagesTable exerciseImages = $ExerciseImagesTable(this);
  late final $ExerciseStepsTable exerciseSteps = $ExerciseStepsTable(this);
  late final $LocalSeedMetadataTable localSeedMetadata =
      $LocalSeedMetadataTable(this);
  late final $OnlineAccountSessionsTable onlineAccountSessions =
      $OnlineAccountSessionsTable(this);
  late final $PendingShareActionsTable pendingShareActions =
      $PendingShareActionsTable(this);
  late final $ProgramsTable programs = $ProgramsTable(this);
  late final $ProgramExercisesTable programExercises = $ProgramExercisesTable(
    this,
  );
  late final $RemoteResourceMappingsTable remoteResourceMappings =
      $RemoteResourceMappingsTable(this);
  late final $ShareInboxItemsTable shareInboxItems = $ShareInboxItemsTable(
    this,
  );
  late final $SyncMetadataEntriesTable syncMetadataEntries =
      $SyncMetadataEntriesTable(this);
  late final $WorkoutHistoriesTable workoutHistories = $WorkoutHistoriesTable(
    this,
  );
  late final $WorkoutHistorySetResultsTable workoutHistorySetResults =
      $WorkoutHistorySetResultsTable(this);
  late final $WorkoutHistoryStepResultsTable workoutHistoryStepResults =
      $WorkoutHistoryStepResultsTable(this);
  late final $WorkoutTemplateProgramsTable workoutTemplatePrograms =
      $WorkoutTemplateProgramsTable(this);
  late final $WorkoutTemplateExerciseOverridesTable
  workoutTemplateExerciseOverrides = $WorkoutTemplateExerciseOverridesTable(
    this,
  );
  @override
  Iterable<TableInfo<Table, Object?>> get allTables =>
      allSchemaEntities.whereType<TableInfo<Table, Object?>>();
  @override
  List<DatabaseSchemaEntity> get allSchemaEntities => [
    workoutTemplates,
    activeWorkoutSessions,
    activeExerciseStepProgressStates,
    activeExerciseStepResults,
    activeRestStates,
    activeScoreStopwatchStates,
    activeSetTimerStates,
    activeSetResults,
    changeLogEntries,
    mediaAssets,
    exercises,
    exerciseImages,
    exerciseSteps,
    localSeedMetadata,
    onlineAccountSessions,
    pendingShareActions,
    programs,
    programExercises,
    remoteResourceMappings,
    shareInboxItems,
    syncMetadataEntries,
    workoutHistories,
    workoutHistorySetResults,
    workoutHistoryStepResults,
    workoutTemplatePrograms,
    workoutTemplateExerciseOverrides,
  ];
}

typedef $$WorkoutTemplatesTableCreateCompanionBuilder =
    WorkoutTemplatesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String name,
      Value<DateTime?> lastStartedAt,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<int> rowid,
    });
typedef $$WorkoutTemplatesTableUpdateCompanionBuilder =
    WorkoutTemplatesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> name,
      Value<DateTime?> lastStartedAt,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<int> rowid,
    });

final class $$WorkoutTemplatesTableReferences
    extends
        BaseReferences<_$AppDatabase, $WorkoutTemplatesTable, WorkoutTemplate> {
  $$WorkoutTemplatesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static MultiTypedResultKey<
    $ActiveWorkoutSessionsTable,
    List<ActiveWorkoutSession>
  >
  _activeWorkoutSessionsRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.activeWorkoutSessions,
    aliasName:
        'workout_templates__id__active_workout_sessions__source_workout_template_id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager
  get activeWorkoutSessionsRefs {
    final manager =
        $$ActiveWorkoutSessionsTableTableManager(
          $_db,
          $_db.activeWorkoutSessions,
        ).filter(
          (f) => f.sourceWorkoutTemplateId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeWorkoutSessionsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$WorkoutHistoriesTable, List<WorkoutHistory>>
  _workoutHistoriesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.workoutHistories,
    aliasName:
        'workout_templates__id__workout_history__source_workout_template_id',
  );

  $$WorkoutHistoriesTableProcessedTableManager get workoutHistoriesRefs {
    final manager =
        $$WorkoutHistoriesTableTableManager($_db, $_db.workoutHistories).filter(
          (f) => f.sourceWorkoutTemplateId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutHistoriesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $WorkoutTemplateProgramsTable,
    List<WorkoutTemplateProgram>
  >
  _workoutTemplateProgramsRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.workoutTemplatePrograms,
    aliasName:
        'workout_templates__id__workout_template_programs__workout_template_id',
  );

  $$WorkoutTemplateProgramsTableProcessedTableManager
  get workoutTemplateProgramsRefs {
    final manager =
        $$WorkoutTemplateProgramsTableTableManager(
          $_db,
          $_db.workoutTemplatePrograms,
        ).filter(
          (f) => f.workoutTemplateId.id.sqlEquals($_itemColumn<String>('id')!),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutTemplateProgramsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$WorkoutTemplatesTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutTemplatesTable> {
  $$WorkoutTemplatesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

  Expression<bool> activeWorkoutSessionsRefs(
    Expression<bool> Function($$ActiveWorkoutSessionsTableFilterComposer f) f,
  ) {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.sourceWorkoutTemplateId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<bool> workoutHistoriesRefs(
    Expression<bool> Function($$WorkoutHistoriesTableFilterComposer f) f,
  ) {
    final $$WorkoutHistoriesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.sourceWorkoutTemplateId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableFilterComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> workoutTemplateProgramsRefs(
    Expression<bool> Function($$WorkoutTemplateProgramsTableFilterComposer f) f,
  ) {
    final $$WorkoutTemplateProgramsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.workoutTemplateId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableFilterComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutTemplatesTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutTemplatesTable> {
  $$WorkoutTemplatesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  Expression<T> activeWorkoutSessionsRefs<T extends Object>(
    Expression<T> Function($$ActiveWorkoutSessionsTableAnnotationComposer a) f,
  ) {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.sourceWorkoutTemplateId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> workoutHistoriesRefs<T extends Object>(
    Expression<T> Function($$WorkoutHistoriesTableAnnotationComposer a) f,
  ) {
    final $$WorkoutHistoriesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.sourceWorkoutTemplateId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> workoutTemplateProgramsRefs<T extends Object>(
    Expression<T> Function($$WorkoutTemplateProgramsTableAnnotationComposer a)
    f,
  ) {
    final $$WorkoutTemplateProgramsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.workoutTemplateId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutTemplatesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutTemplatesTable,
          WorkoutTemplate,
          $$WorkoutTemplatesTableFilterComposer,
          $$WorkoutTemplatesTableOrderingComposer,
          $$WorkoutTemplatesTableAnnotationComposer,
          $$WorkoutTemplatesTableCreateCompanionBuilder,
          $$WorkoutTemplatesTableUpdateCompanionBuilder,
          (WorkoutTemplate, $$WorkoutTemplatesTableReferences),
          WorkoutTemplate,
          PrefetchHooks Function({
            bool activeWorkoutSessionsRefs,
            bool workoutHistoriesRefs,
            bool workoutTemplateProgramsRefs,
          })
        > {
  $$WorkoutTemplatesTableTableManager(
    _$AppDatabase db,
    $WorkoutTemplatesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutTemplatesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$WorkoutTemplatesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$WorkoutTemplatesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<DateTime?> lastStartedAt = const Value.absent(),
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplatesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                lastStartedAt: lastStartedAt,
                isExample: isExample,
                tagsJson: tagsJson,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String name,
                Value<DateTime?> lastStartedAt = const Value.absent(),
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplatesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                lastStartedAt: lastStartedAt,
                isExample: isExample,
                tagsJson: tagsJson,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutTemplatesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                activeWorkoutSessionsRefs = false,
                workoutHistoriesRefs = false,
                workoutTemplateProgramsRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (activeWorkoutSessionsRefs) db.activeWorkoutSessions,
                    if (workoutHistoriesRefs) db.workoutHistories,
                    if (workoutTemplateProgramsRefs) db.workoutTemplatePrograms,
                  ],
                  addJoins: null,
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (activeWorkoutSessionsRefs)
                        await $_getPrefetchedData<
                          WorkoutTemplate,
                          $WorkoutTemplatesTable,
                          ActiveWorkoutSession
                        >(
                          currentTable: table,
                          referencedTable: $$WorkoutTemplatesTableReferences
                              ._activeWorkoutSessionsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutTemplatesTableReferences(
                                db,
                                table,
                                p0,
                              ).activeWorkoutSessionsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.sourceWorkoutTemplateId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (workoutHistoriesRefs)
                        await $_getPrefetchedData<
                          WorkoutTemplate,
                          $WorkoutTemplatesTable,
                          WorkoutHistory
                        >(
                          currentTable: table,
                          referencedTable: $$WorkoutTemplatesTableReferences
                              ._workoutHistoriesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutTemplatesTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutHistoriesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.sourceWorkoutTemplateId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (workoutTemplateProgramsRefs)
                        await $_getPrefetchedData<
                          WorkoutTemplate,
                          $WorkoutTemplatesTable,
                          WorkoutTemplateProgram
                        >(
                          currentTable: table,
                          referencedTable: $$WorkoutTemplatesTableReferences
                              ._workoutTemplateProgramsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutTemplatesTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutTemplateProgramsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.workoutTemplateId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$WorkoutTemplatesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutTemplatesTable,
      WorkoutTemplate,
      $$WorkoutTemplatesTableFilterComposer,
      $$WorkoutTemplatesTableOrderingComposer,
      $$WorkoutTemplatesTableAnnotationComposer,
      $$WorkoutTemplatesTableCreateCompanionBuilder,
      $$WorkoutTemplatesTableUpdateCompanionBuilder,
      (WorkoutTemplate, $$WorkoutTemplatesTableReferences),
      WorkoutTemplate,
      PrefetchHooks Function({
        bool activeWorkoutSessionsRefs,
        bool workoutHistoriesRefs,
        bool workoutTemplateProgramsRefs,
      })
    >;
typedef $$ActiveWorkoutSessionsTableCreateCompanionBuilder =
    ActiveWorkoutSessionsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String?> sourceWorkoutTemplateId,
      required String status,
      required DateTime startedAt,
      Value<DateTime?> pausedAt,
      Value<DateTime?> endedAt,
      required DateTime lastPersistedAt,
      required int elapsedActiveMs,
      required int currentProgramIndex,
      required int currentExerciseIndex,
      required int currentSetIndex,
      required String resolvedTemplateSnapshotJson,
      Value<int> rowid,
    });
typedef $$ActiveWorkoutSessionsTableUpdateCompanionBuilder =
    ActiveWorkoutSessionsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String?> sourceWorkoutTemplateId,
      Value<String> status,
      Value<DateTime> startedAt,
      Value<DateTime?> pausedAt,
      Value<DateTime?> endedAt,
      Value<DateTime> lastPersistedAt,
      Value<int> elapsedActiveMs,
      Value<int> currentProgramIndex,
      Value<int> currentExerciseIndex,
      Value<int> currentSetIndex,
      Value<String> resolvedTemplateSnapshotJson,
      Value<int> rowid,
    });

final class $$ActiveWorkoutSessionsTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $ActiveWorkoutSessionsTable,
          ActiveWorkoutSession
        > {
  $$ActiveWorkoutSessionsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutTemplatesTable _sourceWorkoutTemplateIdTable(
    _$AppDatabase db,
  ) => db.workoutTemplates.createAlias(
    'active_workout_sessions__source_workout_template_id__workout_templates__id',
  );

  $$WorkoutTemplatesTableProcessedTableManager? get sourceWorkoutTemplateId {
    final $_column = $_itemColumn<String>('source_workout_template_id');
    if ($_column == null) return null;
    final manager = $$WorkoutTemplatesTableTableManager(
      $_db,
      $_db.workoutTemplates,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _sourceWorkoutTemplateIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static MultiTypedResultKey<
    $ActiveExerciseStepProgressStatesTable,
    List<ActiveExerciseStepProgressState>
  >
  _activeExerciseStepProgressStatesRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.activeExerciseStepProgressStates,
    aliasName:
        'active_workout_sessions__id__active_exercise_step_progress_states__active_workout_session_id',
  );

  $$ActiveExerciseStepProgressStatesTableProcessedTableManager
  get activeExerciseStepProgressStatesRefs {
    final manager =
        $$ActiveExerciseStepProgressStatesTableTableManager(
          $_db,
          $_db.activeExerciseStepProgressStates,
        ).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeExerciseStepProgressStatesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $ActiveExerciseStepResultsTable,
    List<ActiveExerciseStepResult>
  >
  _activeExerciseStepResultsRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.activeExerciseStepResults,
    aliasName:
        'active_workout_sessions__id__active_exercise_step_results__active_workout_session_id',
  );

  $$ActiveExerciseStepResultsTableProcessedTableManager
  get activeExerciseStepResultsRefs {
    final manager =
        $$ActiveExerciseStepResultsTableTableManager(
          $_db,
          $_db.activeExerciseStepResults,
        ).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeExerciseStepResultsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ActiveRestStatesTable, List<ActiveRestState>>
  _activeRestStatesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.activeRestStates,
    aliasName:
        'active_workout_sessions__id__active_rest_states__active_workout_session_id',
  );

  $$ActiveRestStatesTableProcessedTableManager get activeRestStatesRefs {
    final manager =
        $$ActiveRestStatesTableTableManager($_db, $_db.activeRestStates).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeRestStatesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $ActiveScoreStopwatchStatesTable,
    List<ActiveScoreStopwatchState>
  >
  _activeScoreStopwatchStatesRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.activeScoreStopwatchStates,
    aliasName:
        'active_workout_sessions__id__active_score_stopwatch_states__active_workout_session_id',
  );

  $$ActiveScoreStopwatchStatesTableProcessedTableManager
  get activeScoreStopwatchStatesRefs {
    final manager =
        $$ActiveScoreStopwatchStatesTableTableManager(
          $_db,
          $_db.activeScoreStopwatchStates,
        ).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeScoreStopwatchStatesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $ActiveSetTimerStatesTable,
    List<ActiveSetTimerState>
  >
  _activeSetTimerStatesRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.activeSetTimerStates,
    aliasName:
        'active_workout_sessions__id__active_set_timer_states__active_workout_session_id',
  );

  $$ActiveSetTimerStatesTableProcessedTableManager
  get activeSetTimerStatesRefs {
    final manager =
        $$ActiveSetTimerStatesTableTableManager(
          $_db,
          $_db.activeSetTimerStates,
        ).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeSetTimerStatesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ActiveSetResultsTable, List<ActiveSetResult>>
  _activeSetResultsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.activeSetResults,
    aliasName:
        'active_workout_sessions__id__active_set_results__active_workout_session_id',
  );

  $$ActiveSetResultsTableProcessedTableManager get activeSetResultsRefs {
    final manager =
        $$ActiveSetResultsTableTableManager($_db, $_db.activeSetResults).filter(
          (f) => f.activeWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _activeSetResultsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$WorkoutHistoriesTable, List<WorkoutHistory>>
  _workoutHistoriesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.workoutHistories,
    aliasName:
        'active_workout_sessions__id__workout_history__source_active_workout_session_id',
  );

  $$WorkoutHistoriesTableProcessedTableManager get workoutHistoriesRefs {
    final manager =
        $$WorkoutHistoriesTableTableManager($_db, $_db.workoutHistories).filter(
          (f) => f.sourceActiveWorkoutSessionId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutHistoriesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$ActiveWorkoutSessionsTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveWorkoutSessionsTable> {
  $$ActiveWorkoutSessionsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$WorkoutTemplatesTableFilterComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableFilterComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<bool> activeExerciseStepProgressStatesRefs(
    Expression<bool> Function(
      $$ActiveExerciseStepProgressStatesTableFilterComposer f,
    )
    f,
  ) {
    final $$ActiveExerciseStepProgressStatesTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeExerciseStepProgressStates,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveExerciseStepProgressStatesTableFilterComposer(
                $db: $db,
                $table: $db.activeExerciseStepProgressStates,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<bool> activeExerciseStepResultsRefs(
    Expression<bool> Function($$ActiveExerciseStepResultsTableFilterComposer f)
    f,
  ) {
    final $$ActiveExerciseStepResultsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeExerciseStepResults,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveExerciseStepResultsTableFilterComposer(
                $db: $db,
                $table: $db.activeExerciseStepResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<bool> activeRestStatesRefs(
    Expression<bool> Function($$ActiveRestStatesTableFilterComposer f) f,
  ) {
    final $$ActiveRestStatesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.activeRestStates,
      getReferencedColumn: (t) => t.activeWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ActiveRestStatesTableFilterComposer(
            $db: $db,
            $table: $db.activeRestStates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> activeScoreStopwatchStatesRefs(
    Expression<bool> Function($$ActiveScoreStopwatchStatesTableFilterComposer f)
    f,
  ) {
    final $$ActiveScoreStopwatchStatesTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeScoreStopwatchStates,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveScoreStopwatchStatesTableFilterComposer(
                $db: $db,
                $table: $db.activeScoreStopwatchStates,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<bool> activeSetTimerStatesRefs(
    Expression<bool> Function($$ActiveSetTimerStatesTableFilterComposer f) f,
  ) {
    final $$ActiveSetTimerStatesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.activeSetTimerStates,
      getReferencedColumn: (t) => t.activeWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ActiveSetTimerStatesTableFilterComposer(
            $db: $db,
            $table: $db.activeSetTimerStates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> activeSetResultsRefs(
    Expression<bool> Function($$ActiveSetResultsTableFilterComposer f) f,
  ) {
    final $$ActiveSetResultsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.activeSetResults,
      getReferencedColumn: (t) => t.activeWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ActiveSetResultsTableFilterComposer(
            $db: $db,
            $table: $db.activeSetResults,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> workoutHistoriesRefs(
    Expression<bool> Function($$WorkoutHistoriesTableFilterComposer f) f,
  ) {
    final $$WorkoutHistoriesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.sourceActiveWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableFilterComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$ActiveWorkoutSessionsTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveWorkoutSessionsTable> {
  $$ActiveWorkoutSessionsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$WorkoutTemplatesTableOrderingComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableOrderingComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$WorkoutTemplatesTableAnnotationComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<T> activeExerciseStepProgressStatesRefs<T extends Object>(
    Expression<T> Function(
      $$ActiveExerciseStepProgressStatesTableAnnotationComposer a,
    )
    f,
  ) {
    final $$ActiveExerciseStepProgressStatesTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeExerciseStepProgressStates,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveExerciseStepProgressStatesTableAnnotationComposer(
                $db: $db,
                $table: $db.activeExerciseStepProgressStates,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> activeExerciseStepResultsRefs<T extends Object>(
    Expression<T> Function($$ActiveExerciseStepResultsTableAnnotationComposer a)
    f,
  ) {
    final $$ActiveExerciseStepResultsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeExerciseStepResults,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveExerciseStepResultsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeExerciseStepResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> activeRestStatesRefs<T extends Object>(
    Expression<T> Function($$ActiveRestStatesTableAnnotationComposer a) f,
  ) {
    final $$ActiveRestStatesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.activeRestStates,
      getReferencedColumn: (t) => t.activeWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ActiveRestStatesTableAnnotationComposer(
            $db: $db,
            $table: $db.activeRestStates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> activeScoreStopwatchStatesRefs<T extends Object>(
    Expression<T> Function(
      $$ActiveScoreStopwatchStatesTableAnnotationComposer a,
    )
    f,
  ) {
    final $$ActiveScoreStopwatchStatesTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeScoreStopwatchStates,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveScoreStopwatchStatesTableAnnotationComposer(
                $db: $db,
                $table: $db.activeScoreStopwatchStates,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> activeSetTimerStatesRefs<T extends Object>(
    Expression<T> Function($$ActiveSetTimerStatesTableAnnotationComposer a) f,
  ) {
    final $$ActiveSetTimerStatesTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.activeSetTimerStates,
          getReferencedColumn: (t) => t.activeWorkoutSessionId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveSetTimerStatesTableAnnotationComposer(
                $db: $db,
                $table: $db.activeSetTimerStates,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> activeSetResultsRefs<T extends Object>(
    Expression<T> Function($$ActiveSetResultsTableAnnotationComposer a) f,
  ) {
    final $$ActiveSetResultsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.activeSetResults,
      getReferencedColumn: (t) => t.activeWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ActiveSetResultsTableAnnotationComposer(
            $db: $db,
            $table: $db.activeSetResults,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> workoutHistoriesRefs<T extends Object>(
    Expression<T> Function($$WorkoutHistoriesTableAnnotationComposer a) f,
  ) {
    final $$WorkoutHistoriesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.sourceActiveWorkoutSessionId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$ActiveWorkoutSessionsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveWorkoutSessionsTable,
          ActiveWorkoutSession,
          $$ActiveWorkoutSessionsTableFilterComposer,
          $$ActiveWorkoutSessionsTableOrderingComposer,
          $$ActiveWorkoutSessionsTableAnnotationComposer,
          $$ActiveWorkoutSessionsTableCreateCompanionBuilder,
          $$ActiveWorkoutSessionsTableUpdateCompanionBuilder,
          (ActiveWorkoutSession, $$ActiveWorkoutSessionsTableReferences),
          ActiveWorkoutSession,
          PrefetchHooks Function({
            bool sourceWorkoutTemplateId,
            bool activeExerciseStepProgressStatesRefs,
            bool activeExerciseStepResultsRefs,
            bool activeRestStatesRefs,
            bool activeScoreStopwatchStatesRefs,
            bool activeSetTimerStatesRefs,
            bool activeSetResultsRefs,
            bool workoutHistoriesRefs,
          })
        > {
  $$ActiveWorkoutSessionsTableTableManager(
    _$AppDatabase db,
    $ActiveWorkoutSessionsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveWorkoutSessionsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String?> sourceWorkoutTemplateId = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime> startedAt = const Value.absent(),
                Value<DateTime?> pausedAt = const Value.absent(),
                Value<DateTime?> endedAt = const Value.absent(),
                Value<DateTime> lastPersistedAt = const Value.absent(),
                Value<int> elapsedActiveMs = const Value.absent(),
                Value<int> currentProgramIndex = const Value.absent(),
                Value<int> currentExerciseIndex = const Value.absent(),
                Value<int> currentSetIndex = const Value.absent(),
                Value<String> resolvedTemplateSnapshotJson =
                    const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveWorkoutSessionsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                sourceWorkoutTemplateId: sourceWorkoutTemplateId,
                status: status,
                startedAt: startedAt,
                pausedAt: pausedAt,
                endedAt: endedAt,
                lastPersistedAt: lastPersistedAt,
                elapsedActiveMs: elapsedActiveMs,
                currentProgramIndex: currentProgramIndex,
                currentExerciseIndex: currentExerciseIndex,
                currentSetIndex: currentSetIndex,
                resolvedTemplateSnapshotJson: resolvedTemplateSnapshotJson,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String?> sourceWorkoutTemplateId = const Value.absent(),
                required String status,
                required DateTime startedAt,
                Value<DateTime?> pausedAt = const Value.absent(),
                Value<DateTime?> endedAt = const Value.absent(),
                required DateTime lastPersistedAt,
                required int elapsedActiveMs,
                required int currentProgramIndex,
                required int currentExerciseIndex,
                required int currentSetIndex,
                required String resolvedTemplateSnapshotJson,
                Value<int> rowid = const Value.absent(),
              }) => ActiveWorkoutSessionsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                sourceWorkoutTemplateId: sourceWorkoutTemplateId,
                status: status,
                startedAt: startedAt,
                pausedAt: pausedAt,
                endedAt: endedAt,
                lastPersistedAt: lastPersistedAt,
                elapsedActiveMs: elapsedActiveMs,
                currentProgramIndex: currentProgramIndex,
                currentExerciseIndex: currentExerciseIndex,
                currentSetIndex: currentSetIndex,
                resolvedTemplateSnapshotJson: resolvedTemplateSnapshotJson,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveWorkoutSessionsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                sourceWorkoutTemplateId = false,
                activeExerciseStepProgressStatesRefs = false,
                activeExerciseStepResultsRefs = false,
                activeRestStatesRefs = false,
                activeScoreStopwatchStatesRefs = false,
                activeSetTimerStatesRefs = false,
                activeSetResultsRefs = false,
                workoutHistoriesRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (activeExerciseStepProgressStatesRefs)
                      db.activeExerciseStepProgressStates,
                    if (activeExerciseStepResultsRefs)
                      db.activeExerciseStepResults,
                    if (activeRestStatesRefs) db.activeRestStates,
                    if (activeScoreStopwatchStatesRefs)
                      db.activeScoreStopwatchStates,
                    if (activeSetTimerStatesRefs) db.activeSetTimerStates,
                    if (activeSetResultsRefs) db.activeSetResults,
                    if (workoutHistoriesRefs) db.workoutHistories,
                  ],
                  addJoins:
                      <
                        T extends TableManagerState<
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic
                        >
                      >(state) {
                        if (sourceWorkoutTemplateId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn:
                                        table.sourceWorkoutTemplateId,
                                    referencedTable:
                                        $$ActiveWorkoutSessionsTableReferences
                                            ._sourceWorkoutTemplateIdTable(db),
                                    referencedColumn:
                                        $$ActiveWorkoutSessionsTableReferences
                                            ._sourceWorkoutTemplateIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }

                        return state;
                      },
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (activeExerciseStepProgressStatesRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveExerciseStepProgressState
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeExerciseStepProgressStatesRefsTable(
                                    db,
                                  ),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeExerciseStepProgressStatesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (activeExerciseStepResultsRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveExerciseStepResult
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeExerciseStepResultsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeExerciseStepResultsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (activeRestStatesRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveRestState
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeRestStatesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeRestStatesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (activeScoreStopwatchStatesRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveScoreStopwatchState
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeScoreStopwatchStatesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeScoreStopwatchStatesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (activeSetTimerStatesRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveSetTimerState
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeSetTimerStatesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeSetTimerStatesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (activeSetResultsRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          ActiveSetResult
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._activeSetResultsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).activeSetResultsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.activeWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (workoutHistoriesRefs)
                        await $_getPrefetchedData<
                          ActiveWorkoutSession,
                          $ActiveWorkoutSessionsTable,
                          WorkoutHistory
                        >(
                          currentTable: table,
                          referencedTable:
                              $$ActiveWorkoutSessionsTableReferences
                                  ._workoutHistoriesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ActiveWorkoutSessionsTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutHistoriesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) =>
                                    e.sourceActiveWorkoutSessionId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$ActiveWorkoutSessionsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveWorkoutSessionsTable,
      ActiveWorkoutSession,
      $$ActiveWorkoutSessionsTableFilterComposer,
      $$ActiveWorkoutSessionsTableOrderingComposer,
      $$ActiveWorkoutSessionsTableAnnotationComposer,
      $$ActiveWorkoutSessionsTableCreateCompanionBuilder,
      $$ActiveWorkoutSessionsTableUpdateCompanionBuilder,
      (ActiveWorkoutSession, $$ActiveWorkoutSessionsTableReferences),
      ActiveWorkoutSession,
      PrefetchHooks Function({
        bool sourceWorkoutTemplateId,
        bool activeExerciseStepProgressStatesRefs,
        bool activeExerciseStepResultsRefs,
        bool activeRestStatesRefs,
        bool activeScoreStopwatchStatesRefs,
        bool activeSetTimerStatesRefs,
        bool activeSetResultsRefs,
        bool workoutHistoriesRefs,
      })
    >;
typedef $$ActiveExerciseStepProgressStatesTableCreateCompanionBuilder =
    ActiveExerciseStepProgressStatesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required int currentPassageIndex,
      required int currentStepIndex,
      required String currentStepSnapshotId,
      required String status,
      Value<DateTime?> startedAt,
      required int accumulatedMs,
      required DateTime lastTransitionAt,
      Value<int> rowid,
    });
typedef $$ActiveExerciseStepProgressStatesTableUpdateCompanionBuilder =
    ActiveExerciseStepProgressStatesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<int> currentPassageIndex,
      Value<int> currentStepIndex,
      Value<String> currentStepSnapshotId,
      Value<String> status,
      Value<DateTime?> startedAt,
      Value<int> accumulatedMs,
      Value<DateTime> lastTransitionAt,
      Value<int> rowid,
    });

final class $$ActiveExerciseStepProgressStatesTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $ActiveExerciseStepProgressStatesTable,
          ActiveExerciseStepProgressState
        > {
  $$ActiveExerciseStepProgressStatesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_exercise_step_progress_states__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveExerciseStepProgressStatesTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveExerciseStepProgressStatesTable> {
  $$ActiveExerciseStepProgressStatesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveExerciseStepProgressStatesTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveExerciseStepProgressStatesTable> {
  $$ActiveExerciseStepProgressStatesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveExerciseStepProgressStatesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveExerciseStepProgressStatesTable,
          ActiveExerciseStepProgressState,
          $$ActiveExerciseStepProgressStatesTableFilterComposer,
          $$ActiveExerciseStepProgressStatesTableOrderingComposer,
          $$ActiveExerciseStepProgressStatesTableAnnotationComposer,
          $$ActiveExerciseStepProgressStatesTableCreateCompanionBuilder,
          $$ActiveExerciseStepProgressStatesTableUpdateCompanionBuilder,
          (
            ActiveExerciseStepProgressState,
            $$ActiveExerciseStepProgressStatesTableReferences,
          ),
          ActiveExerciseStepProgressState,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveExerciseStepProgressStatesTableTableManager(
    _$AppDatabase db,
    $ActiveExerciseStepProgressStatesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveExerciseStepProgressStatesTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$ActiveExerciseStepProgressStatesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$ActiveExerciseStepProgressStatesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<int> currentPassageIndex = const Value.absent(),
                Value<int> currentStepIndex = const Value.absent(),
                Value<String> currentStepSnapshotId = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<int> accumulatedMs = const Value.absent(),
                Value<DateTime> lastTransitionAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveExerciseStepProgressStatesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                currentPassageIndex: currentPassageIndex,
                currentStepIndex: currentStepIndex,
                currentStepSnapshotId: currentStepSnapshotId,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                lastTransitionAt: lastTransitionAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required int currentPassageIndex,
                required int currentStepIndex,
                required String currentStepSnapshotId,
                required String status,
                Value<DateTime?> startedAt = const Value.absent(),
                required int accumulatedMs,
                required DateTime lastTransitionAt,
                Value<int> rowid = const Value.absent(),
              }) => ActiveExerciseStepProgressStatesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                currentPassageIndex: currentPassageIndex,
                currentStepIndex: currentStepIndex,
                currentStepSnapshotId: currentStepSnapshotId,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                lastTransitionAt: lastTransitionAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveExerciseStepProgressStatesTableReferences(
                    db,
                    table,
                    e,
                  ),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveExerciseStepProgressStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveExerciseStepProgressStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveExerciseStepProgressStatesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveExerciseStepProgressStatesTable,
      ActiveExerciseStepProgressState,
      $$ActiveExerciseStepProgressStatesTableFilterComposer,
      $$ActiveExerciseStepProgressStatesTableOrderingComposer,
      $$ActiveExerciseStepProgressStatesTableAnnotationComposer,
      $$ActiveExerciseStepProgressStatesTableCreateCompanionBuilder,
      $$ActiveExerciseStepProgressStatesTableUpdateCompanionBuilder,
      (
        ActiveExerciseStepProgressState,
        $$ActiveExerciseStepProgressStatesTableReferences,
      ),
      ActiveExerciseStepProgressState,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ActiveExerciseStepResultsTableCreateCompanionBuilder =
    ActiveExerciseStepResultsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required String programSnapshotId,
      required String exerciseSnapshotId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required int passageIndex,
      required int stepIndex,
      required String stepSnapshotId,
      required String stepNameSnapshot,
      required String stepTypeSnapshot,
      required int targetValueSnapshot,
      required bool hasScoreSnapshot,
      Value<String?> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      required String status,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> note,
      Value<int> rowid,
    });
typedef $$ActiveExerciseStepResultsTableUpdateCompanionBuilder =
    ActiveExerciseStepResultsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<String> programSnapshotId,
      Value<String> exerciseSnapshotId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<int> passageIndex,
      Value<int> stepIndex,
      Value<String> stepSnapshotId,
      Value<String> stepNameSnapshot,
      Value<String> stepTypeSnapshot,
      Value<int> targetValueSnapshot,
      Value<bool> hasScoreSnapshot,
      Value<String?> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      Value<String> status,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> note,
      Value<int> rowid,
    });

final class $$ActiveExerciseStepResultsTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $ActiveExerciseStepResultsTable,
          ActiveExerciseStepResult
        > {
  $$ActiveExerciseStepResultsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_exercise_step_results__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveExerciseStepResultsTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveExerciseStepResultsTable> {
  $$ActiveExerciseStepResultsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveExerciseStepResultsTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveExerciseStepResultsTable> {
  $$ActiveExerciseStepResultsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveExerciseStepResultsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveExerciseStepResultsTable,
          ActiveExerciseStepResult,
          $$ActiveExerciseStepResultsTableFilterComposer,
          $$ActiveExerciseStepResultsTableOrderingComposer,
          $$ActiveExerciseStepResultsTableAnnotationComposer,
          $$ActiveExerciseStepResultsTableCreateCompanionBuilder,
          $$ActiveExerciseStepResultsTableUpdateCompanionBuilder,
          (
            ActiveExerciseStepResult,
            $$ActiveExerciseStepResultsTableReferences,
          ),
          ActiveExerciseStepResult,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveExerciseStepResultsTableTableManager(
    _$AppDatabase db,
    $ActiveExerciseStepResultsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveExerciseStepResultsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$ActiveExerciseStepResultsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$ActiveExerciseStepResultsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<String> programSnapshotId = const Value.absent(),
                Value<String> exerciseSnapshotId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<int> passageIndex = const Value.absent(),
                Value<int> stepIndex = const Value.absent(),
                Value<String> stepSnapshotId = const Value.absent(),
                Value<String> stepNameSnapshot = const Value.absent(),
                Value<String> stepTypeSnapshot = const Value.absent(),
                Value<int> targetValueSnapshot = const Value.absent(),
                Value<bool> hasScoreSnapshot = const Value.absent(),
                Value<String?> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveExerciseStepResultsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                passageIndex: passageIndex,
                stepIndex: stepIndex,
                stepSnapshotId: stepSnapshotId,
                stepNameSnapshot: stepNameSnapshot,
                stepTypeSnapshot: stepTypeSnapshot,
                targetValueSnapshot: targetValueSnapshot,
                hasScoreSnapshot: hasScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                status: status,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                note: note,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required String programSnapshotId,
                required String exerciseSnapshotId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required int passageIndex,
                required int stepIndex,
                required String stepSnapshotId,
                required String stepNameSnapshot,
                required String stepTypeSnapshot,
                required int targetValueSnapshot,
                required bool hasScoreSnapshot,
                Value<String?> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                required String status,
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveExerciseStepResultsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                passageIndex: passageIndex,
                stepIndex: stepIndex,
                stepSnapshotId: stepSnapshotId,
                stepNameSnapshot: stepNameSnapshot,
                stepTypeSnapshot: stepTypeSnapshot,
                targetValueSnapshot: targetValueSnapshot,
                hasScoreSnapshot: hasScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                status: status,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                note: note,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveExerciseStepResultsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveExerciseStepResultsTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveExerciseStepResultsTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveExerciseStepResultsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveExerciseStepResultsTable,
      ActiveExerciseStepResult,
      $$ActiveExerciseStepResultsTableFilterComposer,
      $$ActiveExerciseStepResultsTableOrderingComposer,
      $$ActiveExerciseStepResultsTableAnnotationComposer,
      $$ActiveExerciseStepResultsTableCreateCompanionBuilder,
      $$ActiveExerciseStepResultsTableUpdateCompanionBuilder,
      (ActiveExerciseStepResult, $$ActiveExerciseStepResultsTableReferences),
      ActiveExerciseStepResult,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ActiveRestStatesTableCreateCompanionBuilder =
    ActiveRestStatesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required int afterProgramIndex,
      required int afterExerciseIndex,
      required int afterSetIndex,
      required int plannedRestSeconds,
      required int adjustedRestSeconds,
      required DateTime startedAt,
      Value<DateTime?> endedAt,
      Value<DateTime?> skippedAt,
      Value<DateTime?> pausedAt,
      Value<int> accumulatedPausedMs,
      Value<int> rowid,
    });
typedef $$ActiveRestStatesTableUpdateCompanionBuilder =
    ActiveRestStatesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<int> afterProgramIndex,
      Value<int> afterExerciseIndex,
      Value<int> afterSetIndex,
      Value<int> plannedRestSeconds,
      Value<int> adjustedRestSeconds,
      Value<DateTime> startedAt,
      Value<DateTime?> endedAt,
      Value<DateTime?> skippedAt,
      Value<DateTime?> pausedAt,
      Value<int> accumulatedPausedMs,
      Value<int> rowid,
    });

final class $$ActiveRestStatesTableReferences
    extends
        BaseReferences<_$AppDatabase, $ActiveRestStatesTable, ActiveRestState> {
  $$ActiveRestStatesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_rest_states__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveRestStatesTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveRestStatesTable> {
  $$ActiveRestStatesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveRestStatesTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveRestStatesTable> {
  $$ActiveRestStatesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveRestStatesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveRestStatesTable,
          ActiveRestState,
          $$ActiveRestStatesTableFilterComposer,
          $$ActiveRestStatesTableOrderingComposer,
          $$ActiveRestStatesTableAnnotationComposer,
          $$ActiveRestStatesTableCreateCompanionBuilder,
          $$ActiveRestStatesTableUpdateCompanionBuilder,
          (ActiveRestState, $$ActiveRestStatesTableReferences),
          ActiveRestState,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveRestStatesTableTableManager(
    _$AppDatabase db,
    $ActiveRestStatesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveRestStatesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ActiveRestStatesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ActiveRestStatesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<int> afterProgramIndex = const Value.absent(),
                Value<int> afterExerciseIndex = const Value.absent(),
                Value<int> afterSetIndex = const Value.absent(),
                Value<int> plannedRestSeconds = const Value.absent(),
                Value<int> adjustedRestSeconds = const Value.absent(),
                Value<DateTime> startedAt = const Value.absent(),
                Value<DateTime?> endedAt = const Value.absent(),
                Value<DateTime?> skippedAt = const Value.absent(),
                Value<DateTime?> pausedAt = const Value.absent(),
                Value<int> accumulatedPausedMs = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveRestStatesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                afterProgramIndex: afterProgramIndex,
                afterExerciseIndex: afterExerciseIndex,
                afterSetIndex: afterSetIndex,
                plannedRestSeconds: plannedRestSeconds,
                adjustedRestSeconds: adjustedRestSeconds,
                startedAt: startedAt,
                endedAt: endedAt,
                skippedAt: skippedAt,
                pausedAt: pausedAt,
                accumulatedPausedMs: accumulatedPausedMs,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required int afterProgramIndex,
                required int afterExerciseIndex,
                required int afterSetIndex,
                required int plannedRestSeconds,
                required int adjustedRestSeconds,
                required DateTime startedAt,
                Value<DateTime?> endedAt = const Value.absent(),
                Value<DateTime?> skippedAt = const Value.absent(),
                Value<DateTime?> pausedAt = const Value.absent(),
                Value<int> accumulatedPausedMs = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveRestStatesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                afterProgramIndex: afterProgramIndex,
                afterExerciseIndex: afterExerciseIndex,
                afterSetIndex: afterSetIndex,
                plannedRestSeconds: plannedRestSeconds,
                adjustedRestSeconds: adjustedRestSeconds,
                startedAt: startedAt,
                endedAt: endedAt,
                skippedAt: skippedAt,
                pausedAt: pausedAt,
                accumulatedPausedMs: accumulatedPausedMs,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveRestStatesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveRestStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveRestStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveRestStatesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveRestStatesTable,
      ActiveRestState,
      $$ActiveRestStatesTableFilterComposer,
      $$ActiveRestStatesTableOrderingComposer,
      $$ActiveRestStatesTableAnnotationComposer,
      $$ActiveRestStatesTableCreateCompanionBuilder,
      $$ActiveRestStatesTableUpdateCompanionBuilder,
      (ActiveRestState, $$ActiveRestStatesTableReferences),
      ActiveRestState,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ActiveScoreStopwatchStatesTableCreateCompanionBuilder =
    ActiveScoreStopwatchStatesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required String status,
      required DateTime startedAt,
      required int accumulatedMs,
      Value<DateTime?> stoppedAt,
      Value<int> rowid,
    });
typedef $$ActiveScoreStopwatchStatesTableUpdateCompanionBuilder =
    ActiveScoreStopwatchStatesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<String> status,
      Value<DateTime> startedAt,
      Value<int> accumulatedMs,
      Value<DateTime?> stoppedAt,
      Value<int> rowid,
    });

final class $$ActiveScoreStopwatchStatesTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $ActiveScoreStopwatchStatesTable,
          ActiveScoreStopwatchState
        > {
  $$ActiveScoreStopwatchStatesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_score_stopwatch_states__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveScoreStopwatchStatesTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveScoreStopwatchStatesTable> {
  $$ActiveScoreStopwatchStatesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveScoreStopwatchStatesTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveScoreStopwatchStatesTable> {
  $$ActiveScoreStopwatchStatesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveScoreStopwatchStatesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveScoreStopwatchStatesTable,
          ActiveScoreStopwatchState,
          $$ActiveScoreStopwatchStatesTableFilterComposer,
          $$ActiveScoreStopwatchStatesTableOrderingComposer,
          $$ActiveScoreStopwatchStatesTableAnnotationComposer,
          $$ActiveScoreStopwatchStatesTableCreateCompanionBuilder,
          $$ActiveScoreStopwatchStatesTableUpdateCompanionBuilder,
          (
            ActiveScoreStopwatchState,
            $$ActiveScoreStopwatchStatesTableReferences,
          ),
          ActiveScoreStopwatchState,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveScoreStopwatchStatesTableTableManager(
    _$AppDatabase db,
    $ActiveScoreStopwatchStatesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveScoreStopwatchStatesTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$ActiveScoreStopwatchStatesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$ActiveScoreStopwatchStatesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime> startedAt = const Value.absent(),
                Value<int> accumulatedMs = const Value.absent(),
                Value<DateTime?> stoppedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveScoreStopwatchStatesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                stoppedAt: stoppedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required String status,
                required DateTime startedAt,
                required int accumulatedMs,
                Value<DateTime?> stoppedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveScoreStopwatchStatesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                stoppedAt: stoppedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveScoreStopwatchStatesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveScoreStopwatchStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveScoreStopwatchStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveScoreStopwatchStatesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveScoreStopwatchStatesTable,
      ActiveScoreStopwatchState,
      $$ActiveScoreStopwatchStatesTableFilterComposer,
      $$ActiveScoreStopwatchStatesTableOrderingComposer,
      $$ActiveScoreStopwatchStatesTableAnnotationComposer,
      $$ActiveScoreStopwatchStatesTableCreateCompanionBuilder,
      $$ActiveScoreStopwatchStatesTableUpdateCompanionBuilder,
      (ActiveScoreStopwatchState, $$ActiveScoreStopwatchStatesTableReferences),
      ActiveScoreStopwatchState,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ActiveSetTimerStatesTableCreateCompanionBuilder =
    ActiveSetTimerStatesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required String status,
      Value<DateTime?> startedAt,
      required int accumulatedMs,
      Value<DateTime?> stoppedAt,
      Value<DateTime?> skippedAt,
      Value<int> rowid,
    });
typedef $$ActiveSetTimerStatesTableUpdateCompanionBuilder =
    ActiveSetTimerStatesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<String> status,
      Value<DateTime?> startedAt,
      Value<int> accumulatedMs,
      Value<DateTime?> stoppedAt,
      Value<DateTime?> skippedAt,
      Value<int> rowid,
    });

final class $$ActiveSetTimerStatesTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $ActiveSetTimerStatesTable,
          ActiveSetTimerState
        > {
  $$ActiveSetTimerStatesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_set_timer_states__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveSetTimerStatesTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveSetTimerStatesTable> {
  $$ActiveSetTimerStatesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveSetTimerStatesTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveSetTimerStatesTable> {
  $$ActiveSetTimerStatesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveSetTimerStatesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveSetTimerStatesTable,
          ActiveSetTimerState,
          $$ActiveSetTimerStatesTableFilterComposer,
          $$ActiveSetTimerStatesTableOrderingComposer,
          $$ActiveSetTimerStatesTableAnnotationComposer,
          $$ActiveSetTimerStatesTableCreateCompanionBuilder,
          $$ActiveSetTimerStatesTableUpdateCompanionBuilder,
          (ActiveSetTimerState, $$ActiveSetTimerStatesTableReferences),
          ActiveSetTimerState,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveSetTimerStatesTableTableManager(
    _$AppDatabase db,
    $ActiveSetTimerStatesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveSetTimerStatesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ActiveSetTimerStatesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$ActiveSetTimerStatesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<int> accumulatedMs = const Value.absent(),
                Value<DateTime?> stoppedAt = const Value.absent(),
                Value<DateTime?> skippedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveSetTimerStatesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                stoppedAt: stoppedAt,
                skippedAt: skippedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required String status,
                Value<DateTime?> startedAt = const Value.absent(),
                required int accumulatedMs,
                Value<DateTime?> stoppedAt = const Value.absent(),
                Value<DateTime?> skippedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveSetTimerStatesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                status: status,
                startedAt: startedAt,
                accumulatedMs: accumulatedMs,
                stoppedAt: stoppedAt,
                skippedAt: skippedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveSetTimerStatesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveSetTimerStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveSetTimerStatesTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveSetTimerStatesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveSetTimerStatesTable,
      ActiveSetTimerState,
      $$ActiveSetTimerStatesTableFilterComposer,
      $$ActiveSetTimerStatesTableOrderingComposer,
      $$ActiveSetTimerStatesTableAnnotationComposer,
      $$ActiveSetTimerStatesTableCreateCompanionBuilder,
      $$ActiveSetTimerStatesTableUpdateCompanionBuilder,
      (ActiveSetTimerState, $$ActiveSetTimerStatesTableReferences),
      ActiveSetTimerState,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ActiveSetResultsTableCreateCompanionBuilder =
    ActiveSetResultsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String activeWorkoutSessionId,
      required String programSnapshotId,
      required String exerciseSnapshotId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<String?> note,
      Value<String> status,
      Value<int> rowid,
    });
typedef $$ActiveSetResultsTableUpdateCompanionBuilder =
    ActiveSetResultsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> activeWorkoutSessionId,
      Value<String> programSnapshotId,
      Value<String> exerciseSnapshotId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<String?> note,
      Value<String> status,
      Value<int> rowid,
    });

final class $$ActiveSetResultsTableReferences
    extends
        BaseReferences<_$AppDatabase, $ActiveSetResultsTable, ActiveSetResult> {
  $$ActiveSetResultsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ActiveWorkoutSessionsTable _activeWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'active_set_results__active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager get activeWorkoutSessionId {
    final $_column = $_itemColumn<String>('active_workout_session_id')!;

    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _activeWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ActiveSetResultsTableFilterComposer
    extends Composer<_$AppDatabase, $ActiveSetResultsTable> {
  $$ActiveSetResultsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableFilterComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveSetResultsTableOrderingComposer
    extends Composer<_$AppDatabase, $ActiveSetResultsTable> {
  $$ActiveSetResultsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableOrderingComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ActiveWorkoutSessionsTableAnnotationComposer get activeWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.activeWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$ActiveSetResultsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ActiveSetResultsTable,
          ActiveSetResult,
          $$ActiveSetResultsTableFilterComposer,
          $$ActiveSetResultsTableOrderingComposer,
          $$ActiveSetResultsTableAnnotationComposer,
          $$ActiveSetResultsTableCreateCompanionBuilder,
          $$ActiveSetResultsTableUpdateCompanionBuilder,
          (ActiveSetResult, $$ActiveSetResultsTableReferences),
          ActiveSetResult,
          PrefetchHooks Function({bool activeWorkoutSessionId})
        > {
  $$ActiveSetResultsTableTableManager(
    _$AppDatabase db,
    $ActiveSetResultsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ActiveSetResultsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ActiveSetResultsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ActiveSetResultsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> activeWorkoutSessionId = const Value.absent(),
                Value<String> programSnapshotId = const Value.absent(),
                Value<String> exerciseSnapshotId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveSetResultsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                note: note,
                status: status,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String activeWorkoutSessionId,
                required String programSnapshotId,
                required String exerciseSnapshotId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ActiveSetResultsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                activeWorkoutSessionId: activeWorkoutSessionId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                note: note,
                status: status,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ActiveSetResultsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({activeWorkoutSessionId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (activeWorkoutSessionId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.activeWorkoutSessionId,
                                referencedTable:
                                    $$ActiveSetResultsTableReferences
                                        ._activeWorkoutSessionIdTable(db),
                                referencedColumn:
                                    $$ActiveSetResultsTableReferences
                                        ._activeWorkoutSessionIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ActiveSetResultsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ActiveSetResultsTable,
      ActiveSetResult,
      $$ActiveSetResultsTableFilterComposer,
      $$ActiveSetResultsTableOrderingComposer,
      $$ActiveSetResultsTableAnnotationComposer,
      $$ActiveSetResultsTableCreateCompanionBuilder,
      $$ActiveSetResultsTableUpdateCompanionBuilder,
      (ActiveSetResult, $$ActiveSetResultsTableReferences),
      ActiveSetResult,
      PrefetchHooks Function({bool activeWorkoutSessionId})
    >;
typedef $$ChangeLogEntriesTableCreateCompanionBuilder =
    ChangeLogEntriesCompanion Function({
      required String id,
      required String entityType,
      required String entityId,
      required String operation,
      Value<String?> payloadHash,
      required int localRevision,
      required String originDeviceId,
      required DateTime createdAt,
      Value<DateTime?> syncedAt,
      Value<int> rowid,
    });
typedef $$ChangeLogEntriesTableUpdateCompanionBuilder =
    ChangeLogEntriesCompanion Function({
      Value<String> id,
      Value<String> entityType,
      Value<String> entityId,
      Value<String> operation,
      Value<String?> payloadHash,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<DateTime> createdAt,
      Value<DateTime?> syncedAt,
      Value<int> rowid,
    });

class $$ChangeLogEntriesTableFilterComposer
    extends Composer<_$AppDatabase, $ChangeLogEntriesTable> {
  $$ChangeLogEntriesTableFilterComposer({
    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<String> get entityType => $composableBuilder(
    column: $table.entityType,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

class $$ChangeLogEntriesTableOrderingComposer
    extends Composer<_$AppDatabase, $ChangeLogEntriesTable> {
  $$ChangeLogEntriesTableOrderingComposer({
    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<String> get entityType => $composableBuilder(
    column: $table.entityType,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

class $$ChangeLogEntriesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ChangeLogEntriesTable,
          ChangeLogEntry,
          $$ChangeLogEntriesTableFilterComposer,
          $$ChangeLogEntriesTableOrderingComposer,
          $$ChangeLogEntriesTableAnnotationComposer,
          $$ChangeLogEntriesTableCreateCompanionBuilder,
          $$ChangeLogEntriesTableUpdateCompanionBuilder,
          (
            ChangeLogEntry,
            BaseReferences<
              _$AppDatabase,
              $ChangeLogEntriesTable,
              ChangeLogEntry
            >,
          ),
          ChangeLogEntry,
          PrefetchHooks Function()
        > {
  $$ChangeLogEntriesTableTableManager(
    _$AppDatabase db,
    $ChangeLogEntriesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ChangeLogEntriesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ChangeLogEntriesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ChangeLogEntriesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String> entityType = const Value.absent(),
                Value<String> entityId = const Value.absent(),
                Value<String> operation = const Value.absent(),
                Value<String?> payloadHash = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime?> syncedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ChangeLogEntriesCompanion(
                id: id,
                entityType: entityType,
                entityId: entityId,
                operation: operation,
                payloadHash: payloadHash,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                createdAt: createdAt,
                syncedAt: syncedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required String entityType,
                required String entityId,
                required String operation,
                Value<String?> payloadHash = const Value.absent(),
                required int localRevision,
                required String originDeviceId,
                required DateTime createdAt,
                Value<DateTime?> syncedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ChangeLogEntriesCompanion.insert(
                id: id,
                entityType: entityType,
                entityId: entityId,
                operation: operation,
                payloadHash: payloadHash,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                createdAt: createdAt,
                syncedAt: syncedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$ChangeLogEntriesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ChangeLogEntriesTable,
      ChangeLogEntry,
      $$ChangeLogEntriesTableFilterComposer,
      $$ChangeLogEntriesTableOrderingComposer,
      $$ChangeLogEntriesTableAnnotationComposer,
      $$ChangeLogEntriesTableCreateCompanionBuilder,
      $$ChangeLogEntriesTableUpdateCompanionBuilder,
      (
        ChangeLogEntry,
        BaseReferences<_$AppDatabase, $ChangeLogEntriesTable, ChangeLogEntry>,
      ),
      ChangeLogEntry,
      PrefetchHooks Function()
    >;
typedef $$MediaAssetsTableCreateCompanionBuilder =
    MediaAssetsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String kind,
      required String localUri,
      Value<String?> mimeType,
      Value<int?> sizeBytes,
      Value<int?> width,
      Value<int?> height,
      Value<int?> durationMs,
      Value<String?> checksum,
      Value<String?> remoteUri,
      Value<String?> thumbnailLocalUri,
      Value<int> rowid,
    });
typedef $$MediaAssetsTableUpdateCompanionBuilder =
    MediaAssetsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> kind,
      Value<String> localUri,
      Value<String?> mimeType,
      Value<int?> sizeBytes,
      Value<int?> width,
      Value<int?> height,
      Value<int?> durationMs,
      Value<String?> checksum,
      Value<String?> remoteUri,
      Value<String?> thumbnailLocalUri,
      Value<int> rowid,
    });

final class $$MediaAssetsTableReferences
    extends BaseReferences<_$AppDatabase, $MediaAssetsTable, MediaAsset> {
  $$MediaAssetsTableReferences(super.$_db, super.$_table, super.$_typedResult);

  static MultiTypedResultKey<$ExercisesTable, List<Exercise>>
  _exerciseIconReferencesTable(_$AppDatabase db) =>
      MultiTypedResultKey.fromTable(
        db.exercises,
        aliasName: 'media_assets__id__exercises__icon_media_id',
      );

  $$ExercisesTableProcessedTableManager get exerciseIconReferences {
    final manager = $$ExercisesTableTableManager(
      $_db,
      $_db.exercises,
    ).filter((f) => f.iconMediaId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(
      _exerciseIconReferencesTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ExercisesTable, List<Exercise>>
  _exerciseVideoReferencesTable(_$AppDatabase db) =>
      MultiTypedResultKey.fromTable(
        db.exercises,
        aliasName: 'media_assets__id__exercises__video_media_id',
      );

  $$ExercisesTableProcessedTableManager get exerciseVideoReferences {
    final manager = $$ExercisesTableTableManager(
      $_db,
      $_db.exercises,
    ).filter((f) => f.videoMediaId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(
      _exerciseVideoReferencesTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ExerciseImagesTable, List<ExerciseImage>>
  _exerciseImagesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.exerciseImages,
    aliasName: 'media_assets__id__exercise_images__media_asset_id',
  );

  $$ExerciseImagesTableProcessedTableManager get exerciseImagesRefs {
    final manager = $$ExerciseImagesTableTableManager(
      $_db,
      $_db.exerciseImages,
    ).filter((f) => f.mediaAssetId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(_exerciseImagesRefsTable($_db));
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ProgramExercisesTable, List<ProgramExercise>>
  _programExerciseImageSnapshotReferencesTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.programExercises,
    aliasName:
        'media_assets__id__program_exercises__exercise_image_media_id_snapshot',
  );

  $$ProgramExercisesTableProcessedTableManager
  get programExerciseImageSnapshotReferences {
    final manager =
        $$ProgramExercisesTableTableManager($_db, $_db.programExercises).filter(
          (f) => f.exerciseImageMediaIdSnapshot.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _programExerciseImageSnapshotReferencesTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ProgramExercisesTable, List<ProgramExercise>>
  _programExerciseVideoSnapshotReferencesTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.programExercises,
    aliasName:
        'media_assets__id__program_exercises__exercise_video_media_id_snapshot',
  );

  $$ProgramExercisesTableProcessedTableManager
  get programExerciseVideoSnapshotReferences {
    final manager =
        $$ProgramExercisesTableTableManager($_db, $_db.programExercises).filter(
          (f) => f.exerciseVideoMediaIdSnapshot.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _programExerciseVideoSnapshotReferencesTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$MediaAssetsTableFilterComposer
    extends Composer<_$AppDatabase, $MediaAssetsTable> {
  $$MediaAssetsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  Expression<bool> exerciseIconReferences(
    Expression<bool> Function($$ExercisesTableFilterComposer f) f,
  ) {
    final $$ExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.iconMediaId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableFilterComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> exerciseVideoReferences(
    Expression<bool> Function($$ExercisesTableFilterComposer f) f,
  ) {
    final $$ExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.videoMediaId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableFilterComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> exerciseImagesRefs(
    Expression<bool> Function($$ExerciseImagesTableFilterComposer f) f,
  ) {
    final $$ExerciseImagesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseImages,
      getReferencedColumn: (t) => t.mediaAssetId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseImagesTableFilterComposer(
            $db: $db,
            $table: $db.exerciseImages,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> programExerciseImageSnapshotReferences(
    Expression<bool> Function($$ProgramExercisesTableFilterComposer f) f,
  ) {
    final $$ProgramExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.exerciseImageMediaIdSnapshot,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableFilterComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> programExerciseVideoSnapshotReferences(
    Expression<bool> Function($$ProgramExercisesTableFilterComposer f) f,
  ) {
    final $$ProgramExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.exerciseVideoMediaIdSnapshot,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableFilterComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$MediaAssetsTableOrderingComposer
    extends Composer<_$AppDatabase, $MediaAssetsTable> {
  $$MediaAssetsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  Expression<T> exerciseIconReferences<T extends Object>(
    Expression<T> Function($$ExercisesTableAnnotationComposer a) f,
  ) {
    final $$ExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.iconMediaId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> exerciseVideoReferences<T extends Object>(
    Expression<T> Function($$ExercisesTableAnnotationComposer a) f,
  ) {
    final $$ExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.videoMediaId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> exerciseImagesRefs<T extends Object>(
    Expression<T> Function($$ExerciseImagesTableAnnotationComposer a) f,
  ) {
    final $$ExerciseImagesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseImages,
      getReferencedColumn: (t) => t.mediaAssetId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseImagesTableAnnotationComposer(
            $db: $db,
            $table: $db.exerciseImages,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> programExerciseImageSnapshotReferences<T extends Object>(
    Expression<T> Function($$ProgramExercisesTableAnnotationComposer a) f,
  ) {
    final $$ProgramExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.exerciseImageMediaIdSnapshot,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> programExerciseVideoSnapshotReferences<T extends Object>(
    Expression<T> Function($$ProgramExercisesTableAnnotationComposer a) f,
  ) {
    final $$ProgramExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.exerciseVideoMediaIdSnapshot,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$MediaAssetsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $MediaAssetsTable,
          MediaAsset,
          $$MediaAssetsTableFilterComposer,
          $$MediaAssetsTableOrderingComposer,
          $$MediaAssetsTableAnnotationComposer,
          $$MediaAssetsTableCreateCompanionBuilder,
          $$MediaAssetsTableUpdateCompanionBuilder,
          (MediaAsset, $$MediaAssetsTableReferences),
          MediaAsset,
          PrefetchHooks Function({
            bool exerciseIconReferences,
            bool exerciseVideoReferences,
            bool exerciseImagesRefs,
            bool programExerciseImageSnapshotReferences,
            bool programExerciseVideoSnapshotReferences,
          })
        > {
  $$MediaAssetsTableTableManager(_$AppDatabase db, $MediaAssetsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$MediaAssetsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$MediaAssetsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$MediaAssetsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> kind = const Value.absent(),
                Value<String> localUri = const Value.absent(),
                Value<String?> mimeType = const Value.absent(),
                Value<int?> sizeBytes = const Value.absent(),
                Value<int?> width = const Value.absent(),
                Value<int?> height = const Value.absent(),
                Value<int?> durationMs = const Value.absent(),
                Value<String?> checksum = const Value.absent(),
                Value<String?> remoteUri = const Value.absent(),
                Value<String?> thumbnailLocalUri = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => MediaAssetsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                kind: kind,
                localUri: localUri,
                mimeType: mimeType,
                sizeBytes: sizeBytes,
                width: width,
                height: height,
                durationMs: durationMs,
                checksum: checksum,
                remoteUri: remoteUri,
                thumbnailLocalUri: thumbnailLocalUri,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String kind,
                required String localUri,
                Value<String?> mimeType = const Value.absent(),
                Value<int?> sizeBytes = const Value.absent(),
                Value<int?> width = const Value.absent(),
                Value<int?> height = const Value.absent(),
                Value<int?> durationMs = const Value.absent(),
                Value<String?> checksum = const Value.absent(),
                Value<String?> remoteUri = const Value.absent(),
                Value<String?> thumbnailLocalUri = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => MediaAssetsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                kind: kind,
                localUri: localUri,
                mimeType: mimeType,
                sizeBytes: sizeBytes,
                width: width,
                height: height,
                durationMs: durationMs,
                checksum: checksum,
                remoteUri: remoteUri,
                thumbnailLocalUri: thumbnailLocalUri,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$MediaAssetsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                exerciseIconReferences = false,
                exerciseVideoReferences = false,
                exerciseImagesRefs = false,
                programExerciseImageSnapshotReferences = false,
                programExerciseVideoSnapshotReferences = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (exerciseIconReferences) db.exercises,
                    if (exerciseVideoReferences) db.exercises,
                    if (exerciseImagesRefs) db.exerciseImages,
                    if (programExerciseImageSnapshotReferences)
                      db.programExercises,
                    if (programExerciseVideoSnapshotReferences)
                      db.programExercises,
                  ],
                  addJoins: null,
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (exerciseIconReferences)
                        await $_getPrefetchedData<
                          MediaAsset,
                          $MediaAssetsTable,
                          Exercise
                        >(
                          currentTable: table,
                          referencedTable: $$MediaAssetsTableReferences
                              ._exerciseIconReferencesTable(db),
                          managerFromTypedResult: (p0) =>
                              $$MediaAssetsTableReferences(
                                db,
                                table,
                                p0,
                              ).exerciseIconReferences,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.iconMediaId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (exerciseVideoReferences)
                        await $_getPrefetchedData<
                          MediaAsset,
                          $MediaAssetsTable,
                          Exercise
                        >(
                          currentTable: table,
                          referencedTable: $$MediaAssetsTableReferences
                              ._exerciseVideoReferencesTable(db),
                          managerFromTypedResult: (p0) =>
                              $$MediaAssetsTableReferences(
                                db,
                                table,
                                p0,
                              ).exerciseVideoReferences,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.videoMediaId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (exerciseImagesRefs)
                        await $_getPrefetchedData<
                          MediaAsset,
                          $MediaAssetsTable,
                          ExerciseImage
                        >(
                          currentTable: table,
                          referencedTable: $$MediaAssetsTableReferences
                              ._exerciseImagesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$MediaAssetsTableReferences(
                                db,
                                table,
                                p0,
                              ).exerciseImagesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.mediaAssetId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (programExerciseImageSnapshotReferences)
                        await $_getPrefetchedData<
                          MediaAsset,
                          $MediaAssetsTable,
                          ProgramExercise
                        >(
                          currentTable: table,
                          referencedTable: $$MediaAssetsTableReferences
                              ._programExerciseImageSnapshotReferencesTable(db),
                          managerFromTypedResult: (p0) =>
                              $$MediaAssetsTableReferences(
                                db,
                                table,
                                p0,
                              ).programExerciseImageSnapshotReferences,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) =>
                                    e.exerciseImageMediaIdSnapshot == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (programExerciseVideoSnapshotReferences)
                        await $_getPrefetchedData<
                          MediaAsset,
                          $MediaAssetsTable,
                          ProgramExercise
                        >(
                          currentTable: table,
                          referencedTable: $$MediaAssetsTableReferences
                              ._programExerciseVideoSnapshotReferencesTable(db),
                          managerFromTypedResult: (p0) =>
                              $$MediaAssetsTableReferences(
                                db,
                                table,
                                p0,
                              ).programExerciseVideoSnapshotReferences,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) =>
                                    e.exerciseVideoMediaIdSnapshot == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$MediaAssetsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $MediaAssetsTable,
      MediaAsset,
      $$MediaAssetsTableFilterComposer,
      $$MediaAssetsTableOrderingComposer,
      $$MediaAssetsTableAnnotationComposer,
      $$MediaAssetsTableCreateCompanionBuilder,
      $$MediaAssetsTableUpdateCompanionBuilder,
      (MediaAsset, $$MediaAssetsTableReferences),
      MediaAsset,
      PrefetchHooks Function({
        bool exerciseIconReferences,
        bool exerciseVideoReferences,
        bool exerciseImagesRefs,
        bool programExerciseImageSnapshotReferences,
        bool programExerciseVideoSnapshotReferences,
      })
    >;
typedef $$ExercisesTableCreateCompanionBuilder =
    ExercisesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String name,
      Value<String?> description,
      Value<String?> iconMediaId,
      Value<String?> videoMediaId,
      required bool hasTimeMeasure,
      required bool hasRepsMeasure,
      required bool hasScoreMeasure,
      Value<String> scoreInputMode,
      Value<String?> scoreLabel,
      Value<String?> scoreUnit,
      Value<int?> defaultTargetTimeSeconds,
      Value<int?> defaultTargetReps,
      Value<double?> defaultTargetScore,
      Value<int?> defaultTargetScoreTimeMs,
      Value<bool> autoStartNextTimedStep,
      Value<String> category,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<DateTime?> archivedAt,
      Value<int> rowid,
    });
typedef $$ExercisesTableUpdateCompanionBuilder =
    ExercisesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> name,
      Value<String?> description,
      Value<String?> iconMediaId,
      Value<String?> videoMediaId,
      Value<bool> hasTimeMeasure,
      Value<bool> hasRepsMeasure,
      Value<bool> hasScoreMeasure,
      Value<String> scoreInputMode,
      Value<String?> scoreLabel,
      Value<String?> scoreUnit,
      Value<int?> defaultTargetTimeSeconds,
      Value<int?> defaultTargetReps,
      Value<double?> defaultTargetScore,
      Value<int?> defaultTargetScoreTimeMs,
      Value<bool> autoStartNextTimedStep,
      Value<String> category,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<DateTime?> archivedAt,
      Value<int> rowid,
    });

final class $$ExercisesTableReferences
    extends BaseReferences<_$AppDatabase, $ExercisesTable, Exercise> {
  $$ExercisesTableReferences(super.$_db, super.$_table, super.$_typedResult);

  static $MediaAssetsTable _iconMediaIdTable(_$AppDatabase db) =>
      db.mediaAssets.createAlias('exercises__icon_media_id__media_assets__id');

  $$MediaAssetsTableProcessedTableManager? get iconMediaId {
    final $_column = $_itemColumn<String>('icon_media_id');
    if ($_column == null) return null;
    final manager = $$MediaAssetsTableTableManager(
      $_db,
      $_db.mediaAssets,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_iconMediaIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $MediaAssetsTable _videoMediaIdTable(_$AppDatabase db) =>
      db.mediaAssets.createAlias('exercises__video_media_id__media_assets__id');

  $$MediaAssetsTableProcessedTableManager? get videoMediaId {
    final $_column = $_itemColumn<String>('video_media_id');
    if ($_column == null) return null;
    final manager = $$MediaAssetsTableTableManager(
      $_db,
      $_db.mediaAssets,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_videoMediaIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static MultiTypedResultKey<$ExerciseImagesTable, List<ExerciseImage>>
  _exerciseImagesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.exerciseImages,
    aliasName: 'exercises__id__exercise_images__exercise_id',
  );

  $$ExerciseImagesTableProcessedTableManager get exerciseImagesRefs {
    final manager = $$ExerciseImagesTableTableManager(
      $_db,
      $_db.exerciseImages,
    ).filter((f) => f.exerciseId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(_exerciseImagesRefsTable($_db));
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ExerciseStepsTable, List<ExerciseStep>>
  _exerciseStepsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.exerciseSteps,
    aliasName: 'exercises__id__exercise_steps__exercise_id',
  );

  $$ExerciseStepsTableProcessedTableManager get exerciseStepsRefs {
    final manager = $$ExerciseStepsTableTableManager(
      $_db,
      $_db.exerciseSteps,
    ).filter((f) => f.exerciseId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(_exerciseStepsRefsTable($_db));
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<$ProgramExercisesTable, List<ProgramExercise>>
  _programExercisesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.programExercises,
    aliasName: 'exercises__id__program_exercises__source_exercise_id',
  );

  $$ProgramExercisesTableProcessedTableManager get programExercisesRefs {
    final manager =
        $$ProgramExercisesTableTableManager($_db, $_db.programExercises).filter(
          (f) => f.sourceExerciseId.id.sqlEquals($_itemColumn<String>('id')!),
        );

    final cache = $_typedResult.readTableOrNull(
      _programExercisesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$ExercisesTableFilterComposer
    extends Composer<_$AppDatabase, $ExercisesTable> {
  $$ExercisesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$MediaAssetsTableFilterComposer get iconMediaId {
    final $$MediaAssetsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.iconMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableFilterComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableFilterComposer get videoMediaId {
    final $$MediaAssetsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.videoMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableFilterComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<bool> exerciseImagesRefs(
    Expression<bool> Function($$ExerciseImagesTableFilterComposer f) f,
  ) {
    final $$ExerciseImagesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseImages,
      getReferencedColumn: (t) => t.exerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseImagesTableFilterComposer(
            $db: $db,
            $table: $db.exerciseImages,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> exerciseStepsRefs(
    Expression<bool> Function($$ExerciseStepsTableFilterComposer f) f,
  ) {
    final $$ExerciseStepsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseSteps,
      getReferencedColumn: (t) => t.exerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseStepsTableFilterComposer(
            $db: $db,
            $table: $db.exerciseSteps,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> programExercisesRefs(
    Expression<bool> Function($$ProgramExercisesTableFilterComposer f) f,
  ) {
    final $$ProgramExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.sourceExerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableFilterComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$ExercisesTableOrderingComposer
    extends Composer<_$AppDatabase, $ExercisesTable> {
  $$ExercisesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$MediaAssetsTableOrderingComposer get iconMediaId {
    final $$MediaAssetsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.iconMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableOrderingComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableOrderingComposer get videoMediaId {
    final $$MediaAssetsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.videoMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableOrderingComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$MediaAssetsTableAnnotationComposer get iconMediaId {
    final $$MediaAssetsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.iconMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableAnnotationComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableAnnotationComposer get videoMediaId {
    final $$MediaAssetsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.videoMediaId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableAnnotationComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<T> exerciseImagesRefs<T extends Object>(
    Expression<T> Function($$ExerciseImagesTableAnnotationComposer a) f,
  ) {
    final $$ExerciseImagesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseImages,
      getReferencedColumn: (t) => t.exerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseImagesTableAnnotationComposer(
            $db: $db,
            $table: $db.exerciseImages,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> exerciseStepsRefs<T extends Object>(
    Expression<T> Function($$ExerciseStepsTableAnnotationComposer a) f,
  ) {
    final $$ExerciseStepsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.exerciseSteps,
      getReferencedColumn: (t) => t.exerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExerciseStepsTableAnnotationComposer(
            $db: $db,
            $table: $db.exerciseSteps,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> programExercisesRefs<T extends Object>(
    Expression<T> Function($$ProgramExercisesTableAnnotationComposer a) f,
  ) {
    final $$ProgramExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.sourceExerciseId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }
}

class $$ExercisesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ExercisesTable,
          Exercise,
          $$ExercisesTableFilterComposer,
          $$ExercisesTableOrderingComposer,
          $$ExercisesTableAnnotationComposer,
          $$ExercisesTableCreateCompanionBuilder,
          $$ExercisesTableUpdateCompanionBuilder,
          (Exercise, $$ExercisesTableReferences),
          Exercise,
          PrefetchHooks Function({
            bool iconMediaId,
            bool videoMediaId,
            bool exerciseImagesRefs,
            bool exerciseStepsRefs,
            bool programExercisesRefs,
          })
        > {
  $$ExercisesTableTableManager(_$AppDatabase db, $ExercisesTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ExercisesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ExercisesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ExercisesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<String?> description = const Value.absent(),
                Value<String?> iconMediaId = const Value.absent(),
                Value<String?> videoMediaId = const Value.absent(),
                Value<bool> hasTimeMeasure = const Value.absent(),
                Value<bool> hasRepsMeasure = const Value.absent(),
                Value<bool> hasScoreMeasure = const Value.absent(),
                Value<String> scoreInputMode = const Value.absent(),
                Value<String?> scoreLabel = const Value.absent(),
                Value<String?> scoreUnit = const Value.absent(),
                Value<int?> defaultTargetTimeSeconds = const Value.absent(),
                Value<int?> defaultTargetReps = const Value.absent(),
                Value<double?> defaultTargetScore = const Value.absent(),
                Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
                Value<bool> autoStartNextTimedStep = const Value.absent(),
                Value<String> category = const Value.absent(),
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<DateTime?> archivedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExercisesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                description: description,
                iconMediaId: iconMediaId,
                videoMediaId: videoMediaId,
                hasTimeMeasure: hasTimeMeasure,
                hasRepsMeasure: hasRepsMeasure,
                hasScoreMeasure: hasScoreMeasure,
                scoreInputMode: scoreInputMode,
                scoreLabel: scoreLabel,
                scoreUnit: scoreUnit,
                defaultTargetTimeSeconds: defaultTargetTimeSeconds,
                defaultTargetReps: defaultTargetReps,
                defaultTargetScore: defaultTargetScore,
                defaultTargetScoreTimeMs: defaultTargetScoreTimeMs,
                autoStartNextTimedStep: autoStartNextTimedStep,
                category: category,
                isExample: isExample,
                tagsJson: tagsJson,
                archivedAt: archivedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String name,
                Value<String?> description = const Value.absent(),
                Value<String?> iconMediaId = const Value.absent(),
                Value<String?> videoMediaId = const Value.absent(),
                required bool hasTimeMeasure,
                required bool hasRepsMeasure,
                required bool hasScoreMeasure,
                Value<String> scoreInputMode = const Value.absent(),
                Value<String?> scoreLabel = const Value.absent(),
                Value<String?> scoreUnit = const Value.absent(),
                Value<int?> defaultTargetTimeSeconds = const Value.absent(),
                Value<int?> defaultTargetReps = const Value.absent(),
                Value<double?> defaultTargetScore = const Value.absent(),
                Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
                Value<bool> autoStartNextTimedStep = const Value.absent(),
                Value<String> category = const Value.absent(),
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<DateTime?> archivedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExercisesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                description: description,
                iconMediaId: iconMediaId,
                videoMediaId: videoMediaId,
                hasTimeMeasure: hasTimeMeasure,
                hasRepsMeasure: hasRepsMeasure,
                hasScoreMeasure: hasScoreMeasure,
                scoreInputMode: scoreInputMode,
                scoreLabel: scoreLabel,
                scoreUnit: scoreUnit,
                defaultTargetTimeSeconds: defaultTargetTimeSeconds,
                defaultTargetReps: defaultTargetReps,
                defaultTargetScore: defaultTargetScore,
                defaultTargetScoreTimeMs: defaultTargetScoreTimeMs,
                autoStartNextTimedStep: autoStartNextTimedStep,
                category: category,
                isExample: isExample,
                tagsJson: tagsJson,
                archivedAt: archivedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ExercisesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                iconMediaId = false,
                videoMediaId = false,
                exerciseImagesRefs = false,
                exerciseStepsRefs = false,
                programExercisesRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (exerciseImagesRefs) db.exerciseImages,
                    if (exerciseStepsRefs) db.exerciseSteps,
                    if (programExercisesRefs) db.programExercises,
                  ],
                  addJoins:
                      <
                        T extends TableManagerState<
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic
                        >
                      >(state) {
                        if (iconMediaId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.iconMediaId,
                                    referencedTable: $$ExercisesTableReferences
                                        ._iconMediaIdTable(db),
                                    referencedColumn: $$ExercisesTableReferences
                                        ._iconMediaIdTable(db)
                                        .id,
                                  )
                                  as T;
                        }
                        if (videoMediaId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.videoMediaId,
                                    referencedTable: $$ExercisesTableReferences
                                        ._videoMediaIdTable(db),
                                    referencedColumn: $$ExercisesTableReferences
                                        ._videoMediaIdTable(db)
                                        .id,
                                  )
                                  as T;
                        }

                        return state;
                      },
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (exerciseImagesRefs)
                        await $_getPrefetchedData<
                          Exercise,
                          $ExercisesTable,
                          ExerciseImage
                        >(
                          currentTable: table,
                          referencedTable: $$ExercisesTableReferences
                              ._exerciseImagesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ExercisesTableReferences(
                                db,
                                table,
                                p0,
                              ).exerciseImagesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.exerciseId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (exerciseStepsRefs)
                        await $_getPrefetchedData<
                          Exercise,
                          $ExercisesTable,
                          ExerciseStep
                        >(
                          currentTable: table,
                          referencedTable: $$ExercisesTableReferences
                              ._exerciseStepsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ExercisesTableReferences(
                                db,
                                table,
                                p0,
                              ).exerciseStepsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.exerciseId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (programExercisesRefs)
                        await $_getPrefetchedData<
                          Exercise,
                          $ExercisesTable,
                          ProgramExercise
                        >(
                          currentTable: table,
                          referencedTable: $$ExercisesTableReferences
                              ._programExercisesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ExercisesTableReferences(
                                db,
                                table,
                                p0,
                              ).programExercisesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.sourceExerciseId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$ExercisesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ExercisesTable,
      Exercise,
      $$ExercisesTableFilterComposer,
      $$ExercisesTableOrderingComposer,
      $$ExercisesTableAnnotationComposer,
      $$ExercisesTableCreateCompanionBuilder,
      $$ExercisesTableUpdateCompanionBuilder,
      (Exercise, $$ExercisesTableReferences),
      Exercise,
      PrefetchHooks Function({
        bool iconMediaId,
        bool videoMediaId,
        bool exerciseImagesRefs,
        bool exerciseStepsRefs,
        bool programExercisesRefs,
      })
    >;
typedef $$ExerciseImagesTableCreateCompanionBuilder =
    ExerciseImagesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String exerciseId,
      required String mediaAssetId,
      required int position,
      Value<int> rowid,
    });
typedef $$ExerciseImagesTableUpdateCompanionBuilder =
    ExerciseImagesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> exerciseId,
      Value<String> mediaAssetId,
      Value<int> position,
      Value<int> rowid,
    });

final class $$ExerciseImagesTableReferences
    extends BaseReferences<_$AppDatabase, $ExerciseImagesTable, ExerciseImage> {
  $$ExerciseImagesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ExercisesTable _exerciseIdTable(_$AppDatabase db) =>
      db.exercises.createAlias('exercise_images__exercise_id__exercises__id');

  $$ExercisesTableProcessedTableManager get exerciseId {
    final $_column = $_itemColumn<String>('exercise_id')!;

    final manager = $$ExercisesTableTableManager(
      $_db,
      $_db.exercises,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_exerciseIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $MediaAssetsTable _mediaAssetIdTable(_$AppDatabase db) => db
      .mediaAssets
      .createAlias('exercise_images__media_asset_id__media_assets__id');

  $$MediaAssetsTableProcessedTableManager get mediaAssetId {
    final $_column = $_itemColumn<String>('media_asset_id')!;

    final manager = $$MediaAssetsTableTableManager(
      $_db,
      $_db.mediaAssets,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_mediaAssetIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ExerciseImagesTableFilterComposer
    extends Composer<_$AppDatabase, $ExerciseImagesTable> {
  $$ExerciseImagesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableFilterComposer get exerciseId {
    final $$ExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableFilterComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableFilterComposer get mediaAssetId {
    final $$MediaAssetsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.mediaAssetId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableFilterComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ExerciseImagesTableOrderingComposer
    extends Composer<_$AppDatabase, $ExerciseImagesTable> {
  $$ExerciseImagesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableOrderingComposer get exerciseId {
    final $$ExercisesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableOrderingComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableOrderingComposer get mediaAssetId {
    final $$MediaAssetsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.mediaAssetId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableOrderingComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableAnnotationComposer get exerciseId {
    final $$ExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableAnnotationComposer get mediaAssetId {
    final $$MediaAssetsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.mediaAssetId,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableAnnotationComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ExerciseImagesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ExerciseImagesTable,
          ExerciseImage,
          $$ExerciseImagesTableFilterComposer,
          $$ExerciseImagesTableOrderingComposer,
          $$ExerciseImagesTableAnnotationComposer,
          $$ExerciseImagesTableCreateCompanionBuilder,
          $$ExerciseImagesTableUpdateCompanionBuilder,
          (ExerciseImage, $$ExerciseImagesTableReferences),
          ExerciseImage,
          PrefetchHooks Function({bool exerciseId, bool mediaAssetId})
        > {
  $$ExerciseImagesTableTableManager(
    _$AppDatabase db,
    $ExerciseImagesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ExerciseImagesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ExerciseImagesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ExerciseImagesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> exerciseId = const Value.absent(),
                Value<String> mediaAssetId = const Value.absent(),
                Value<int> position = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExerciseImagesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                exerciseId: exerciseId,
                mediaAssetId: mediaAssetId,
                position: position,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String exerciseId,
                required String mediaAssetId,
                required int position,
                Value<int> rowid = const Value.absent(),
              }) => ExerciseImagesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                exerciseId: exerciseId,
                mediaAssetId: mediaAssetId,
                position: position,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ExerciseImagesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({exerciseId = false, mediaAssetId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (exerciseId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.exerciseId,
                                referencedTable: $$ExerciseImagesTableReferences
                                    ._exerciseIdTable(db),
                                referencedColumn:
                                    $$ExerciseImagesTableReferences
                                        ._exerciseIdTable(db)
                                        .id,
                              )
                              as T;
                    }
                    if (mediaAssetId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.mediaAssetId,
                                referencedTable: $$ExerciseImagesTableReferences
                                    ._mediaAssetIdTable(db),
                                referencedColumn:
                                    $$ExerciseImagesTableReferences
                                        ._mediaAssetIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ExerciseImagesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ExerciseImagesTable,
      ExerciseImage,
      $$ExerciseImagesTableFilterComposer,
      $$ExerciseImagesTableOrderingComposer,
      $$ExerciseImagesTableAnnotationComposer,
      $$ExerciseImagesTableCreateCompanionBuilder,
      $$ExerciseImagesTableUpdateCompanionBuilder,
      (ExerciseImage, $$ExerciseImagesTableReferences),
      ExerciseImage,
      PrefetchHooks Function({bool exerciseId, bool mediaAssetId})
    >;
typedef $$ExerciseStepsTableCreateCompanionBuilder =
    ExerciseStepsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String exerciseId,
      required int position,
      required String name,
      required String type,
      required int defaultTargetValue,
      required bool hasScore,
      Value<String?> scoreInputMode,
      Value<String?> scoreLabel,
      Value<String?> scoreUnit,
      Value<double?> defaultTargetScore,
      Value<int?> defaultTargetScoreTimeMs,
      Value<int> rowid,
    });
typedef $$ExerciseStepsTableUpdateCompanionBuilder =
    ExerciseStepsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> exerciseId,
      Value<int> position,
      Value<String> name,
      Value<String> type,
      Value<int> defaultTargetValue,
      Value<bool> hasScore,
      Value<String?> scoreInputMode,
      Value<String?> scoreLabel,
      Value<String?> scoreUnit,
      Value<double?> defaultTargetScore,
      Value<int?> defaultTargetScoreTimeMs,
      Value<int> rowid,
    });

final class $$ExerciseStepsTableReferences
    extends BaseReferences<_$AppDatabase, $ExerciseStepsTable, ExerciseStep> {
  $$ExerciseStepsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ExercisesTable _exerciseIdTable(_$AppDatabase db) =>
      db.exercises.createAlias('exercise_steps__exercise_id__exercises__id');

  $$ExercisesTableProcessedTableManager get exerciseId {
    final $_column = $_itemColumn<String>('exercise_id')!;

    final manager = $$ExercisesTableTableManager(
      $_db,
      $_db.exercises,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_exerciseIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ExerciseStepsTableFilterComposer
    extends Composer<_$AppDatabase, $ExerciseStepsTable> {
  $$ExerciseStepsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableFilterComposer get exerciseId {
    final $$ExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableFilterComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ExerciseStepsTableOrderingComposer
    extends Composer<_$AppDatabase, $ExerciseStepsTable> {
  $$ExerciseStepsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableOrderingComposer get exerciseId {
    final $$ExercisesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableOrderingComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  $$ExercisesTableAnnotationComposer get exerciseId {
    final $$ExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ExerciseStepsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ExerciseStepsTable,
          ExerciseStep,
          $$ExerciseStepsTableFilterComposer,
          $$ExerciseStepsTableOrderingComposer,
          $$ExerciseStepsTableAnnotationComposer,
          $$ExerciseStepsTableCreateCompanionBuilder,
          $$ExerciseStepsTableUpdateCompanionBuilder,
          (ExerciseStep, $$ExerciseStepsTableReferences),
          ExerciseStep,
          PrefetchHooks Function({bool exerciseId})
        > {
  $$ExerciseStepsTableTableManager(_$AppDatabase db, $ExerciseStepsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ExerciseStepsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ExerciseStepsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ExerciseStepsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> exerciseId = const Value.absent(),
                Value<int> position = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<String> type = const Value.absent(),
                Value<int> defaultTargetValue = const Value.absent(),
                Value<bool> hasScore = const Value.absent(),
                Value<String?> scoreInputMode = const Value.absent(),
                Value<String?> scoreLabel = const Value.absent(),
                Value<String?> scoreUnit = const Value.absent(),
                Value<double?> defaultTargetScore = const Value.absent(),
                Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExerciseStepsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                exerciseId: exerciseId,
                position: position,
                name: name,
                type: type,
                defaultTargetValue: defaultTargetValue,
                hasScore: hasScore,
                scoreInputMode: scoreInputMode,
                scoreLabel: scoreLabel,
                scoreUnit: scoreUnit,
                defaultTargetScore: defaultTargetScore,
                defaultTargetScoreTimeMs: defaultTargetScoreTimeMs,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String exerciseId,
                required int position,
                required String name,
                required String type,
                required int defaultTargetValue,
                required bool hasScore,
                Value<String?> scoreInputMode = const Value.absent(),
                Value<String?> scoreLabel = const Value.absent(),
                Value<String?> scoreUnit = const Value.absent(),
                Value<double?> defaultTargetScore = const Value.absent(),
                Value<int?> defaultTargetScoreTimeMs = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ExerciseStepsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                exerciseId: exerciseId,
                position: position,
                name: name,
                type: type,
                defaultTargetValue: defaultTargetValue,
                hasScore: hasScore,
                scoreInputMode: scoreInputMode,
                scoreLabel: scoreLabel,
                scoreUnit: scoreUnit,
                defaultTargetScore: defaultTargetScore,
                defaultTargetScoreTimeMs: defaultTargetScoreTimeMs,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ExerciseStepsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({exerciseId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (exerciseId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.exerciseId,
                                referencedTable: $$ExerciseStepsTableReferences
                                    ._exerciseIdTable(db),
                                referencedColumn: $$ExerciseStepsTableReferences
                                    ._exerciseIdTable(db)
                                    .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$ExerciseStepsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ExerciseStepsTable,
      ExerciseStep,
      $$ExerciseStepsTableFilterComposer,
      $$ExerciseStepsTableOrderingComposer,
      $$ExerciseStepsTableAnnotationComposer,
      $$ExerciseStepsTableCreateCompanionBuilder,
      $$ExerciseStepsTableUpdateCompanionBuilder,
      (ExerciseStep, $$ExerciseStepsTableReferences),
      ExerciseStep,
      PrefetchHooks Function({bool exerciseId})
    >;
typedef $$LocalSeedMetadataTableCreateCompanionBuilder =
    LocalSeedMetadataCompanion Function({
      required String key,
      required int version,
      required DateTime appliedAt,
      Value<int> rowid,
    });
typedef $$LocalSeedMetadataTableUpdateCompanionBuilder =
    LocalSeedMetadataCompanion Function({
      Value<String> key,
      Value<int> version,
      Value<DateTime> appliedAt,
      Value<int> rowid,
    });

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

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

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

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

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

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

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

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

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

class $$LocalSeedMetadataTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $LocalSeedMetadataTable,
          LocalSeedMetadataData,
          $$LocalSeedMetadataTableFilterComposer,
          $$LocalSeedMetadataTableOrderingComposer,
          $$LocalSeedMetadataTableAnnotationComposer,
          $$LocalSeedMetadataTableCreateCompanionBuilder,
          $$LocalSeedMetadataTableUpdateCompanionBuilder,
          (
            LocalSeedMetadataData,
            BaseReferences<
              _$AppDatabase,
              $LocalSeedMetadataTable,
              LocalSeedMetadataData
            >,
          ),
          LocalSeedMetadataData,
          PrefetchHooks Function()
        > {
  $$LocalSeedMetadataTableTableManager(
    _$AppDatabase db,
    $LocalSeedMetadataTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$LocalSeedMetadataTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$LocalSeedMetadataTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$LocalSeedMetadataTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> key = const Value.absent(),
                Value<int> version = const Value.absent(),
                Value<DateTime> appliedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => LocalSeedMetadataCompanion(
                key: key,
                version: version,
                appliedAt: appliedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String key,
                required int version,
                required DateTime appliedAt,
                Value<int> rowid = const Value.absent(),
              }) => LocalSeedMetadataCompanion.insert(
                key: key,
                version: version,
                appliedAt: appliedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$LocalSeedMetadataTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $LocalSeedMetadataTable,
      LocalSeedMetadataData,
      $$LocalSeedMetadataTableFilterComposer,
      $$LocalSeedMetadataTableOrderingComposer,
      $$LocalSeedMetadataTableAnnotationComposer,
      $$LocalSeedMetadataTableCreateCompanionBuilder,
      $$LocalSeedMetadataTableUpdateCompanionBuilder,
      (
        LocalSeedMetadataData,
        BaseReferences<
          _$AppDatabase,
          $LocalSeedMetadataTable,
          LocalSeedMetadataData
        >,
      ),
      LocalSeedMetadataData,
      PrefetchHooks Function()
    >;
typedef $$OnlineAccountSessionsTableCreateCompanionBuilder =
    OnlineAccountSessionsCompanion Function({
      required String id,
      required String serverUserId,
      required String email,
      Value<String?> displayName,
      required bool isLoggedIn,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> lastAuthenticatedAt,
      Value<int> rowid,
    });
typedef $$OnlineAccountSessionsTableUpdateCompanionBuilder =
    OnlineAccountSessionsCompanion Function({
      Value<String> id,
      Value<String> serverUserId,
      Value<String> email,
      Value<String?> displayName,
      Value<bool> isLoggedIn,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> lastAuthenticatedAt,
      Value<int> rowid,
    });

class $$OnlineAccountSessionsTableFilterComposer
    extends Composer<_$AppDatabase, $OnlineAccountSessionsTable> {
  $$OnlineAccountSessionsTableFilterComposer({
    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<String> get serverUserId => $composableBuilder(
    column: $table.serverUserId,
    builder: (column) => ColumnFilters(column),
  );

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

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

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

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

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

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

class $$OnlineAccountSessionsTableOrderingComposer
    extends Composer<_$AppDatabase, $OnlineAccountSessionsTable> {
  $$OnlineAccountSessionsTableOrderingComposer({
    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<String> get serverUserId => $composableBuilder(
    column: $table.serverUserId,
    builder: (column) => ColumnOrderings(column),
  );

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

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

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

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

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastAuthenticatedAt => $composableBuilder(
    column: $table.lastAuthenticatedAt,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$OnlineAccountSessionsTableAnnotationComposer
    extends Composer<_$AppDatabase, $OnlineAccountSessionsTable> {
  $$OnlineAccountSessionsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<String> get serverUserId => $composableBuilder(
    column: $table.serverUserId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get email =>
      $composableBuilder(column: $table.email, builder: (column) => column);

  GeneratedColumn<String> get displayName => $composableBuilder(
    column: $table.displayName,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isLoggedIn => $composableBuilder(
    column: $table.isLoggedIn,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get lastAuthenticatedAt => $composableBuilder(
    column: $table.lastAuthenticatedAt,
    builder: (column) => column,
  );
}

class $$OnlineAccountSessionsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $OnlineAccountSessionsTable,
          OnlineAccountSession,
          $$OnlineAccountSessionsTableFilterComposer,
          $$OnlineAccountSessionsTableOrderingComposer,
          $$OnlineAccountSessionsTableAnnotationComposer,
          $$OnlineAccountSessionsTableCreateCompanionBuilder,
          $$OnlineAccountSessionsTableUpdateCompanionBuilder,
          (
            OnlineAccountSession,
            BaseReferences<
              _$AppDatabase,
              $OnlineAccountSessionsTable,
              OnlineAccountSession
            >,
          ),
          OnlineAccountSession,
          PrefetchHooks Function()
        > {
  $$OnlineAccountSessionsTableTableManager(
    _$AppDatabase db,
    $OnlineAccountSessionsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$OnlineAccountSessionsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$OnlineAccountSessionsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$OnlineAccountSessionsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String> serverUserId = const Value.absent(),
                Value<String> email = const Value.absent(),
                Value<String?> displayName = const Value.absent(),
                Value<bool> isLoggedIn = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> lastAuthenticatedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => OnlineAccountSessionsCompanion(
                id: id,
                serverUserId: serverUserId,
                email: email,
                displayName: displayName,
                isLoggedIn: isLoggedIn,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthenticatedAt: lastAuthenticatedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required String serverUserId,
                required String email,
                Value<String?> displayName = const Value.absent(),
                required bool isLoggedIn,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> lastAuthenticatedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => OnlineAccountSessionsCompanion.insert(
                id: id,
                serverUserId: serverUserId,
                email: email,
                displayName: displayName,
                isLoggedIn: isLoggedIn,
                createdAt: createdAt,
                updatedAt: updatedAt,
                lastAuthenticatedAt: lastAuthenticatedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$OnlineAccountSessionsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $OnlineAccountSessionsTable,
      OnlineAccountSession,
      $$OnlineAccountSessionsTableFilterComposer,
      $$OnlineAccountSessionsTableOrderingComposer,
      $$OnlineAccountSessionsTableAnnotationComposer,
      $$OnlineAccountSessionsTableCreateCompanionBuilder,
      $$OnlineAccountSessionsTableUpdateCompanionBuilder,
      (
        OnlineAccountSession,
        BaseReferences<
          _$AppDatabase,
          $OnlineAccountSessionsTable,
          OnlineAccountSession
        >,
      ),
      OnlineAccountSession,
      PrefetchHooks Function()
    >;
typedef $$PendingShareActionsTableCreateCompanionBuilder =
    PendingShareActionsCompanion Function({
      required String id,
      required String actionType,
      Value<String?> shareId,
      Value<String?> resourceType,
      Value<String?> payloadJson,
      Value<String?> recipientEmailsJson,
      required DateTime createdAt,
      Value<DateTime?> lastAttemptAt,
      required int attemptCount,
      required String status,
      Value<int> rowid,
    });
typedef $$PendingShareActionsTableUpdateCompanionBuilder =
    PendingShareActionsCompanion Function({
      Value<String> id,
      Value<String> actionType,
      Value<String?> shareId,
      Value<String?> resourceType,
      Value<String?> payloadJson,
      Value<String?> recipientEmailsJson,
      Value<DateTime> createdAt,
      Value<DateTime?> lastAttemptAt,
      Value<int> attemptCount,
      Value<String> status,
      Value<int> rowid,
    });

class $$PendingShareActionsTableFilterComposer
    extends Composer<_$AppDatabase, $PendingShareActionsTable> {
  $$PendingShareActionsTableFilterComposer({
    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<String> get actionType => $composableBuilder(
    column: $table.actionType,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get shareId => $composableBuilder(
    column: $table.shareId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get recipientEmailsJson => $composableBuilder(
    column: $table.recipientEmailsJson,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get attemptCount => $composableBuilder(
    column: $table.attemptCount,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnFilters(column),
  );
}

class $$PendingShareActionsTableOrderingComposer
    extends Composer<_$AppDatabase, $PendingShareActionsTable> {
  $$PendingShareActionsTableOrderingComposer({
    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<String> get actionType => $composableBuilder(
    column: $table.actionType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get shareId => $composableBuilder(
    column: $table.shareId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get recipientEmailsJson => $composableBuilder(
    column: $table.recipientEmailsJson,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get attemptCount => $composableBuilder(
    column: $table.attemptCount,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$PendingShareActionsTableAnnotationComposer
    extends Composer<_$AppDatabase, $PendingShareActionsTable> {
  $$PendingShareActionsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<String> get actionType => $composableBuilder(
    column: $table.actionType,
    builder: (column) => column,
  );

  GeneratedColumn<String> get shareId =>
      $composableBuilder(column: $table.shareId, builder: (column) => column);

  GeneratedColumn<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => column,
  );

  GeneratedColumn<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => column,
  );

  GeneratedColumn<String> get recipientEmailsJson => $composableBuilder(
    column: $table.recipientEmailsJson,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => column,
  );

  GeneratedColumn<int> get attemptCount => $composableBuilder(
    column: $table.attemptCount,
    builder: (column) => column,
  );

  GeneratedColumn<String> get status =>
      $composableBuilder(column: $table.status, builder: (column) => column);
}

class $$PendingShareActionsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $PendingShareActionsTable,
          PendingShareAction,
          $$PendingShareActionsTableFilterComposer,
          $$PendingShareActionsTableOrderingComposer,
          $$PendingShareActionsTableAnnotationComposer,
          $$PendingShareActionsTableCreateCompanionBuilder,
          $$PendingShareActionsTableUpdateCompanionBuilder,
          (
            PendingShareAction,
            BaseReferences<
              _$AppDatabase,
              $PendingShareActionsTable,
              PendingShareAction
            >,
          ),
          PendingShareAction,
          PrefetchHooks Function()
        > {
  $$PendingShareActionsTableTableManager(
    _$AppDatabase db,
    $PendingShareActionsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$PendingShareActionsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$PendingShareActionsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$PendingShareActionsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String> actionType = const Value.absent(),
                Value<String?> shareId = const Value.absent(),
                Value<String?> resourceType = const Value.absent(),
                Value<String?> payloadJson = const Value.absent(),
                Value<String?> recipientEmailsJson = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime?> lastAttemptAt = const Value.absent(),
                Value<int> attemptCount = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => PendingShareActionsCompanion(
                id: id,
                actionType: actionType,
                shareId: shareId,
                resourceType: resourceType,
                payloadJson: payloadJson,
                recipientEmailsJson: recipientEmailsJson,
                createdAt: createdAt,
                lastAttemptAt: lastAttemptAt,
                attemptCount: attemptCount,
                status: status,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required String actionType,
                Value<String?> shareId = const Value.absent(),
                Value<String?> resourceType = const Value.absent(),
                Value<String?> payloadJson = const Value.absent(),
                Value<String?> recipientEmailsJson = const Value.absent(),
                required DateTime createdAt,
                Value<DateTime?> lastAttemptAt = const Value.absent(),
                required int attemptCount,
                required String status,
                Value<int> rowid = const Value.absent(),
              }) => PendingShareActionsCompanion.insert(
                id: id,
                actionType: actionType,
                shareId: shareId,
                resourceType: resourceType,
                payloadJson: payloadJson,
                recipientEmailsJson: recipientEmailsJson,
                createdAt: createdAt,
                lastAttemptAt: lastAttemptAt,
                attemptCount: attemptCount,
                status: status,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$PendingShareActionsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $PendingShareActionsTable,
      PendingShareAction,
      $$PendingShareActionsTableFilterComposer,
      $$PendingShareActionsTableOrderingComposer,
      $$PendingShareActionsTableAnnotationComposer,
      $$PendingShareActionsTableCreateCompanionBuilder,
      $$PendingShareActionsTableUpdateCompanionBuilder,
      (
        PendingShareAction,
        BaseReferences<
          _$AppDatabase,
          $PendingShareActionsTable,
          PendingShareAction
        >,
      ),
      PendingShareAction,
      PrefetchHooks Function()
    >;
typedef $$ProgramsTableCreateCompanionBuilder =
    ProgramsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String name,
      required int defaultRestSeconds,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<int> rowid,
    });
typedef $$ProgramsTableUpdateCompanionBuilder =
    ProgramsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> name,
      Value<int> defaultRestSeconds,
      Value<bool> isExample,
      Value<String> tagsJson,
      Value<int> rowid,
    });

final class $$ProgramsTableReferences
    extends BaseReferences<_$AppDatabase, $ProgramsTable, Program> {
  $$ProgramsTableReferences(super.$_db, super.$_table, super.$_typedResult);

  static MultiTypedResultKey<$ProgramExercisesTable, List<ProgramExercise>>
  _programExercisesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
    db.programExercises,
    aliasName: 'programs__id__program_exercises__program_id',
  );

  $$ProgramExercisesTableProcessedTableManager get programExercisesRefs {
    final manager = $$ProgramExercisesTableTableManager(
      $_db,
      $_db.programExercises,
    ).filter((f) => f.programId.id.sqlEquals($_itemColumn<String>('id')!));

    final cache = $_typedResult.readTableOrNull(
      _programExercisesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $WorkoutTemplateProgramsTable,
    List<WorkoutTemplateProgram>
  >
  _workoutTemplateProgramsRefsTable(_$AppDatabase db) =>
      MultiTypedResultKey.fromTable(
        db.workoutTemplatePrograms,
        aliasName: 'programs__id__workout_template_programs__source_program_id',
      );

  $$WorkoutTemplateProgramsTableProcessedTableManager
  get workoutTemplateProgramsRefs {
    final manager =
        $$WorkoutTemplateProgramsTableTableManager(
          $_db,
          $_db.workoutTemplatePrograms,
        ).filter(
          (f) => f.sourceProgramId.id.sqlEquals($_itemColumn<String>('id')!),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutTemplateProgramsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$ProgramsTableFilterComposer
    extends Composer<_$AppDatabase, $ProgramsTable> {
  $$ProgramsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get defaultRestSeconds => $composableBuilder(
    column: $table.defaultRestSeconds,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get isExample => $composableBuilder(
    column: $table.isExample,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get tagsJson => $composableBuilder(
    column: $table.tagsJson,
    builder: (column) => ColumnFilters(column),
  );

  Expression<bool> programExercisesRefs(
    Expression<bool> Function($$ProgramExercisesTableFilterComposer f) f,
  ) {
    final $$ProgramExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.programId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableFilterComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<bool> workoutTemplateProgramsRefs(
    Expression<bool> Function($$WorkoutTemplateProgramsTableFilterComposer f) f,
  ) {
    final $$WorkoutTemplateProgramsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.sourceProgramId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableFilterComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$ProgramsTableOrderingComposer
    extends Composer<_$AppDatabase, $ProgramsTable> {
  $$ProgramsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get name => $composableBuilder(
    column: $table.name,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get defaultRestSeconds => $composableBuilder(
    column: $table.defaultRestSeconds,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get isExample => $composableBuilder(
    column: $table.isExample,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get tagsJson => $composableBuilder(
    column: $table.tagsJson,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$ProgramsTableAnnotationComposer
    extends Composer<_$AppDatabase, $ProgramsTable> {
  $$ProgramsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get name =>
      $composableBuilder(column: $table.name, builder: (column) => column);

  GeneratedColumn<int> get defaultRestSeconds => $composableBuilder(
    column: $table.defaultRestSeconds,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get isExample =>
      $composableBuilder(column: $table.isExample, builder: (column) => column);

  GeneratedColumn<String> get tagsJson =>
      $composableBuilder(column: $table.tagsJson, builder: (column) => column);

  Expression<T> programExercisesRefs<T extends Object>(
    Expression<T> Function($$ProgramExercisesTableAnnotationComposer a) f,
  ) {
    final $$ProgramExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.id,
      referencedTable: $db.programExercises,
      getReferencedColumn: (t) => t.programId,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.programExercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return f(composer);
  }

  Expression<T> workoutTemplateProgramsRefs<T extends Object>(
    Expression<T> Function($$WorkoutTemplateProgramsTableAnnotationComposer a)
    f,
  ) {
    final $$WorkoutTemplateProgramsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.sourceProgramId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$ProgramsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ProgramsTable,
          Program,
          $$ProgramsTableFilterComposer,
          $$ProgramsTableOrderingComposer,
          $$ProgramsTableAnnotationComposer,
          $$ProgramsTableCreateCompanionBuilder,
          $$ProgramsTableUpdateCompanionBuilder,
          (Program, $$ProgramsTableReferences),
          Program,
          PrefetchHooks Function({
            bool programExercisesRefs,
            bool workoutTemplateProgramsRefs,
          })
        > {
  $$ProgramsTableTableManager(_$AppDatabase db, $ProgramsTable table)
    : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ProgramsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ProgramsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ProgramsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> name = const Value.absent(),
                Value<int> defaultRestSeconds = const Value.absent(),
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ProgramsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                defaultRestSeconds: defaultRestSeconds,
                isExample: isExample,
                tagsJson: tagsJson,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String name,
                required int defaultRestSeconds,
                Value<bool> isExample = const Value.absent(),
                Value<String> tagsJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ProgramsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                name: name,
                defaultRestSeconds: defaultRestSeconds,
                isExample: isExample,
                tagsJson: tagsJson,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ProgramsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                programExercisesRefs = false,
                workoutTemplateProgramsRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (programExercisesRefs) db.programExercises,
                    if (workoutTemplateProgramsRefs) db.workoutTemplatePrograms,
                  ],
                  addJoins: null,
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (programExercisesRefs)
                        await $_getPrefetchedData<
                          Program,
                          $ProgramsTable,
                          ProgramExercise
                        >(
                          currentTable: table,
                          referencedTable: $$ProgramsTableReferences
                              ._programExercisesRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ProgramsTableReferences(
                                db,
                                table,
                                p0,
                              ).programExercisesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.programId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (workoutTemplateProgramsRefs)
                        await $_getPrefetchedData<
                          Program,
                          $ProgramsTable,
                          WorkoutTemplateProgram
                        >(
                          currentTable: table,
                          referencedTable: $$ProgramsTableReferences
                              ._workoutTemplateProgramsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$ProgramsTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutTemplateProgramsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.sourceProgramId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$ProgramsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ProgramsTable,
      Program,
      $$ProgramsTableFilterComposer,
      $$ProgramsTableOrderingComposer,
      $$ProgramsTableAnnotationComposer,
      $$ProgramsTableCreateCompanionBuilder,
      $$ProgramsTableUpdateCompanionBuilder,
      (Program, $$ProgramsTableReferences),
      Program,
      PrefetchHooks Function({
        bool programExercisesRefs,
        bool workoutTemplateProgramsRefs,
      })
    >;
typedef $$ProgramExercisesTableCreateCompanionBuilder =
    ProgramExercisesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String programId,
      Value<String?> sourceExerciseId,
      required int position,
      required String exerciseNameSnapshot,
      Value<String?> exerciseDescriptionSnapshot,
      Value<String?> exerciseImageMediaIdSnapshot,
      Value<String?> exerciseImageMediaIdsSnapshotJson,
      Value<String?> exerciseStepsSnapshotJson,
      Value<bool> autoStartNextTimedStepSnapshot,
      Value<bool?> autoStartNextTimedStepOverride,
      Value<String?> exerciseVideoMediaIdSnapshot,
      Value<bool> exerciseArchivedSnapshot,
      required bool availableTimeSnapshot,
      required bool availableRepsSnapshot,
      required bool availableScoreSnapshot,
      Value<String> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      required int setsCount,
      required bool timeEnabled,
      required bool repsEnabled,
      required bool scoreEnabled,
      Value<int?> targetTimeSeconds,
      Value<int?> targetReps,
      Value<double?> targetScore,
      Value<int?> targetScoreTimeMs,
      Value<int?> restSecondsOverride,
      Value<int> rowid,
    });
typedef $$ProgramExercisesTableUpdateCompanionBuilder =
    ProgramExercisesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> programId,
      Value<String?> sourceExerciseId,
      Value<int> position,
      Value<String> exerciseNameSnapshot,
      Value<String?> exerciseDescriptionSnapshot,
      Value<String?> exerciseImageMediaIdSnapshot,
      Value<String?> exerciseImageMediaIdsSnapshotJson,
      Value<String?> exerciseStepsSnapshotJson,
      Value<bool> autoStartNextTimedStepSnapshot,
      Value<bool?> autoStartNextTimedStepOverride,
      Value<String?> exerciseVideoMediaIdSnapshot,
      Value<bool> exerciseArchivedSnapshot,
      Value<bool> availableTimeSnapshot,
      Value<bool> availableRepsSnapshot,
      Value<bool> availableScoreSnapshot,
      Value<String> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<int> setsCount,
      Value<bool> timeEnabled,
      Value<bool> repsEnabled,
      Value<bool> scoreEnabled,
      Value<int?> targetTimeSeconds,
      Value<int?> targetReps,
      Value<double?> targetScore,
      Value<int?> targetScoreTimeMs,
      Value<int?> restSecondsOverride,
      Value<int> rowid,
    });

final class $$ProgramExercisesTableReferences
    extends
        BaseReferences<_$AppDatabase, $ProgramExercisesTable, ProgramExercise> {
  $$ProgramExercisesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $ProgramsTable _programIdTable(_$AppDatabase db) =>
      db.programs.createAlias('program_exercises__program_id__programs__id');

  $$ProgramsTableProcessedTableManager get programId {
    final $_column = $_itemColumn<String>('program_id')!;

    final manager = $$ProgramsTableTableManager(
      $_db,
      $_db.programs,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_programIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $ExercisesTable _sourceExerciseIdTable(_$AppDatabase db) => db
      .exercises
      .createAlias('program_exercises__source_exercise_id__exercises__id');

  $$ExercisesTableProcessedTableManager? get sourceExerciseId {
    final $_column = $_itemColumn<String>('source_exercise_id');
    if ($_column == null) return null;
    final manager = $$ExercisesTableTableManager(
      $_db,
      $_db.exercises,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_sourceExerciseIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $MediaAssetsTable _exerciseImageMediaIdSnapshotTable(
    _$AppDatabase db,
  ) => db.mediaAssets.createAlias(
    'program_exercises__exercise_image_media_id_snapshot__media_assets__id',
  );

  $$MediaAssetsTableProcessedTableManager? get exerciseImageMediaIdSnapshot {
    final $_column = $_itemColumn<String>('exercise_image_media_id_snapshot');
    if ($_column == null) return null;
    final manager = $$MediaAssetsTableTableManager(
      $_db,
      $_db.mediaAssets,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _exerciseImageMediaIdSnapshotTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $MediaAssetsTable _exerciseVideoMediaIdSnapshotTable(
    _$AppDatabase db,
  ) => db.mediaAssets.createAlias(
    'program_exercises__exercise_video_media_id_snapshot__media_assets__id',
  );

  $$MediaAssetsTableProcessedTableManager? get exerciseVideoMediaIdSnapshot {
    final $_column = $_itemColumn<String>('exercise_video_media_id_snapshot');
    if ($_column == null) return null;
    final manager = $$MediaAssetsTableTableManager(
      $_db,
      $_db.mediaAssets,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _exerciseVideoMediaIdSnapshotTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$ProgramExercisesTableFilterComposer
    extends Composer<_$AppDatabase, $ProgramExercisesTable> {
  $$ProgramExercisesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get position => $composableBuilder(
    column: $table.position,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseDescriptionSnapshot => $composableBuilder(
    column: $table.exerciseDescriptionSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseImageMediaIdsSnapshotJson =>
      $composableBuilder(
        column: $table.exerciseImageMediaIdsSnapshotJson,
        builder: (column) => ColumnFilters(column),
      );

  ColumnFilters<String> get exerciseStepsSnapshotJson => $composableBuilder(
    column: $table.exerciseStepsSnapshotJson,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get autoStartNextTimedStepSnapshot => $composableBuilder(
    column: $table.autoStartNextTimedStepSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get autoStartNextTimedStepOverride => $composableBuilder(
    column: $table.autoStartNextTimedStepOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get exerciseArchivedSnapshot => $composableBuilder(
    column: $table.exerciseArchivedSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get availableTimeSnapshot => $composableBuilder(
    column: $table.availableTimeSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get availableRepsSnapshot => $composableBuilder(
    column: $table.availableRepsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get availableScoreSnapshot => $composableBuilder(
    column: $table.availableScoreSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get setsCount => $composableBuilder(
    column: $table.setsCount,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get timeEnabled => $composableBuilder(
    column: $table.timeEnabled,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get repsEnabled => $composableBuilder(
    column: $table.repsEnabled,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get scoreEnabled => $composableBuilder(
    column: $table.scoreEnabled,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetTimeSeconds => $composableBuilder(
    column: $table.targetTimeSeconds,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetReps => $composableBuilder(
    column: $table.targetReps,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get targetScore => $composableBuilder(
    column: $table.targetScore,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetScoreTimeMs => $composableBuilder(
    column: $table.targetScoreTimeMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get restSecondsOverride => $composableBuilder(
    column: $table.restSecondsOverride,
    builder: (column) => ColumnFilters(column),
  );

  $$ProgramsTableFilterComposer get programId {
    final $$ProgramsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.programId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableFilterComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ExercisesTableFilterComposer get sourceExerciseId {
    final $$ExercisesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceExerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableFilterComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableFilterComposer get exerciseImageMediaIdSnapshot {
    final $$MediaAssetsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseImageMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableFilterComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableFilterComposer get exerciseVideoMediaIdSnapshot {
    final $$MediaAssetsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseVideoMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableFilterComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ProgramExercisesTableOrderingComposer
    extends Composer<_$AppDatabase, $ProgramExercisesTable> {
  $$ProgramExercisesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get position => $composableBuilder(
    column: $table.position,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseDescriptionSnapshot => $composableBuilder(
    column: $table.exerciseDescriptionSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseImageMediaIdsSnapshotJson =>
      $composableBuilder(
        column: $table.exerciseImageMediaIdsSnapshotJson,
        builder: (column) => ColumnOrderings(column),
      );

  ColumnOrderings<String> get exerciseStepsSnapshotJson => $composableBuilder(
    column: $table.exerciseStepsSnapshotJson,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get autoStartNextTimedStepSnapshot =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepSnapshot,
        builder: (column) => ColumnOrderings(column),
      );

  ColumnOrderings<bool> get autoStartNextTimedStepOverride =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepOverride,
        builder: (column) => ColumnOrderings(column),
      );

  ColumnOrderings<bool> get exerciseArchivedSnapshot => $composableBuilder(
    column: $table.exerciseArchivedSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get availableTimeSnapshot => $composableBuilder(
    column: $table.availableTimeSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get availableRepsSnapshot => $composableBuilder(
    column: $table.availableRepsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get availableScoreSnapshot => $composableBuilder(
    column: $table.availableScoreSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get setsCount => $composableBuilder(
    column: $table.setsCount,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get timeEnabled => $composableBuilder(
    column: $table.timeEnabled,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get repsEnabled => $composableBuilder(
    column: $table.repsEnabled,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get scoreEnabled => $composableBuilder(
    column: $table.scoreEnabled,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetTimeSeconds => $composableBuilder(
    column: $table.targetTimeSeconds,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetReps => $composableBuilder(
    column: $table.targetReps,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get targetScore => $composableBuilder(
    column: $table.targetScore,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetScoreTimeMs => $composableBuilder(
    column: $table.targetScoreTimeMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get restSecondsOverride => $composableBuilder(
    column: $table.restSecondsOverride,
    builder: (column) => ColumnOrderings(column),
  );

  $$ProgramsTableOrderingComposer get programId {
    final $$ProgramsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.programId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableOrderingComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ExercisesTableOrderingComposer get sourceExerciseId {
    final $$ExercisesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceExerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableOrderingComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableOrderingComposer get exerciseImageMediaIdSnapshot {
    final $$MediaAssetsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseImageMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableOrderingComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableOrderingComposer get exerciseVideoMediaIdSnapshot {
    final $$MediaAssetsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseVideoMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableOrderingComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ProgramExercisesTableAnnotationComposer
    extends Composer<_$AppDatabase, $ProgramExercisesTable> {
  $$ProgramExercisesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<int> get position =>
      $composableBuilder(column: $table.position, builder: (column) => column);

  GeneratedColumn<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get exerciseDescriptionSnapshot => $composableBuilder(
    column: $table.exerciseDescriptionSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get exerciseImageMediaIdsSnapshotJson =>
      $composableBuilder(
        column: $table.exerciseImageMediaIdsSnapshotJson,
        builder: (column) => column,
      );

  GeneratedColumn<String> get exerciseStepsSnapshotJson => $composableBuilder(
    column: $table.exerciseStepsSnapshotJson,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get autoStartNextTimedStepSnapshot =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepSnapshot,
        builder: (column) => column,
      );

  GeneratedColumn<bool> get autoStartNextTimedStepOverride =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepOverride,
        builder: (column) => column,
      );

  GeneratedColumn<bool> get exerciseArchivedSnapshot => $composableBuilder(
    column: $table.exerciseArchivedSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get availableTimeSnapshot => $composableBuilder(
    column: $table.availableTimeSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get availableRepsSnapshot => $composableBuilder(
    column: $table.availableRepsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get availableScoreSnapshot => $composableBuilder(
    column: $table.availableScoreSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get setsCount =>
      $composableBuilder(column: $table.setsCount, builder: (column) => column);

  GeneratedColumn<bool> get timeEnabled => $composableBuilder(
    column: $table.timeEnabled,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get repsEnabled => $composableBuilder(
    column: $table.repsEnabled,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get scoreEnabled => $composableBuilder(
    column: $table.scoreEnabled,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetTimeSeconds => $composableBuilder(
    column: $table.targetTimeSeconds,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetReps => $composableBuilder(
    column: $table.targetReps,
    builder: (column) => column,
  );

  GeneratedColumn<double> get targetScore => $composableBuilder(
    column: $table.targetScore,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetScoreTimeMs => $composableBuilder(
    column: $table.targetScoreTimeMs,
    builder: (column) => column,
  );

  GeneratedColumn<int> get restSecondsOverride => $composableBuilder(
    column: $table.restSecondsOverride,
    builder: (column) => column,
  );

  $$ProgramsTableAnnotationComposer get programId {
    final $$ProgramsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.programId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableAnnotationComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ExercisesTableAnnotationComposer get sourceExerciseId {
    final $$ExercisesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceExerciseId,
      referencedTable: $db.exercises,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ExercisesTableAnnotationComposer(
            $db: $db,
            $table: $db.exercises,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableAnnotationComposer get exerciseImageMediaIdSnapshot {
    final $$MediaAssetsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseImageMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableAnnotationComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$MediaAssetsTableAnnotationComposer get exerciseVideoMediaIdSnapshot {
    final $$MediaAssetsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.exerciseVideoMediaIdSnapshot,
      referencedTable: $db.mediaAssets,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$MediaAssetsTableAnnotationComposer(
            $db: $db,
            $table: $db.mediaAssets,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$ProgramExercisesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ProgramExercisesTable,
          ProgramExercise,
          $$ProgramExercisesTableFilterComposer,
          $$ProgramExercisesTableOrderingComposer,
          $$ProgramExercisesTableAnnotationComposer,
          $$ProgramExercisesTableCreateCompanionBuilder,
          $$ProgramExercisesTableUpdateCompanionBuilder,
          (ProgramExercise, $$ProgramExercisesTableReferences),
          ProgramExercise,
          PrefetchHooks Function({
            bool programId,
            bool sourceExerciseId,
            bool exerciseImageMediaIdSnapshot,
            bool exerciseVideoMediaIdSnapshot,
          })
        > {
  $$ProgramExercisesTableTableManager(
    _$AppDatabase db,
    $ProgramExercisesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ProgramExercisesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ProgramExercisesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ProgramExercisesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> programId = const Value.absent(),
                Value<String?> sourceExerciseId = const Value.absent(),
                Value<int> position = const Value.absent(),
                Value<String> exerciseNameSnapshot = const Value.absent(),
                Value<String?> exerciseDescriptionSnapshot =
                    const Value.absent(),
                Value<String?> exerciseImageMediaIdSnapshot =
                    const Value.absent(),
                Value<String?> exerciseImageMediaIdsSnapshotJson =
                    const Value.absent(),
                Value<String?> exerciseStepsSnapshotJson = const Value.absent(),
                Value<bool> autoStartNextTimedStepSnapshot =
                    const Value.absent(),
                Value<bool?> autoStartNextTimedStepOverride =
                    const Value.absent(),
                Value<String?> exerciseVideoMediaIdSnapshot =
                    const Value.absent(),
                Value<bool> exerciseArchivedSnapshot = const Value.absent(),
                Value<bool> availableTimeSnapshot = const Value.absent(),
                Value<bool> availableRepsSnapshot = const Value.absent(),
                Value<bool> availableScoreSnapshot = const Value.absent(),
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<int> setsCount = const Value.absent(),
                Value<bool> timeEnabled = const Value.absent(),
                Value<bool> repsEnabled = const Value.absent(),
                Value<bool> scoreEnabled = const Value.absent(),
                Value<int?> targetTimeSeconds = const Value.absent(),
                Value<int?> targetReps = const Value.absent(),
                Value<double?> targetScore = const Value.absent(),
                Value<int?> targetScoreTimeMs = const Value.absent(),
                Value<int?> restSecondsOverride = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ProgramExercisesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                programId: programId,
                sourceExerciseId: sourceExerciseId,
                position: position,
                exerciseNameSnapshot: exerciseNameSnapshot,
                exerciseDescriptionSnapshot: exerciseDescriptionSnapshot,
                exerciseImageMediaIdSnapshot: exerciseImageMediaIdSnapshot,
                exerciseImageMediaIdsSnapshotJson:
                    exerciseImageMediaIdsSnapshotJson,
                exerciseStepsSnapshotJson: exerciseStepsSnapshotJson,
                autoStartNextTimedStepSnapshot: autoStartNextTimedStepSnapshot,
                autoStartNextTimedStepOverride: autoStartNextTimedStepOverride,
                exerciseVideoMediaIdSnapshot: exerciseVideoMediaIdSnapshot,
                exerciseArchivedSnapshot: exerciseArchivedSnapshot,
                availableTimeSnapshot: availableTimeSnapshot,
                availableRepsSnapshot: availableRepsSnapshot,
                availableScoreSnapshot: availableScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                setsCount: setsCount,
                timeEnabled: timeEnabled,
                repsEnabled: repsEnabled,
                scoreEnabled: scoreEnabled,
                targetTimeSeconds: targetTimeSeconds,
                targetReps: targetReps,
                targetScore: targetScore,
                targetScoreTimeMs: targetScoreTimeMs,
                restSecondsOverride: restSecondsOverride,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String programId,
                Value<String?> sourceExerciseId = const Value.absent(),
                required int position,
                required String exerciseNameSnapshot,
                Value<String?> exerciseDescriptionSnapshot =
                    const Value.absent(),
                Value<String?> exerciseImageMediaIdSnapshot =
                    const Value.absent(),
                Value<String?> exerciseImageMediaIdsSnapshotJson =
                    const Value.absent(),
                Value<String?> exerciseStepsSnapshotJson = const Value.absent(),
                Value<bool> autoStartNextTimedStepSnapshot =
                    const Value.absent(),
                Value<bool?> autoStartNextTimedStepOverride =
                    const Value.absent(),
                Value<String?> exerciseVideoMediaIdSnapshot =
                    const Value.absent(),
                Value<bool> exerciseArchivedSnapshot = const Value.absent(),
                required bool availableTimeSnapshot,
                required bool availableRepsSnapshot,
                required bool availableScoreSnapshot,
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                required int setsCount,
                required bool timeEnabled,
                required bool repsEnabled,
                required bool scoreEnabled,
                Value<int?> targetTimeSeconds = const Value.absent(),
                Value<int?> targetReps = const Value.absent(),
                Value<double?> targetScore = const Value.absent(),
                Value<int?> targetScoreTimeMs = const Value.absent(),
                Value<int?> restSecondsOverride = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ProgramExercisesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                programId: programId,
                sourceExerciseId: sourceExerciseId,
                position: position,
                exerciseNameSnapshot: exerciseNameSnapshot,
                exerciseDescriptionSnapshot: exerciseDescriptionSnapshot,
                exerciseImageMediaIdSnapshot: exerciseImageMediaIdSnapshot,
                exerciseImageMediaIdsSnapshotJson:
                    exerciseImageMediaIdsSnapshotJson,
                exerciseStepsSnapshotJson: exerciseStepsSnapshotJson,
                autoStartNextTimedStepSnapshot: autoStartNextTimedStepSnapshot,
                autoStartNextTimedStepOverride: autoStartNextTimedStepOverride,
                exerciseVideoMediaIdSnapshot: exerciseVideoMediaIdSnapshot,
                exerciseArchivedSnapshot: exerciseArchivedSnapshot,
                availableTimeSnapshot: availableTimeSnapshot,
                availableRepsSnapshot: availableRepsSnapshot,
                availableScoreSnapshot: availableScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                setsCount: setsCount,
                timeEnabled: timeEnabled,
                repsEnabled: repsEnabled,
                scoreEnabled: scoreEnabled,
                targetTimeSeconds: targetTimeSeconds,
                targetReps: targetReps,
                targetScore: targetScore,
                targetScoreTimeMs: targetScoreTimeMs,
                restSecondsOverride: restSecondsOverride,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$ProgramExercisesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                programId = false,
                sourceExerciseId = false,
                exerciseImageMediaIdSnapshot = false,
                exerciseVideoMediaIdSnapshot = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [],
                  addJoins:
                      <
                        T extends TableManagerState<
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic
                        >
                      >(state) {
                        if (programId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.programId,
                                    referencedTable:
                                        $$ProgramExercisesTableReferences
                                            ._programIdTable(db),
                                    referencedColumn:
                                        $$ProgramExercisesTableReferences
                                            ._programIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }
                        if (sourceExerciseId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.sourceExerciseId,
                                    referencedTable:
                                        $$ProgramExercisesTableReferences
                                            ._sourceExerciseIdTable(db),
                                    referencedColumn:
                                        $$ProgramExercisesTableReferences
                                            ._sourceExerciseIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }
                        if (exerciseImageMediaIdSnapshot) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn:
                                        table.exerciseImageMediaIdSnapshot,
                                    referencedTable:
                                        $$ProgramExercisesTableReferences
                                            ._exerciseImageMediaIdSnapshotTable(
                                              db,
                                            ),
                                    referencedColumn:
                                        $$ProgramExercisesTableReferences
                                            ._exerciseImageMediaIdSnapshotTable(
                                              db,
                                            )
                                            .id,
                                  )
                                  as T;
                        }
                        if (exerciseVideoMediaIdSnapshot) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn:
                                        table.exerciseVideoMediaIdSnapshot,
                                    referencedTable:
                                        $$ProgramExercisesTableReferences
                                            ._exerciseVideoMediaIdSnapshotTable(
                                              db,
                                            ),
                                    referencedColumn:
                                        $$ProgramExercisesTableReferences
                                            ._exerciseVideoMediaIdSnapshotTable(
                                              db,
                                            )
                                            .id,
                                  )
                                  as T;
                        }

                        return state;
                      },
                  getPrefetchedDataCallback: (items) async {
                    return [];
                  },
                );
              },
        ),
      );
}

typedef $$ProgramExercisesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ProgramExercisesTable,
      ProgramExercise,
      $$ProgramExercisesTableFilterComposer,
      $$ProgramExercisesTableOrderingComposer,
      $$ProgramExercisesTableAnnotationComposer,
      $$ProgramExercisesTableCreateCompanionBuilder,
      $$ProgramExercisesTableUpdateCompanionBuilder,
      (ProgramExercise, $$ProgramExercisesTableReferences),
      ProgramExercise,
      PrefetchHooks Function({
        bool programId,
        bool sourceExerciseId,
        bool exerciseImageMediaIdSnapshot,
        bool exerciseVideoMediaIdSnapshot,
      })
    >;
typedef $$RemoteResourceMappingsTableCreateCompanionBuilder =
    RemoteResourceMappingsCompanion Function({
      required String id,
      required String resourceType,
      required String clientId,
      required String serverId,
      required DateTime serverUpdatedAt,
      Value<int> rowid,
    });
typedef $$RemoteResourceMappingsTableUpdateCompanionBuilder =
    RemoteResourceMappingsCompanion Function({
      Value<String> id,
      Value<String> resourceType,
      Value<String> clientId,
      Value<String> serverId,
      Value<DateTime> serverUpdatedAt,
      Value<int> rowid,
    });

class $$RemoteResourceMappingsTableFilterComposer
    extends Composer<_$AppDatabase, $RemoteResourceMappingsTable> {
  $$RemoteResourceMappingsTableFilterComposer({
    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<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get clientId => $composableBuilder(
    column: $table.clientId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get serverId => $composableBuilder(
    column: $table.serverId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get serverUpdatedAt => $composableBuilder(
    column: $table.serverUpdatedAt,
    builder: (column) => ColumnFilters(column),
  );
}

class $$RemoteResourceMappingsTableOrderingComposer
    extends Composer<_$AppDatabase, $RemoteResourceMappingsTable> {
  $$RemoteResourceMappingsTableOrderingComposer({
    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<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get clientId => $composableBuilder(
    column: $table.clientId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get serverId => $composableBuilder(
    column: $table.serverId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get serverUpdatedAt => $composableBuilder(
    column: $table.serverUpdatedAt,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$RemoteResourceMappingsTableAnnotationComposer
    extends Composer<_$AppDatabase, $RemoteResourceMappingsTable> {
  $$RemoteResourceMappingsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => column,
  );

  GeneratedColumn<String> get clientId =>
      $composableBuilder(column: $table.clientId, builder: (column) => column);

  GeneratedColumn<String> get serverId =>
      $composableBuilder(column: $table.serverId, builder: (column) => column);

  GeneratedColumn<DateTime> get serverUpdatedAt => $composableBuilder(
    column: $table.serverUpdatedAt,
    builder: (column) => column,
  );
}

class $$RemoteResourceMappingsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $RemoteResourceMappingsTable,
          RemoteResourceMapping,
          $$RemoteResourceMappingsTableFilterComposer,
          $$RemoteResourceMappingsTableOrderingComposer,
          $$RemoteResourceMappingsTableAnnotationComposer,
          $$RemoteResourceMappingsTableCreateCompanionBuilder,
          $$RemoteResourceMappingsTableUpdateCompanionBuilder,
          (
            RemoteResourceMapping,
            BaseReferences<
              _$AppDatabase,
              $RemoteResourceMappingsTable,
              RemoteResourceMapping
            >,
          ),
          RemoteResourceMapping,
          PrefetchHooks Function()
        > {
  $$RemoteResourceMappingsTableTableManager(
    _$AppDatabase db,
    $RemoteResourceMappingsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$RemoteResourceMappingsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$RemoteResourceMappingsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$RemoteResourceMappingsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String> resourceType = const Value.absent(),
                Value<String> clientId = const Value.absent(),
                Value<String> serverId = const Value.absent(),
                Value<DateTime> serverUpdatedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => RemoteResourceMappingsCompanion(
                id: id,
                resourceType: resourceType,
                clientId: clientId,
                serverId: serverId,
                serverUpdatedAt: serverUpdatedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required String resourceType,
                required String clientId,
                required String serverId,
                required DateTime serverUpdatedAt,
                Value<int> rowid = const Value.absent(),
              }) => RemoteResourceMappingsCompanion.insert(
                id: id,
                resourceType: resourceType,
                clientId: clientId,
                serverId: serverId,
                serverUpdatedAt: serverUpdatedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$RemoteResourceMappingsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $RemoteResourceMappingsTable,
      RemoteResourceMapping,
      $$RemoteResourceMappingsTableFilterComposer,
      $$RemoteResourceMappingsTableOrderingComposer,
      $$RemoteResourceMappingsTableAnnotationComposer,
      $$RemoteResourceMappingsTableCreateCompanionBuilder,
      $$RemoteResourceMappingsTableUpdateCompanionBuilder,
      (
        RemoteResourceMapping,
        BaseReferences<
          _$AppDatabase,
          $RemoteResourceMappingsTable,
          RemoteResourceMapping
        >,
      ),
      RemoteResourceMapping,
      PrefetchHooks Function()
    >;
typedef $$ShareInboxItemsTableCreateCompanionBuilder =
    ShareInboxItemsCompanion Function({
      required String shareId,
      required String senderUserId,
      required String resourceType,
      required String payloadJson,
      required String status,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> respondedAt,
      Value<int> rowid,
    });
typedef $$ShareInboxItemsTableUpdateCompanionBuilder =
    ShareInboxItemsCompanion Function({
      Value<String> shareId,
      Value<String> senderUserId,
      Value<String> resourceType,
      Value<String> payloadJson,
      Value<String> status,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> respondedAt,
      Value<int> rowid,
    });

class $$ShareInboxItemsTableFilterComposer
    extends Composer<_$AppDatabase, $ShareInboxItemsTable> {
  $$ShareInboxItemsTableFilterComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnFilters<String> get shareId => $composableBuilder(
    column: $table.shareId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get senderUserId => $composableBuilder(
    column: $table.senderUserId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get respondedAt => $composableBuilder(
    column: $table.respondedAt,
    builder: (column) => ColumnFilters(column),
  );
}

class $$ShareInboxItemsTableOrderingComposer
    extends Composer<_$AppDatabase, $ShareInboxItemsTable> {
  $$ShareInboxItemsTableOrderingComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  ColumnOrderings<String> get shareId => $composableBuilder(
    column: $table.shareId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get senderUserId => $composableBuilder(
    column: $table.senderUserId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get respondedAt => $composableBuilder(
    column: $table.respondedAt,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$ShareInboxItemsTableAnnotationComposer
    extends Composer<_$AppDatabase, $ShareInboxItemsTable> {
  $$ShareInboxItemsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get shareId =>
      $composableBuilder(column: $table.shareId, builder: (column) => column);

  GeneratedColumn<String> get senderUserId => $composableBuilder(
    column: $table.senderUserId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get resourceType => $composableBuilder(
    column: $table.resourceType,
    builder: (column) => column,
  );

  GeneratedColumn<String> get payloadJson => $composableBuilder(
    column: $table.payloadJson,
    builder: (column) => column,
  );

  GeneratedColumn<String> get status =>
      $composableBuilder(column: $table.status, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get respondedAt => $composableBuilder(
    column: $table.respondedAt,
    builder: (column) => column,
  );
}

class $$ShareInboxItemsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $ShareInboxItemsTable,
          ShareInboxItem,
          $$ShareInboxItemsTableFilterComposer,
          $$ShareInboxItemsTableOrderingComposer,
          $$ShareInboxItemsTableAnnotationComposer,
          $$ShareInboxItemsTableCreateCompanionBuilder,
          $$ShareInboxItemsTableUpdateCompanionBuilder,
          (
            ShareInboxItem,
            BaseReferences<
              _$AppDatabase,
              $ShareInboxItemsTable,
              ShareInboxItem
            >,
          ),
          ShareInboxItem,
          PrefetchHooks Function()
        > {
  $$ShareInboxItemsTableTableManager(
    _$AppDatabase db,
    $ShareInboxItemsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$ShareInboxItemsTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$ShareInboxItemsTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$ShareInboxItemsTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> shareId = const Value.absent(),
                Value<String> senderUserId = const Value.absent(),
                Value<String> resourceType = const Value.absent(),
                Value<String> payloadJson = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> respondedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ShareInboxItemsCompanion(
                shareId: shareId,
                senderUserId: senderUserId,
                resourceType: resourceType,
                payloadJson: payloadJson,
                status: status,
                createdAt: createdAt,
                updatedAt: updatedAt,
                respondedAt: respondedAt,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String shareId,
                required String senderUserId,
                required String resourceType,
                required String payloadJson,
                required String status,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> respondedAt = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => ShareInboxItemsCompanion.insert(
                shareId: shareId,
                senderUserId: senderUserId,
                resourceType: resourceType,
                payloadJson: payloadJson,
                status: status,
                createdAt: createdAt,
                updatedAt: updatedAt,
                respondedAt: respondedAt,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$ShareInboxItemsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $ShareInboxItemsTable,
      ShareInboxItem,
      $$ShareInboxItemsTableFilterComposer,
      $$ShareInboxItemsTableOrderingComposer,
      $$ShareInboxItemsTableAnnotationComposer,
      $$ShareInboxItemsTableCreateCompanionBuilder,
      $$ShareInboxItemsTableUpdateCompanionBuilder,
      (
        ShareInboxItem,
        BaseReferences<_$AppDatabase, $ShareInboxItemsTable, ShareInboxItem>,
      ),
      ShareInboxItem,
      PrefetchHooks Function()
    >;
typedef $$SyncMetadataEntriesTableCreateCompanionBuilder =
    SyncMetadataEntriesCompanion Function({
      Value<String> id,
      Value<String?> serverCursor,
      Value<DateTime?> lastSuccessfulSyncAt,
      Value<DateTime?> lastAttemptAt,
      Value<DateTime?> lastFailureAt,
      Value<String> status,
      Value<int?> pendingPushCount,
      Value<int> rowid,
    });
typedef $$SyncMetadataEntriesTableUpdateCompanionBuilder =
    SyncMetadataEntriesCompanion Function({
      Value<String> id,
      Value<String?> serverCursor,
      Value<DateTime?> lastSuccessfulSyncAt,
      Value<DateTime?> lastAttemptAt,
      Value<DateTime?> lastFailureAt,
      Value<String> status,
      Value<int?> pendingPushCount,
      Value<int> rowid,
    });

class $$SyncMetadataEntriesTableFilterComposer
    extends Composer<_$AppDatabase, $SyncMetadataEntriesTable> {
  $$SyncMetadataEntriesTableFilterComposer({
    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<String> get serverCursor => $composableBuilder(
    column: $table.serverCursor,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSuccessfulSyncAt => $composableBuilder(
    column: $table.lastSuccessfulSyncAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastFailureAt => $composableBuilder(
    column: $table.lastFailureAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get pendingPushCount => $composableBuilder(
    column: $table.pendingPushCount,
    builder: (column) => ColumnFilters(column),
  );
}

class $$SyncMetadataEntriesTableOrderingComposer
    extends Composer<_$AppDatabase, $SyncMetadataEntriesTable> {
  $$SyncMetadataEntriesTableOrderingComposer({
    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<String> get serverCursor => $composableBuilder(
    column: $table.serverCursor,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSuccessfulSyncAt => $composableBuilder(
    column: $table.lastSuccessfulSyncAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastFailureAt => $composableBuilder(
    column: $table.lastFailureAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get pendingPushCount => $composableBuilder(
    column: $table.pendingPushCount,
    builder: (column) => ColumnOrderings(column),
  );
}

class $$SyncMetadataEntriesTableAnnotationComposer
    extends Composer<_$AppDatabase, $SyncMetadataEntriesTable> {
  $$SyncMetadataEntriesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<String> get serverCursor => $composableBuilder(
    column: $table.serverCursor,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSuccessfulSyncAt => $composableBuilder(
    column: $table.lastSuccessfulSyncAt,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastAttemptAt => $composableBuilder(
    column: $table.lastAttemptAt,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastFailureAt => $composableBuilder(
    column: $table.lastFailureAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get status =>
      $composableBuilder(column: $table.status, builder: (column) => column);

  GeneratedColumn<int> get pendingPushCount => $composableBuilder(
    column: $table.pendingPushCount,
    builder: (column) => column,
  );
}

class $$SyncMetadataEntriesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $SyncMetadataEntriesTable,
          SyncMetadataEntry,
          $$SyncMetadataEntriesTableFilterComposer,
          $$SyncMetadataEntriesTableOrderingComposer,
          $$SyncMetadataEntriesTableAnnotationComposer,
          $$SyncMetadataEntriesTableCreateCompanionBuilder,
          $$SyncMetadataEntriesTableUpdateCompanionBuilder,
          (
            SyncMetadataEntry,
            BaseReferences<
              _$AppDatabase,
              $SyncMetadataEntriesTable,
              SyncMetadataEntry
            >,
          ),
          SyncMetadataEntry,
          PrefetchHooks Function()
        > {
  $$SyncMetadataEntriesTableTableManager(
    _$AppDatabase db,
    $SyncMetadataEntriesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$SyncMetadataEntriesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$SyncMetadataEntriesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$SyncMetadataEntriesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String?> serverCursor = const Value.absent(),
                Value<DateTime?> lastSuccessfulSyncAt = const Value.absent(),
                Value<DateTime?> lastAttemptAt = const Value.absent(),
                Value<DateTime?> lastFailureAt = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int?> pendingPushCount = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SyncMetadataEntriesCompanion(
                id: id,
                serverCursor: serverCursor,
                lastSuccessfulSyncAt: lastSuccessfulSyncAt,
                lastAttemptAt: lastAttemptAt,
                lastFailureAt: lastFailureAt,
                status: status,
                pendingPushCount: pendingPushCount,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<String?> serverCursor = const Value.absent(),
                Value<DateTime?> lastSuccessfulSyncAt = const Value.absent(),
                Value<DateTime?> lastAttemptAt = const Value.absent(),
                Value<DateTime?> lastFailureAt = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int?> pendingPushCount = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => SyncMetadataEntriesCompanion.insert(
                id: id,
                serverCursor: serverCursor,
                lastSuccessfulSyncAt: lastSuccessfulSyncAt,
                lastAttemptAt: lastAttemptAt,
                lastFailureAt: lastFailureAt,
                status: status,
                pendingPushCount: pendingPushCount,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map((e) => (e.readTable(table), BaseReferences(db, table, e)))
              .toList(),
          prefetchHooksCallback: null,
        ),
      );
}

typedef $$SyncMetadataEntriesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $SyncMetadataEntriesTable,
      SyncMetadataEntry,
      $$SyncMetadataEntriesTableFilterComposer,
      $$SyncMetadataEntriesTableOrderingComposer,
      $$SyncMetadataEntriesTableAnnotationComposer,
      $$SyncMetadataEntriesTableCreateCompanionBuilder,
      $$SyncMetadataEntriesTableUpdateCompanionBuilder,
      (
        SyncMetadataEntry,
        BaseReferences<
          _$AppDatabase,
          $SyncMetadataEntriesTable,
          SyncMetadataEntry
        >,
      ),
      SyncMetadataEntry,
      PrefetchHooks Function()
    >;
typedef $$WorkoutHistoriesTableCreateCompanionBuilder =
    WorkoutHistoriesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String?> sourceWorkoutTemplateId,
      Value<String?> sourceActiveWorkoutSessionId,
      required String nameSnapshot,
      required DateTime startedAt,
      required DateTime endedAt,
      required int totalActiveMs,
      required bool completed,
      required String historySnapshotJson,
      Value<int> rowid,
    });
typedef $$WorkoutHistoriesTableUpdateCompanionBuilder =
    WorkoutHistoriesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String?> sourceWorkoutTemplateId,
      Value<String?> sourceActiveWorkoutSessionId,
      Value<String> nameSnapshot,
      Value<DateTime> startedAt,
      Value<DateTime> endedAt,
      Value<int> totalActiveMs,
      Value<bool> completed,
      Value<String> historySnapshotJson,
      Value<int> rowid,
    });

final class $$WorkoutHistoriesTableReferences
    extends
        BaseReferences<_$AppDatabase, $WorkoutHistoriesTable, WorkoutHistory> {
  $$WorkoutHistoriesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutTemplatesTable _sourceWorkoutTemplateIdTable(
    _$AppDatabase db,
  ) => db.workoutTemplates.createAlias(
    'workout_history__source_workout_template_id__workout_templates__id',
  );

  $$WorkoutTemplatesTableProcessedTableManager? get sourceWorkoutTemplateId {
    final $_column = $_itemColumn<String>('source_workout_template_id');
    if ($_column == null) return null;
    final manager = $$WorkoutTemplatesTableTableManager(
      $_db,
      $_db.workoutTemplates,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _sourceWorkoutTemplateIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $ActiveWorkoutSessionsTable _sourceActiveWorkoutSessionIdTable(
    _$AppDatabase db,
  ) => db.activeWorkoutSessions.createAlias(
    'workout_history__source_active_workout_session_id__active_workout_sessions__id',
  );

  $$ActiveWorkoutSessionsTableProcessedTableManager?
  get sourceActiveWorkoutSessionId {
    final $_column = $_itemColumn<String>('source_active_workout_session_id');
    if ($_column == null) return null;
    final manager = $$ActiveWorkoutSessionsTableTableManager(
      $_db,
      $_db.activeWorkoutSessions,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _sourceActiveWorkoutSessionIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static MultiTypedResultKey<
    $WorkoutHistorySetResultsTable,
    List<WorkoutHistorySetResult>
  >
  _workoutHistorySetResultsRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.workoutHistorySetResults,
    aliasName:
        'workout_history__id__workout_history_set_results__workout_history_id',
  );

  $$WorkoutHistorySetResultsTableProcessedTableManager
  get workoutHistorySetResultsRefs {
    final manager =
        $$WorkoutHistorySetResultsTableTableManager(
          $_db,
          $_db.workoutHistorySetResults,
        ).filter(
          (f) => f.workoutHistoryId.id.sqlEquals($_itemColumn<String>('id')!),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutHistorySetResultsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }

  static MultiTypedResultKey<
    $WorkoutHistoryStepResultsTable,
    List<WorkoutHistoryStepResult>
  >
  _workoutHistoryStepResultsRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.workoutHistoryStepResults,
    aliasName:
        'workout_history__id__workout_history_step_results__workout_history_id',
  );

  $$WorkoutHistoryStepResultsTableProcessedTableManager
  get workoutHistoryStepResultsRefs {
    final manager =
        $$WorkoutHistoryStepResultsTableTableManager(
          $_db,
          $_db.workoutHistoryStepResults,
        ).filter(
          (f) => f.workoutHistoryId.id.sqlEquals($_itemColumn<String>('id')!),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutHistoryStepResultsRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$WorkoutHistoriesTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutHistoriesTable> {
  $$WorkoutHistoriesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get nameSnapshot => $composableBuilder(
    column: $table.nameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get endedAt => $composableBuilder(
    column: $table.endedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get totalActiveMs => $composableBuilder(
    column: $table.totalActiveMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get completed => $composableBuilder(
    column: $table.completed,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get historySnapshotJson => $composableBuilder(
    column: $table.historySnapshotJson,
    builder: (column) => ColumnFilters(column),
  );

  $$WorkoutTemplatesTableFilterComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableFilterComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ActiveWorkoutSessionsTableFilterComposer get sourceActiveWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.sourceActiveWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableFilterComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }

  Expression<bool> workoutHistorySetResultsRefs(
    Expression<bool> Function($$WorkoutHistorySetResultsTableFilterComposer f)
    f,
  ) {
    final $$WorkoutHistorySetResultsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutHistorySetResults,
          getReferencedColumn: (t) => t.workoutHistoryId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutHistorySetResultsTableFilterComposer(
                $db: $db,
                $table: $db.workoutHistorySetResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<bool> workoutHistoryStepResultsRefs(
    Expression<bool> Function($$WorkoutHistoryStepResultsTableFilterComposer f)
    f,
  ) {
    final $$WorkoutHistoryStepResultsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutHistoryStepResults,
          getReferencedColumn: (t) => t.workoutHistoryId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutHistoryStepResultsTableFilterComposer(
                $db: $db,
                $table: $db.workoutHistoryStepResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutHistoriesTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutHistoriesTable> {
  $$WorkoutHistoriesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get nameSnapshot => $composableBuilder(
    column: $table.nameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get endedAt => $composableBuilder(
    column: $table.endedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get totalActiveMs => $composableBuilder(
    column: $table.totalActiveMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get completed => $composableBuilder(
    column: $table.completed,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get historySnapshotJson => $composableBuilder(
    column: $table.historySnapshotJson,
    builder: (column) => ColumnOrderings(column),
  );

  $$WorkoutTemplatesTableOrderingComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableOrderingComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ActiveWorkoutSessionsTableOrderingComposer
  get sourceActiveWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.sourceActiveWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableOrderingComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$WorkoutHistoriesTableAnnotationComposer
    extends Composer<_$AppDatabase, $WorkoutHistoriesTable> {
  $$WorkoutHistoriesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get nameSnapshot => $composableBuilder(
    column: $table.nameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get startedAt =>
      $composableBuilder(column: $table.startedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get endedAt =>
      $composableBuilder(column: $table.endedAt, builder: (column) => column);

  GeneratedColumn<int> get totalActiveMs => $composableBuilder(
    column: $table.totalActiveMs,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get completed =>
      $composableBuilder(column: $table.completed, builder: (column) => column);

  GeneratedColumn<String> get historySnapshotJson => $composableBuilder(
    column: $table.historySnapshotJson,
    builder: (column) => column,
  );

  $$WorkoutTemplatesTableAnnotationComposer get sourceWorkoutTemplateId {
    final $$WorkoutTemplatesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceWorkoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ActiveWorkoutSessionsTableAnnotationComposer
  get sourceActiveWorkoutSessionId {
    final $$ActiveWorkoutSessionsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.sourceActiveWorkoutSessionId,
          referencedTable: $db.activeWorkoutSessions,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$ActiveWorkoutSessionsTableAnnotationComposer(
                $db: $db,
                $table: $db.activeWorkoutSessions,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }

  Expression<T> workoutHistorySetResultsRefs<T extends Object>(
    Expression<T> Function($$WorkoutHistorySetResultsTableAnnotationComposer a)
    f,
  ) {
    final $$WorkoutHistorySetResultsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutHistorySetResults,
          getReferencedColumn: (t) => t.workoutHistoryId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutHistorySetResultsTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutHistorySetResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }

  Expression<T> workoutHistoryStepResultsRefs<T extends Object>(
    Expression<T> Function($$WorkoutHistoryStepResultsTableAnnotationComposer a)
    f,
  ) {
    final $$WorkoutHistoryStepResultsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutHistoryStepResults,
          getReferencedColumn: (t) => t.workoutHistoryId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutHistoryStepResultsTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutHistoryStepResults,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutHistoriesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutHistoriesTable,
          WorkoutHistory,
          $$WorkoutHistoriesTableFilterComposer,
          $$WorkoutHistoriesTableOrderingComposer,
          $$WorkoutHistoriesTableAnnotationComposer,
          $$WorkoutHistoriesTableCreateCompanionBuilder,
          $$WorkoutHistoriesTableUpdateCompanionBuilder,
          (WorkoutHistory, $$WorkoutHistoriesTableReferences),
          WorkoutHistory,
          PrefetchHooks Function({
            bool sourceWorkoutTemplateId,
            bool sourceActiveWorkoutSessionId,
            bool workoutHistorySetResultsRefs,
            bool workoutHistoryStepResultsRefs,
          })
        > {
  $$WorkoutHistoriesTableTableManager(
    _$AppDatabase db,
    $WorkoutHistoriesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutHistoriesTableFilterComposer($db: db, $table: table),
          createOrderingComposer: () =>
              $$WorkoutHistoriesTableOrderingComposer($db: db, $table: table),
          createComputedFieldComposer: () =>
              $$WorkoutHistoriesTableAnnotationComposer($db: db, $table: table),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String?> sourceWorkoutTemplateId = const Value.absent(),
                Value<String?> sourceActiveWorkoutSessionId =
                    const Value.absent(),
                Value<String> nameSnapshot = const Value.absent(),
                Value<DateTime> startedAt = const Value.absent(),
                Value<DateTime> endedAt = const Value.absent(),
                Value<int> totalActiveMs = const Value.absent(),
                Value<bool> completed = const Value.absent(),
                Value<String> historySnapshotJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistoriesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                sourceWorkoutTemplateId: sourceWorkoutTemplateId,
                sourceActiveWorkoutSessionId: sourceActiveWorkoutSessionId,
                nameSnapshot: nameSnapshot,
                startedAt: startedAt,
                endedAt: endedAt,
                totalActiveMs: totalActiveMs,
                completed: completed,
                historySnapshotJson: historySnapshotJson,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String?> sourceWorkoutTemplateId = const Value.absent(),
                Value<String?> sourceActiveWorkoutSessionId =
                    const Value.absent(),
                required String nameSnapshot,
                required DateTime startedAt,
                required DateTime endedAt,
                required int totalActiveMs,
                required bool completed,
                required String historySnapshotJson,
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistoriesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                sourceWorkoutTemplateId: sourceWorkoutTemplateId,
                sourceActiveWorkoutSessionId: sourceActiveWorkoutSessionId,
                nameSnapshot: nameSnapshot,
                startedAt: startedAt,
                endedAt: endedAt,
                totalActiveMs: totalActiveMs,
                completed: completed,
                historySnapshotJson: historySnapshotJson,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutHistoriesTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                sourceWorkoutTemplateId = false,
                sourceActiveWorkoutSessionId = false,
                workoutHistorySetResultsRefs = false,
                workoutHistoryStepResultsRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (workoutHistorySetResultsRefs)
                      db.workoutHistorySetResults,
                    if (workoutHistoryStepResultsRefs)
                      db.workoutHistoryStepResults,
                  ],
                  addJoins:
                      <
                        T extends TableManagerState<
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic
                        >
                      >(state) {
                        if (sourceWorkoutTemplateId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn:
                                        table.sourceWorkoutTemplateId,
                                    referencedTable:
                                        $$WorkoutHistoriesTableReferences
                                            ._sourceWorkoutTemplateIdTable(db),
                                    referencedColumn:
                                        $$WorkoutHistoriesTableReferences
                                            ._sourceWorkoutTemplateIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }
                        if (sourceActiveWorkoutSessionId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn:
                                        table.sourceActiveWorkoutSessionId,
                                    referencedTable:
                                        $$WorkoutHistoriesTableReferences
                                            ._sourceActiveWorkoutSessionIdTable(
                                              db,
                                            ),
                                    referencedColumn:
                                        $$WorkoutHistoriesTableReferences
                                            ._sourceActiveWorkoutSessionIdTable(
                                              db,
                                            )
                                            .id,
                                  )
                                  as T;
                        }

                        return state;
                      },
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (workoutHistorySetResultsRefs)
                        await $_getPrefetchedData<
                          WorkoutHistory,
                          $WorkoutHistoriesTable,
                          WorkoutHistorySetResult
                        >(
                          currentTable: table,
                          referencedTable: $$WorkoutHistoriesTableReferences
                              ._workoutHistorySetResultsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutHistoriesTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutHistorySetResultsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.workoutHistoryId == item.id,
                              ),
                          typedResults: items,
                        ),
                      if (workoutHistoryStepResultsRefs)
                        await $_getPrefetchedData<
                          WorkoutHistory,
                          $WorkoutHistoriesTable,
                          WorkoutHistoryStepResult
                        >(
                          currentTable: table,
                          referencedTable: $$WorkoutHistoriesTableReferences
                              ._workoutHistoryStepResultsRefsTable(db),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutHistoriesTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutHistoryStepResultsRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.workoutHistoryId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$WorkoutHistoriesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutHistoriesTable,
      WorkoutHistory,
      $$WorkoutHistoriesTableFilterComposer,
      $$WorkoutHistoriesTableOrderingComposer,
      $$WorkoutHistoriesTableAnnotationComposer,
      $$WorkoutHistoriesTableCreateCompanionBuilder,
      $$WorkoutHistoriesTableUpdateCompanionBuilder,
      (WorkoutHistory, $$WorkoutHistoriesTableReferences),
      WorkoutHistory,
      PrefetchHooks Function({
        bool sourceWorkoutTemplateId,
        bool sourceActiveWorkoutSessionId,
        bool workoutHistorySetResultsRefs,
        bool workoutHistoryStepResultsRefs,
      })
    >;
typedef $$WorkoutHistorySetResultsTableCreateCompanionBuilder =
    WorkoutHistorySetResultsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String workoutHistoryId,
      required String programSnapshotId,
      required String exerciseSnapshotId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required String programNameSnapshot,
      required String exerciseNameSnapshot,
      required bool timeEnabledSnapshot,
      required bool repsEnabledSnapshot,
      required bool scoreEnabledSnapshot,
      Value<String> scoreInputModeSnapshot,
      Value<int?> targetTimeSecondsSnapshot,
      Value<int?> targetRepsSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<String?> sourceExerciseIdSnapshot,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<String> status,
      Value<int> rowid,
    });
typedef $$WorkoutHistorySetResultsTableUpdateCompanionBuilder =
    WorkoutHistorySetResultsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> workoutHistoryId,
      Value<String> programSnapshotId,
      Value<String> exerciseSnapshotId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<String> programNameSnapshot,
      Value<String> exerciseNameSnapshot,
      Value<bool> timeEnabledSnapshot,
      Value<bool> repsEnabledSnapshot,
      Value<bool> scoreEnabledSnapshot,
      Value<String> scoreInputModeSnapshot,
      Value<int?> targetTimeSecondsSnapshot,
      Value<int?> targetRepsSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<String?> sourceExerciseIdSnapshot,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<String> status,
      Value<int> rowid,
    });

final class $$WorkoutHistorySetResultsTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $WorkoutHistorySetResultsTable,
          WorkoutHistorySetResult
        > {
  $$WorkoutHistorySetResultsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutHistoriesTable _workoutHistoryIdTable(_$AppDatabase db) =>
      db.workoutHistories.createAlias(
        'workout_history_set_results__workout_history_id__workout_history__id',
      );

  $$WorkoutHistoriesTableProcessedTableManager get workoutHistoryId {
    final $_column = $_itemColumn<String>('workout_history_id')!;

    final manager = $$WorkoutHistoriesTableTableManager(
      $_db,
      $_db.workoutHistories,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_workoutHistoryIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$WorkoutHistorySetResultsTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutHistorySetResultsTable> {
  $$WorkoutHistorySetResultsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get setIndex => $composableBuilder(
    column: $table.setIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get timeEnabledSnapshot => $composableBuilder(
    column: $table.timeEnabledSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get repsEnabledSnapshot => $composableBuilder(
    column: $table.repsEnabledSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get scoreEnabledSnapshot => $composableBuilder(
    column: $table.scoreEnabledSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetTimeSecondsSnapshot => $composableBuilder(
    column: $table.targetTimeSecondsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetRepsSnapshot => $composableBuilder(
    column: $table.targetRepsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnFilters(column),
  );

  $$WorkoutHistoriesTableFilterComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableFilterComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistorySetResultsTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutHistorySetResultsTable> {
  $$WorkoutHistorySetResultsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get setIndex => $composableBuilder(
    column: $table.setIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get timeEnabledSnapshot => $composableBuilder(
    column: $table.timeEnabledSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get repsEnabledSnapshot => $composableBuilder(
    column: $table.repsEnabledSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get scoreEnabledSnapshot => $composableBuilder(
    column: $table.scoreEnabledSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetTimeSecondsSnapshot => $composableBuilder(
    column: $table.targetTimeSecondsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetRepsSnapshot => $composableBuilder(
    column: $table.targetRepsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnOrderings(column),
  );

  $$WorkoutHistoriesTableOrderingComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableOrderingComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistorySetResultsTableAnnotationComposer
    extends Composer<_$AppDatabase, $WorkoutHistorySetResultsTable> {
  $$WorkoutHistorySetResultsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => column,
  );

  GeneratedColumn<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => column,
  );

  GeneratedColumn<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => column,
  );

  GeneratedColumn<int> get setIndex =>
      $composableBuilder(column: $table.setIndex, builder: (column) => column);

  GeneratedColumn<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get exerciseNameSnapshot => $composableBuilder(
    column: $table.exerciseNameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get timeEnabledSnapshot => $composableBuilder(
    column: $table.timeEnabledSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get repsEnabledSnapshot => $composableBuilder(
    column: $table.repsEnabledSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get scoreEnabledSnapshot => $composableBuilder(
    column: $table.scoreEnabledSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetTimeSecondsSnapshot => $composableBuilder(
    column: $table.targetTimeSecondsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetRepsSnapshot => $composableBuilder(
    column: $table.targetRepsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => column,
  );

  GeneratedColumn<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get startedAt =>
      $composableBuilder(column: $table.startedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get status =>
      $composableBuilder(column: $table.status, builder: (column) => column);

  $$WorkoutHistoriesTableAnnotationComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistorySetResultsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutHistorySetResultsTable,
          WorkoutHistorySetResult,
          $$WorkoutHistorySetResultsTableFilterComposer,
          $$WorkoutHistorySetResultsTableOrderingComposer,
          $$WorkoutHistorySetResultsTableAnnotationComposer,
          $$WorkoutHistorySetResultsTableCreateCompanionBuilder,
          $$WorkoutHistorySetResultsTableUpdateCompanionBuilder,
          (WorkoutHistorySetResult, $$WorkoutHistorySetResultsTableReferences),
          WorkoutHistorySetResult,
          PrefetchHooks Function({bool workoutHistoryId})
        > {
  $$WorkoutHistorySetResultsTableTableManager(
    _$AppDatabase db,
    $WorkoutHistorySetResultsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutHistorySetResultsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$WorkoutHistorySetResultsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$WorkoutHistorySetResultsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> workoutHistoryId = const Value.absent(),
                Value<String> programSnapshotId = const Value.absent(),
                Value<String> exerciseSnapshotId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<String> programNameSnapshot = const Value.absent(),
                Value<String> exerciseNameSnapshot = const Value.absent(),
                Value<bool> timeEnabledSnapshot = const Value.absent(),
                Value<bool> repsEnabledSnapshot = const Value.absent(),
                Value<bool> scoreEnabledSnapshot = const Value.absent(),
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<int?> targetTimeSecondsSnapshot = const Value.absent(),
                Value<int?> targetRepsSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistorySetResultsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutHistoryId: workoutHistoryId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                programNameSnapshot: programNameSnapshot,
                exerciseNameSnapshot: exerciseNameSnapshot,
                timeEnabledSnapshot: timeEnabledSnapshot,
                repsEnabledSnapshot: repsEnabledSnapshot,
                scoreEnabledSnapshot: scoreEnabledSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                targetTimeSecondsSnapshot: targetTimeSecondsSnapshot,
                targetRepsSnapshot: targetRepsSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                sourceExerciseIdSnapshot: sourceExerciseIdSnapshot,
                startedAt: startedAt,
                completedAt: completedAt,
                status: status,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String workoutHistoryId,
                required String programSnapshotId,
                required String exerciseSnapshotId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required String programNameSnapshot,
                required String exerciseNameSnapshot,
                required bool timeEnabledSnapshot,
                required bool repsEnabledSnapshot,
                required bool scoreEnabledSnapshot,
                Value<String> scoreInputModeSnapshot = const Value.absent(),
                Value<int?> targetTimeSecondsSnapshot = const Value.absent(),
                Value<int?> targetRepsSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistorySetResultsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutHistoryId: workoutHistoryId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                programNameSnapshot: programNameSnapshot,
                exerciseNameSnapshot: exerciseNameSnapshot,
                timeEnabledSnapshot: timeEnabledSnapshot,
                repsEnabledSnapshot: repsEnabledSnapshot,
                scoreEnabledSnapshot: scoreEnabledSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                targetTimeSecondsSnapshot: targetTimeSecondsSnapshot,
                targetRepsSnapshot: targetRepsSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                sourceExerciseIdSnapshot: sourceExerciseIdSnapshot,
                startedAt: startedAt,
                completedAt: completedAt,
                status: status,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutHistorySetResultsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({workoutHistoryId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (workoutHistoryId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.workoutHistoryId,
                                referencedTable:
                                    $$WorkoutHistorySetResultsTableReferences
                                        ._workoutHistoryIdTable(db),
                                referencedColumn:
                                    $$WorkoutHistorySetResultsTableReferences
                                        ._workoutHistoryIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$WorkoutHistorySetResultsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutHistorySetResultsTable,
      WorkoutHistorySetResult,
      $$WorkoutHistorySetResultsTableFilterComposer,
      $$WorkoutHistorySetResultsTableOrderingComposer,
      $$WorkoutHistorySetResultsTableAnnotationComposer,
      $$WorkoutHistorySetResultsTableCreateCompanionBuilder,
      $$WorkoutHistorySetResultsTableUpdateCompanionBuilder,
      (WorkoutHistorySetResult, $$WorkoutHistorySetResultsTableReferences),
      WorkoutHistorySetResult,
      PrefetchHooks Function({bool workoutHistoryId})
    >;
typedef $$WorkoutHistoryStepResultsTableCreateCompanionBuilder =
    WorkoutHistoryStepResultsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String workoutHistoryId,
      required String programSnapshotId,
      required String exerciseSnapshotId,
      required int programIndex,
      required int exerciseIndex,
      required int setIndex,
      required int passageIndex,
      required int stepIndex,
      required String stepSnapshotId,
      required String stepNameSnapshot,
      required String stepTypeSnapshot,
      required int targetValueSnapshot,
      required bool hasScoreSnapshot,
      Value<String?> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      required String status,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> note,
      Value<String?> sourceExerciseIdSnapshot,
      Value<int> rowid,
    });
typedef $$WorkoutHistoryStepResultsTableUpdateCompanionBuilder =
    WorkoutHistoryStepResultsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> workoutHistoryId,
      Value<String> programSnapshotId,
      Value<String> exerciseSnapshotId,
      Value<int> programIndex,
      Value<int> exerciseIndex,
      Value<int> setIndex,
      Value<int> passageIndex,
      Value<int> stepIndex,
      Value<String> stepSnapshotId,
      Value<String> stepNameSnapshot,
      Value<String> stepTypeSnapshot,
      Value<int> targetValueSnapshot,
      Value<bool> hasScoreSnapshot,
      Value<String?> scoreInputModeSnapshot,
      Value<String?> scoreLabelSnapshot,
      Value<String?> scoreUnitSnapshot,
      Value<double?> targetScoreSnapshot,
      Value<int?> targetScoreTimeMsSnapshot,
      Value<String> status,
      Value<DateTime?> startedAt,
      Value<DateTime?> completedAt,
      Value<int?> actualTimeMs,
      Value<int?> actualReps,
      Value<double?> actualScore,
      Value<int?> actualScoreTimeMs,
      Value<String?> note,
      Value<String?> sourceExerciseIdSnapshot,
      Value<int> rowid,
    });

final class $$WorkoutHistoryStepResultsTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $WorkoutHistoryStepResultsTable,
          WorkoutHistoryStepResult
        > {
  $$WorkoutHistoryStepResultsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutHistoriesTable _workoutHistoryIdTable(_$AppDatabase db) =>
      db.workoutHistories.createAlias(
        'workout_history_step_results__workout_history_id__workout_history__id',
      );

  $$WorkoutHistoriesTableProcessedTableManager get workoutHistoryId {
    final $_column = $_itemColumn<String>('workout_history_id')!;

    final manager = $$WorkoutHistoriesTableTableManager(
      $_db,
      $_db.workoutHistories,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_workoutHistoryIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$WorkoutHistoryStepResultsTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutHistoryStepResultsTable> {
  $$WorkoutHistoryStepResultsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get setIndex => $composableBuilder(
    column: $table.setIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get passageIndex => $composableBuilder(
    column: $table.passageIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get stepIndex => $composableBuilder(
    column: $table.stepIndex,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get stepSnapshotId => $composableBuilder(
    column: $table.stepSnapshotId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get stepNameSnapshot => $composableBuilder(
    column: $table.stepNameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get stepTypeSnapshot => $composableBuilder(
    column: $table.stepTypeSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetValueSnapshot => $composableBuilder(
    column: $table.targetValueSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get hasScoreSnapshot => $composableBuilder(
    column: $table.hasScoreSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get note => $composableBuilder(
    column: $table.note,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  $$WorkoutHistoriesTableFilterComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableFilterComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistoryStepResultsTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutHistoryStepResultsTable> {
  $$WorkoutHistoryStepResultsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get setIndex => $composableBuilder(
    column: $table.setIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get passageIndex => $composableBuilder(
    column: $table.passageIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get stepIndex => $composableBuilder(
    column: $table.stepIndex,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get stepSnapshotId => $composableBuilder(
    column: $table.stepSnapshotId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get stepNameSnapshot => $composableBuilder(
    column: $table.stepNameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get stepTypeSnapshot => $composableBuilder(
    column: $table.stepTypeSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetValueSnapshot => $composableBuilder(
    column: $table.targetValueSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get hasScoreSnapshot => $composableBuilder(
    column: $table.hasScoreSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get status => $composableBuilder(
    column: $table.status,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get startedAt => $composableBuilder(
    column: $table.startedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get note => $composableBuilder(
    column: $table.note,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  $$WorkoutHistoriesTableOrderingComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableOrderingComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistoryStepResultsTableAnnotationComposer
    extends Composer<_$AppDatabase, $WorkoutHistoryStepResultsTable> {
  $$WorkoutHistoryStepResultsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get programSnapshotId => $composableBuilder(
    column: $table.programSnapshotId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get exerciseSnapshotId => $composableBuilder(
    column: $table.exerciseSnapshotId,
    builder: (column) => column,
  );

  GeneratedColumn<int> get programIndex => $composableBuilder(
    column: $table.programIndex,
    builder: (column) => column,
  );

  GeneratedColumn<int> get exerciseIndex => $composableBuilder(
    column: $table.exerciseIndex,
    builder: (column) => column,
  );

  GeneratedColumn<int> get setIndex =>
      $composableBuilder(column: $table.setIndex, builder: (column) => column);

  GeneratedColumn<int> get passageIndex => $composableBuilder(
    column: $table.passageIndex,
    builder: (column) => column,
  );

  GeneratedColumn<int> get stepIndex =>
      $composableBuilder(column: $table.stepIndex, builder: (column) => column);

  GeneratedColumn<String> get stepSnapshotId => $composableBuilder(
    column: $table.stepSnapshotId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get stepNameSnapshot => $composableBuilder(
    column: $table.stepNameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get stepTypeSnapshot => $composableBuilder(
    column: $table.stepTypeSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetValueSnapshot => $composableBuilder(
    column: $table.targetValueSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get hasScoreSnapshot => $composableBuilder(
    column: $table.hasScoreSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreInputModeSnapshot => $composableBuilder(
    column: $table.scoreInputModeSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreLabelSnapshot => $composableBuilder(
    column: $table.scoreLabelSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get scoreUnitSnapshot => $composableBuilder(
    column: $table.scoreUnitSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<double> get targetScoreSnapshot => $composableBuilder(
    column: $table.targetScoreSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetScoreTimeMsSnapshot => $composableBuilder(
    column: $table.targetScoreTimeMsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get status =>
      $composableBuilder(column: $table.status, builder: (column) => column);

  GeneratedColumn<DateTime> get startedAt =>
      $composableBuilder(column: $table.startedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get completedAt => $composableBuilder(
    column: $table.completedAt,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualTimeMs => $composableBuilder(
    column: $table.actualTimeMs,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualReps => $composableBuilder(
    column: $table.actualReps,
    builder: (column) => column,
  );

  GeneratedColumn<double> get actualScore => $composableBuilder(
    column: $table.actualScore,
    builder: (column) => column,
  );

  GeneratedColumn<int> get actualScoreTimeMs => $composableBuilder(
    column: $table.actualScoreTimeMs,
    builder: (column) => column,
  );

  GeneratedColumn<String> get note =>
      $composableBuilder(column: $table.note, builder: (column) => column);

  GeneratedColumn<String> get sourceExerciseIdSnapshot => $composableBuilder(
    column: $table.sourceExerciseIdSnapshot,
    builder: (column) => column,
  );

  $$WorkoutHistoriesTableAnnotationComposer get workoutHistoryId {
    final $$WorkoutHistoriesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutHistoryId,
      referencedTable: $db.workoutHistories,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutHistoriesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutHistories,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutHistoryStepResultsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutHistoryStepResultsTable,
          WorkoutHistoryStepResult,
          $$WorkoutHistoryStepResultsTableFilterComposer,
          $$WorkoutHistoryStepResultsTableOrderingComposer,
          $$WorkoutHistoryStepResultsTableAnnotationComposer,
          $$WorkoutHistoryStepResultsTableCreateCompanionBuilder,
          $$WorkoutHistoryStepResultsTableUpdateCompanionBuilder,
          (
            WorkoutHistoryStepResult,
            $$WorkoutHistoryStepResultsTableReferences,
          ),
          WorkoutHistoryStepResult,
          PrefetchHooks Function({bool workoutHistoryId})
        > {
  $$WorkoutHistoryStepResultsTableTableManager(
    _$AppDatabase db,
    $WorkoutHistoryStepResultsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutHistoryStepResultsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$WorkoutHistoryStepResultsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$WorkoutHistoryStepResultsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> workoutHistoryId = const Value.absent(),
                Value<String> programSnapshotId = const Value.absent(),
                Value<String> exerciseSnapshotId = const Value.absent(),
                Value<int> programIndex = const Value.absent(),
                Value<int> exerciseIndex = const Value.absent(),
                Value<int> setIndex = const Value.absent(),
                Value<int> passageIndex = const Value.absent(),
                Value<int> stepIndex = const Value.absent(),
                Value<String> stepSnapshotId = const Value.absent(),
                Value<String> stepNameSnapshot = const Value.absent(),
                Value<String> stepTypeSnapshot = const Value.absent(),
                Value<int> targetValueSnapshot = const Value.absent(),
                Value<bool> hasScoreSnapshot = const Value.absent(),
                Value<String?> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                Value<String> status = const Value.absent(),
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistoryStepResultsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutHistoryId: workoutHistoryId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                passageIndex: passageIndex,
                stepIndex: stepIndex,
                stepSnapshotId: stepSnapshotId,
                stepNameSnapshot: stepNameSnapshot,
                stepTypeSnapshot: stepTypeSnapshot,
                targetValueSnapshot: targetValueSnapshot,
                hasScoreSnapshot: hasScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                status: status,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                note: note,
                sourceExerciseIdSnapshot: sourceExerciseIdSnapshot,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String workoutHistoryId,
                required String programSnapshotId,
                required String exerciseSnapshotId,
                required int programIndex,
                required int exerciseIndex,
                required int setIndex,
                required int passageIndex,
                required int stepIndex,
                required String stepSnapshotId,
                required String stepNameSnapshot,
                required String stepTypeSnapshot,
                required int targetValueSnapshot,
                required bool hasScoreSnapshot,
                Value<String?> scoreInputModeSnapshot = const Value.absent(),
                Value<String?> scoreLabelSnapshot = const Value.absent(),
                Value<String?> scoreUnitSnapshot = const Value.absent(),
                Value<double?> targetScoreSnapshot = const Value.absent(),
                Value<int?> targetScoreTimeMsSnapshot = const Value.absent(),
                required String status,
                Value<DateTime?> startedAt = const Value.absent(),
                Value<DateTime?> completedAt = const Value.absent(),
                Value<int?> actualTimeMs = const Value.absent(),
                Value<int?> actualReps = const Value.absent(),
                Value<double?> actualScore = const Value.absent(),
                Value<int?> actualScoreTimeMs = const Value.absent(),
                Value<String?> note = const Value.absent(),
                Value<String?> sourceExerciseIdSnapshot = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutHistoryStepResultsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutHistoryId: workoutHistoryId,
                programSnapshotId: programSnapshotId,
                exerciseSnapshotId: exerciseSnapshotId,
                programIndex: programIndex,
                exerciseIndex: exerciseIndex,
                setIndex: setIndex,
                passageIndex: passageIndex,
                stepIndex: stepIndex,
                stepSnapshotId: stepSnapshotId,
                stepNameSnapshot: stepNameSnapshot,
                stepTypeSnapshot: stepTypeSnapshot,
                targetValueSnapshot: targetValueSnapshot,
                hasScoreSnapshot: hasScoreSnapshot,
                scoreInputModeSnapshot: scoreInputModeSnapshot,
                scoreLabelSnapshot: scoreLabelSnapshot,
                scoreUnitSnapshot: scoreUnitSnapshot,
                targetScoreSnapshot: targetScoreSnapshot,
                targetScoreTimeMsSnapshot: targetScoreTimeMsSnapshot,
                status: status,
                startedAt: startedAt,
                completedAt: completedAt,
                actualTimeMs: actualTimeMs,
                actualReps: actualReps,
                actualScore: actualScore,
                actualScoreTimeMs: actualScoreTimeMs,
                note: note,
                sourceExerciseIdSnapshot: sourceExerciseIdSnapshot,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutHistoryStepResultsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({workoutHistoryId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (workoutHistoryId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.workoutHistoryId,
                                referencedTable:
                                    $$WorkoutHistoryStepResultsTableReferences
                                        ._workoutHistoryIdTable(db),
                                referencedColumn:
                                    $$WorkoutHistoryStepResultsTableReferences
                                        ._workoutHistoryIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$WorkoutHistoryStepResultsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutHistoryStepResultsTable,
      WorkoutHistoryStepResult,
      $$WorkoutHistoryStepResultsTableFilterComposer,
      $$WorkoutHistoryStepResultsTableOrderingComposer,
      $$WorkoutHistoryStepResultsTableAnnotationComposer,
      $$WorkoutHistoryStepResultsTableCreateCompanionBuilder,
      $$WorkoutHistoryStepResultsTableUpdateCompanionBuilder,
      (WorkoutHistoryStepResult, $$WorkoutHistoryStepResultsTableReferences),
      WorkoutHistoryStepResult,
      PrefetchHooks Function({bool workoutHistoryId})
    >;
typedef $$WorkoutTemplateProgramsTableCreateCompanionBuilder =
    WorkoutTemplateProgramsCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String workoutTemplateId,
      Value<String?> sourceProgramId,
      required int position,
      required String programNameSnapshot,
      required int defaultRestSecondsSnapshot,
      required String programSnapshotJson,
      Value<int> rowid,
    });
typedef $$WorkoutTemplateProgramsTableUpdateCompanionBuilder =
    WorkoutTemplateProgramsCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> workoutTemplateId,
      Value<String?> sourceProgramId,
      Value<int> position,
      Value<String> programNameSnapshot,
      Value<int> defaultRestSecondsSnapshot,
      Value<String> programSnapshotJson,
      Value<int> rowid,
    });

final class $$WorkoutTemplateProgramsTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $WorkoutTemplateProgramsTable,
          WorkoutTemplateProgram
        > {
  $$WorkoutTemplateProgramsTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutTemplatesTable _workoutTemplateIdTable(_$AppDatabase db) =>
      db.workoutTemplates.createAlias(
        'workout_template_programs__workout_template_id__workout_templates__id',
      );

  $$WorkoutTemplatesTableProcessedTableManager get workoutTemplateId {
    final $_column = $_itemColumn<String>('workout_template_id')!;

    final manager = $$WorkoutTemplatesTableTableManager(
      $_db,
      $_db.workoutTemplates,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_workoutTemplateIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static $ProgramsTable _sourceProgramIdTable(_$AppDatabase db) =>
      db.programs.createAlias(
        'workout_template_programs__source_program_id__programs__id',
      );

  $$ProgramsTableProcessedTableManager? get sourceProgramId {
    final $_column = $_itemColumn<String>('source_program_id');
    if ($_column == null) return null;
    final manager = $$ProgramsTableTableManager(
      $_db,
      $_db.programs,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(_sourceProgramIdTable($_db));
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }

  static MultiTypedResultKey<
    $WorkoutTemplateExerciseOverridesTable,
    List<WorkoutTemplateExerciseOverride>
  >
  _workoutTemplateExerciseOverridesRefsTable(
    _$AppDatabase db,
  ) => MultiTypedResultKey.fromTable(
    db.workoutTemplateExerciseOverrides,
    aliasName:
        'workout_template_programs__id__workout_template_exercise_overrides__workout_template_program_id',
  );

  $$WorkoutTemplateExerciseOverridesTableProcessedTableManager
  get workoutTemplateExerciseOverridesRefs {
    final manager =
        $$WorkoutTemplateExerciseOverridesTableTableManager(
          $_db,
          $_db.workoutTemplateExerciseOverrides,
        ).filter(
          (f) => f.workoutTemplateProgramId.id.sqlEquals(
            $_itemColumn<String>('id')!,
          ),
        );

    final cache = $_typedResult.readTableOrNull(
      _workoutTemplateExerciseOverridesRefsTable($_db),
    );
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: cache),
    );
  }
}

class $$WorkoutTemplateProgramsTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateProgramsTable> {
  $$WorkoutTemplateProgramsTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get position => $composableBuilder(
    column: $table.position,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get defaultRestSecondsSnapshot => $composableBuilder(
    column: $table.defaultRestSecondsSnapshot,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get programSnapshotJson => $composableBuilder(
    column: $table.programSnapshotJson,
    builder: (column) => ColumnFilters(column),
  );

  $$WorkoutTemplatesTableFilterComposer get workoutTemplateId {
    final $$WorkoutTemplatesTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableFilterComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ProgramsTableFilterComposer get sourceProgramId {
    final $$ProgramsTableFilterComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceProgramId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableFilterComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<bool> workoutTemplateExerciseOverridesRefs(
    Expression<bool> Function(
      $$WorkoutTemplateExerciseOverridesTableFilterComposer f,
    )
    f,
  ) {
    final $$WorkoutTemplateExerciseOverridesTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplateExerciseOverrides,
          getReferencedColumn: (t) => t.workoutTemplateProgramId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateExerciseOverridesTableFilterComposer(
                $db: $db,
                $table: $db.workoutTemplateExerciseOverrides,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutTemplateProgramsTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateProgramsTable> {
  $$WorkoutTemplateProgramsTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get position => $composableBuilder(
    column: $table.position,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get defaultRestSecondsSnapshot => $composableBuilder(
    column: $table.defaultRestSecondsSnapshot,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get programSnapshotJson => $composableBuilder(
    column: $table.programSnapshotJson,
    builder: (column) => ColumnOrderings(column),
  );

  $$WorkoutTemplatesTableOrderingComposer get workoutTemplateId {
    final $$WorkoutTemplatesTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableOrderingComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ProgramsTableOrderingComposer get sourceProgramId {
    final $$ProgramsTableOrderingComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceProgramId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableOrderingComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }
}

class $$WorkoutTemplateProgramsTableAnnotationComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateProgramsTable> {
  $$WorkoutTemplateProgramsTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<int> get position =>
      $composableBuilder(column: $table.position, builder: (column) => column);

  GeneratedColumn<String> get programNameSnapshot => $composableBuilder(
    column: $table.programNameSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<int> get defaultRestSecondsSnapshot => $composableBuilder(
    column: $table.defaultRestSecondsSnapshot,
    builder: (column) => column,
  );

  GeneratedColumn<String> get programSnapshotJson => $composableBuilder(
    column: $table.programSnapshotJson,
    builder: (column) => column,
  );

  $$WorkoutTemplatesTableAnnotationComposer get workoutTemplateId {
    final $$WorkoutTemplatesTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.workoutTemplateId,
      referencedTable: $db.workoutTemplates,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$WorkoutTemplatesTableAnnotationComposer(
            $db: $db,
            $table: $db.workoutTemplates,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  $$ProgramsTableAnnotationComposer get sourceProgramId {
    final $$ProgramsTableAnnotationComposer composer = $composerBuilder(
      composer: this,
      getCurrentColumn: (t) => t.sourceProgramId,
      referencedTable: $db.programs,
      getReferencedColumn: (t) => t.id,
      builder:
          (
            joinBuilder, {
            $addJoinBuilderToRootComposer,
            $removeJoinBuilderFromRootComposer,
          }) => $$ProgramsTableAnnotationComposer(
            $db: $db,
            $table: $db.programs,
            $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
            joinBuilder: joinBuilder,
            $removeJoinBuilderFromRootComposer:
                $removeJoinBuilderFromRootComposer,
          ),
    );
    return composer;
  }

  Expression<T> workoutTemplateExerciseOverridesRefs<T extends Object>(
    Expression<T> Function(
      $$WorkoutTemplateExerciseOverridesTableAnnotationComposer a,
    )
    f,
  ) {
    final $$WorkoutTemplateExerciseOverridesTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.id,
          referencedTable: $db.workoutTemplateExerciseOverrides,
          getReferencedColumn: (t) => t.workoutTemplateProgramId,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateExerciseOverridesTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutTemplateExerciseOverrides,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return f(composer);
  }
}

class $$WorkoutTemplateProgramsTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutTemplateProgramsTable,
          WorkoutTemplateProgram,
          $$WorkoutTemplateProgramsTableFilterComposer,
          $$WorkoutTemplateProgramsTableOrderingComposer,
          $$WorkoutTemplateProgramsTableAnnotationComposer,
          $$WorkoutTemplateProgramsTableCreateCompanionBuilder,
          $$WorkoutTemplateProgramsTableUpdateCompanionBuilder,
          (WorkoutTemplateProgram, $$WorkoutTemplateProgramsTableReferences),
          WorkoutTemplateProgram,
          PrefetchHooks Function({
            bool workoutTemplateId,
            bool sourceProgramId,
            bool workoutTemplateExerciseOverridesRefs,
          })
        > {
  $$WorkoutTemplateProgramsTableTableManager(
    _$AppDatabase db,
    $WorkoutTemplateProgramsTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutTemplateProgramsTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$WorkoutTemplateProgramsTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$WorkoutTemplateProgramsTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> workoutTemplateId = const Value.absent(),
                Value<String?> sourceProgramId = const Value.absent(),
                Value<int> position = const Value.absent(),
                Value<String> programNameSnapshot = const Value.absent(),
                Value<int> defaultRestSecondsSnapshot = const Value.absent(),
                Value<String> programSnapshotJson = const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplateProgramsCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutTemplateId: workoutTemplateId,
                sourceProgramId: sourceProgramId,
                position: position,
                programNameSnapshot: programNameSnapshot,
                defaultRestSecondsSnapshot: defaultRestSecondsSnapshot,
                programSnapshotJson: programSnapshotJson,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String workoutTemplateId,
                Value<String?> sourceProgramId = const Value.absent(),
                required int position,
                required String programNameSnapshot,
                required int defaultRestSecondsSnapshot,
                required String programSnapshotJson,
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplateProgramsCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutTemplateId: workoutTemplateId,
                sourceProgramId: sourceProgramId,
                position: position,
                programNameSnapshot: programNameSnapshot,
                defaultRestSecondsSnapshot: defaultRestSecondsSnapshot,
                programSnapshotJson: programSnapshotJson,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutTemplateProgramsTableReferences(db, table, e),
                ),
              )
              .toList(),
          prefetchHooksCallback:
              ({
                workoutTemplateId = false,
                sourceProgramId = false,
                workoutTemplateExerciseOverridesRefs = false,
              }) {
                return PrefetchHooks(
                  db: db,
                  explicitlyWatchedTables: [
                    if (workoutTemplateExerciseOverridesRefs)
                      db.workoutTemplateExerciseOverrides,
                  ],
                  addJoins:
                      <
                        T extends TableManagerState<
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic,
                          dynamic
                        >
                      >(state) {
                        if (workoutTemplateId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.workoutTemplateId,
                                    referencedTable:
                                        $$WorkoutTemplateProgramsTableReferences
                                            ._workoutTemplateIdTable(db),
                                    referencedColumn:
                                        $$WorkoutTemplateProgramsTableReferences
                                            ._workoutTemplateIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }
                        if (sourceProgramId) {
                          state =
                              state.withJoin(
                                    currentTable: table,
                                    currentColumn: table.sourceProgramId,
                                    referencedTable:
                                        $$WorkoutTemplateProgramsTableReferences
                                            ._sourceProgramIdTable(db),
                                    referencedColumn:
                                        $$WorkoutTemplateProgramsTableReferences
                                            ._sourceProgramIdTable(db)
                                            .id,
                                  )
                                  as T;
                        }

                        return state;
                      },
                  getPrefetchedDataCallback: (items) async {
                    return [
                      if (workoutTemplateExerciseOverridesRefs)
                        await $_getPrefetchedData<
                          WorkoutTemplateProgram,
                          $WorkoutTemplateProgramsTable,
                          WorkoutTemplateExerciseOverride
                        >(
                          currentTable: table,
                          referencedTable:
                              $$WorkoutTemplateProgramsTableReferences
                                  ._workoutTemplateExerciseOverridesRefsTable(
                                    db,
                                  ),
                          managerFromTypedResult: (p0) =>
                              $$WorkoutTemplateProgramsTableReferences(
                                db,
                                table,
                                p0,
                              ).workoutTemplateExerciseOverridesRefs,
                          referencedItemsForCurrentItem:
                              (item, referencedItems) => referencedItems.where(
                                (e) => e.workoutTemplateProgramId == item.id,
                              ),
                          typedResults: items,
                        ),
                    ];
                  },
                );
              },
        ),
      );
}

typedef $$WorkoutTemplateProgramsTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutTemplateProgramsTable,
      WorkoutTemplateProgram,
      $$WorkoutTemplateProgramsTableFilterComposer,
      $$WorkoutTemplateProgramsTableOrderingComposer,
      $$WorkoutTemplateProgramsTableAnnotationComposer,
      $$WorkoutTemplateProgramsTableCreateCompanionBuilder,
      $$WorkoutTemplateProgramsTableUpdateCompanionBuilder,
      (WorkoutTemplateProgram, $$WorkoutTemplateProgramsTableReferences),
      WorkoutTemplateProgram,
      PrefetchHooks Function({
        bool workoutTemplateId,
        bool sourceProgramId,
        bool workoutTemplateExerciseOverridesRefs,
      })
    >;
typedef $$WorkoutTemplateExerciseOverridesTableCreateCompanionBuilder =
    WorkoutTemplateExerciseOverridesCompanion Function({
      required String id,
      required DateTime createdAt,
      required DateTime updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      required String syncState,
      required int localRevision,
      required String originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      required String workoutTemplateProgramId,
      required String snapshotProgramExerciseId,
      Value<int?> setsCountOverride,
      Value<int?> targetTimeSecondsOverride,
      Value<int?> targetRepsOverride,
      Value<double?> targetScoreOverride,
      Value<int?> targetScoreTimeMsOverride,
      Value<bool?> autoStartNextTimedStepOverride,
      Value<int> rowid,
    });
typedef $$WorkoutTemplateExerciseOverridesTableUpdateCompanionBuilder =
    WorkoutTemplateExerciseOverridesCompanion Function({
      Value<String> id,
      Value<DateTime> createdAt,
      Value<DateTime> updatedAt,
      Value<DateTime?> deletedAt,
      Value<int> schemaVersion,
      Value<String> syncState,
      Value<int> localRevision,
      Value<String> originDeviceId,
      Value<String?> futureOwnerProfileId,
      Value<DateTime?> lastSyncedAt,
      Value<String?> remoteRevision,
      Value<String> workoutTemplateProgramId,
      Value<String> snapshotProgramExerciseId,
      Value<int?> setsCountOverride,
      Value<int?> targetTimeSecondsOverride,
      Value<int?> targetRepsOverride,
      Value<double?> targetScoreOverride,
      Value<int?> targetScoreTimeMsOverride,
      Value<bool?> autoStartNextTimedStepOverride,
      Value<int> rowid,
    });

final class $$WorkoutTemplateExerciseOverridesTableReferences
    extends
        BaseReferences<
          _$AppDatabase,
          $WorkoutTemplateExerciseOverridesTable,
          WorkoutTemplateExerciseOverride
        > {
  $$WorkoutTemplateExerciseOverridesTableReferences(
    super.$_db,
    super.$_table,
    super.$_typedResult,
  );

  static $WorkoutTemplateProgramsTable _workoutTemplateProgramIdTable(
    _$AppDatabase db,
  ) => db.workoutTemplatePrograms.createAlias(
    'workout_template_exercise_overrides__workout_template_program_id__workout_template_programs__id',
  );

  $$WorkoutTemplateProgramsTableProcessedTableManager
  get workoutTemplateProgramId {
    final $_column = $_itemColumn<String>('workout_template_program_id')!;

    final manager = $$WorkoutTemplateProgramsTableTableManager(
      $_db,
      $_db.workoutTemplatePrograms,
    ).filter((f) => f.id.sqlEquals($_column));
    final item = $_typedResult.readTableOrNull(
      _workoutTemplateProgramIdTable($_db),
    );
    if (item == null) return manager;
    return ProcessedTableManager(
      manager.$state.copyWith(prefetchedData: [item]),
    );
  }
}

class $$WorkoutTemplateExerciseOverridesTableFilterComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateExerciseOverridesTable> {
  $$WorkoutTemplateExerciseOverridesTableFilterComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<String> get snapshotProgramExerciseId => $composableBuilder(
    column: $table.snapshotProgramExerciseId,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get setsCountOverride => $composableBuilder(
    column: $table.setsCountOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetTimeSecondsOverride => $composableBuilder(
    column: $table.targetTimeSecondsOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetRepsOverride => $composableBuilder(
    column: $table.targetRepsOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<double> get targetScoreOverride => $composableBuilder(
    column: $table.targetScoreOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<int> get targetScoreTimeMsOverride => $composableBuilder(
    column: $table.targetScoreTimeMsOverride,
    builder: (column) => ColumnFilters(column),
  );

  ColumnFilters<bool> get autoStartNextTimedStepOverride => $composableBuilder(
    column: $table.autoStartNextTimedStepOverride,
    builder: (column) => ColumnFilters(column),
  );

  $$WorkoutTemplateProgramsTableFilterComposer get workoutTemplateProgramId {
    final $$WorkoutTemplateProgramsTableFilterComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.workoutTemplateProgramId,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableFilterComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$WorkoutTemplateExerciseOverridesTableOrderingComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateExerciseOverridesTable> {
  $$WorkoutTemplateExerciseOverridesTableOrderingComposer({
    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<DateTime> get createdAt => $composableBuilder(
    column: $table.createdAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
    column: $table.updatedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get deletedAt => $composableBuilder(
    column: $table.deletedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get syncState => $composableBuilder(
    column: $table.syncState,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<String> get snapshotProgramExerciseId => $composableBuilder(
    column: $table.snapshotProgramExerciseId,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get setsCountOverride => $composableBuilder(
    column: $table.setsCountOverride,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetTimeSecondsOverride => $composableBuilder(
    column: $table.targetTimeSecondsOverride,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetRepsOverride => $composableBuilder(
    column: $table.targetRepsOverride,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<double> get targetScoreOverride => $composableBuilder(
    column: $table.targetScoreOverride,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<int> get targetScoreTimeMsOverride => $composableBuilder(
    column: $table.targetScoreTimeMsOverride,
    builder: (column) => ColumnOrderings(column),
  );

  ColumnOrderings<bool> get autoStartNextTimedStepOverride =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepOverride,
        builder: (column) => ColumnOrderings(column),
      );

  $$WorkoutTemplateProgramsTableOrderingComposer get workoutTemplateProgramId {
    final $$WorkoutTemplateProgramsTableOrderingComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.workoutTemplateProgramId,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableOrderingComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$WorkoutTemplateExerciseOverridesTableAnnotationComposer
    extends Composer<_$AppDatabase, $WorkoutTemplateExerciseOverridesTable> {
  $$WorkoutTemplateExerciseOverridesTableAnnotationComposer({
    required super.$db,
    required super.$table,
    super.joinBuilder,
    super.$addJoinBuilderToRootComposer,
    super.$removeJoinBuilderFromRootComposer,
  });
  GeneratedColumn<String> get id =>
      $composableBuilder(column: $table.id, builder: (column) => column);

  GeneratedColumn<DateTime> get createdAt =>
      $composableBuilder(column: $table.createdAt, builder: (column) => column);

  GeneratedColumn<DateTime> get updatedAt =>
      $composableBuilder(column: $table.updatedAt, builder: (column) => column);

  GeneratedColumn<DateTime> get deletedAt =>
      $composableBuilder(column: $table.deletedAt, builder: (column) => column);

  GeneratedColumn<int> get schemaVersion => $composableBuilder(
    column: $table.schemaVersion,
    builder: (column) => column,
  );

  GeneratedColumn<String> get syncState =>
      $composableBuilder(column: $table.syncState, builder: (column) => column);

  GeneratedColumn<int> get localRevision => $composableBuilder(
    column: $table.localRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get originDeviceId => $composableBuilder(
    column: $table.originDeviceId,
    builder: (column) => column,
  );

  GeneratedColumn<String> get futureOwnerProfileId => $composableBuilder(
    column: $table.futureOwnerProfileId,
    builder: (column) => column,
  );

  GeneratedColumn<DateTime> get lastSyncedAt => $composableBuilder(
    column: $table.lastSyncedAt,
    builder: (column) => column,
  );

  GeneratedColumn<String> get remoteRevision => $composableBuilder(
    column: $table.remoteRevision,
    builder: (column) => column,
  );

  GeneratedColumn<String> get snapshotProgramExerciseId => $composableBuilder(
    column: $table.snapshotProgramExerciseId,
    builder: (column) => column,
  );

  GeneratedColumn<int> get setsCountOverride => $composableBuilder(
    column: $table.setsCountOverride,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetTimeSecondsOverride => $composableBuilder(
    column: $table.targetTimeSecondsOverride,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetRepsOverride => $composableBuilder(
    column: $table.targetRepsOverride,
    builder: (column) => column,
  );

  GeneratedColumn<double> get targetScoreOverride => $composableBuilder(
    column: $table.targetScoreOverride,
    builder: (column) => column,
  );

  GeneratedColumn<int> get targetScoreTimeMsOverride => $composableBuilder(
    column: $table.targetScoreTimeMsOverride,
    builder: (column) => column,
  );

  GeneratedColumn<bool> get autoStartNextTimedStepOverride =>
      $composableBuilder(
        column: $table.autoStartNextTimedStepOverride,
        builder: (column) => column,
      );

  $$WorkoutTemplateProgramsTableAnnotationComposer
  get workoutTemplateProgramId {
    final $$WorkoutTemplateProgramsTableAnnotationComposer composer =
        $composerBuilder(
          composer: this,
          getCurrentColumn: (t) => t.workoutTemplateProgramId,
          referencedTable: $db.workoutTemplatePrograms,
          getReferencedColumn: (t) => t.id,
          builder:
              (
                joinBuilder, {
                $addJoinBuilderToRootComposer,
                $removeJoinBuilderFromRootComposer,
              }) => $$WorkoutTemplateProgramsTableAnnotationComposer(
                $db: $db,
                $table: $db.workoutTemplatePrograms,
                $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
                joinBuilder: joinBuilder,
                $removeJoinBuilderFromRootComposer:
                    $removeJoinBuilderFromRootComposer,
              ),
        );
    return composer;
  }
}

class $$WorkoutTemplateExerciseOverridesTableTableManager
    extends
        RootTableManager<
          _$AppDatabase,
          $WorkoutTemplateExerciseOverridesTable,
          WorkoutTemplateExerciseOverride,
          $$WorkoutTemplateExerciseOverridesTableFilterComposer,
          $$WorkoutTemplateExerciseOverridesTableOrderingComposer,
          $$WorkoutTemplateExerciseOverridesTableAnnotationComposer,
          $$WorkoutTemplateExerciseOverridesTableCreateCompanionBuilder,
          $$WorkoutTemplateExerciseOverridesTableUpdateCompanionBuilder,
          (
            WorkoutTemplateExerciseOverride,
            $$WorkoutTemplateExerciseOverridesTableReferences,
          ),
          WorkoutTemplateExerciseOverride,
          PrefetchHooks Function({bool workoutTemplateProgramId})
        > {
  $$WorkoutTemplateExerciseOverridesTableTableManager(
    _$AppDatabase db,
    $WorkoutTemplateExerciseOverridesTable table,
  ) : super(
        TableManagerState(
          db: db,
          table: table,
          createFilteringComposer: () =>
              $$WorkoutTemplateExerciseOverridesTableFilterComposer(
                $db: db,
                $table: table,
              ),
          createOrderingComposer: () =>
              $$WorkoutTemplateExerciseOverridesTableOrderingComposer(
                $db: db,
                $table: table,
              ),
          createComputedFieldComposer: () =>
              $$WorkoutTemplateExerciseOverridesTableAnnotationComposer(
                $db: db,
                $table: table,
              ),
          updateCompanionCallback:
              ({
                Value<String> id = const Value.absent(),
                Value<DateTime> createdAt = const Value.absent(),
                Value<DateTime> updatedAt = const Value.absent(),
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                Value<String> syncState = const Value.absent(),
                Value<int> localRevision = const Value.absent(),
                Value<String> originDeviceId = const Value.absent(),
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                Value<String> workoutTemplateProgramId = const Value.absent(),
                Value<String> snapshotProgramExerciseId = const Value.absent(),
                Value<int?> setsCountOverride = const Value.absent(),
                Value<int?> targetTimeSecondsOverride = const Value.absent(),
                Value<int?> targetRepsOverride = const Value.absent(),
                Value<double?> targetScoreOverride = const Value.absent(),
                Value<int?> targetScoreTimeMsOverride = const Value.absent(),
                Value<bool?> autoStartNextTimedStepOverride =
                    const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplateExerciseOverridesCompanion(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutTemplateProgramId: workoutTemplateProgramId,
                snapshotProgramExerciseId: snapshotProgramExerciseId,
                setsCountOverride: setsCountOverride,
                targetTimeSecondsOverride: targetTimeSecondsOverride,
                targetRepsOverride: targetRepsOverride,
                targetScoreOverride: targetScoreOverride,
                targetScoreTimeMsOverride: targetScoreTimeMsOverride,
                autoStartNextTimedStepOverride: autoStartNextTimedStepOverride,
                rowid: rowid,
              ),
          createCompanionCallback:
              ({
                required String id,
                required DateTime createdAt,
                required DateTime updatedAt,
                Value<DateTime?> deletedAt = const Value.absent(),
                Value<int> schemaVersion = const Value.absent(),
                required String syncState,
                required int localRevision,
                required String originDeviceId,
                Value<String?> futureOwnerProfileId = const Value.absent(),
                Value<DateTime?> lastSyncedAt = const Value.absent(),
                Value<String?> remoteRevision = const Value.absent(),
                required String workoutTemplateProgramId,
                required String snapshotProgramExerciseId,
                Value<int?> setsCountOverride = const Value.absent(),
                Value<int?> targetTimeSecondsOverride = const Value.absent(),
                Value<int?> targetRepsOverride = const Value.absent(),
                Value<double?> targetScoreOverride = const Value.absent(),
                Value<int?> targetScoreTimeMsOverride = const Value.absent(),
                Value<bool?> autoStartNextTimedStepOverride =
                    const Value.absent(),
                Value<int> rowid = const Value.absent(),
              }) => WorkoutTemplateExerciseOverridesCompanion.insert(
                id: id,
                createdAt: createdAt,
                updatedAt: updatedAt,
                deletedAt: deletedAt,
                schemaVersion: schemaVersion,
                syncState: syncState,
                localRevision: localRevision,
                originDeviceId: originDeviceId,
                futureOwnerProfileId: futureOwnerProfileId,
                lastSyncedAt: lastSyncedAt,
                remoteRevision: remoteRevision,
                workoutTemplateProgramId: workoutTemplateProgramId,
                snapshotProgramExerciseId: snapshotProgramExerciseId,
                setsCountOverride: setsCountOverride,
                targetTimeSecondsOverride: targetTimeSecondsOverride,
                targetRepsOverride: targetRepsOverride,
                targetScoreOverride: targetScoreOverride,
                targetScoreTimeMsOverride: targetScoreTimeMsOverride,
                autoStartNextTimedStepOverride: autoStartNextTimedStepOverride,
                rowid: rowid,
              ),
          withReferenceMapper: (p0) => p0
              .map(
                (e) => (
                  e.readTable(table),
                  $$WorkoutTemplateExerciseOverridesTableReferences(
                    db,
                    table,
                    e,
                  ),
                ),
              )
              .toList(),
          prefetchHooksCallback: ({workoutTemplateProgramId = false}) {
            return PrefetchHooks(
              db: db,
              explicitlyWatchedTables: [],
              addJoins:
                  <
                    T extends TableManagerState<
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic,
                      dynamic
                    >
                  >(state) {
                    if (workoutTemplateProgramId) {
                      state =
                          state.withJoin(
                                currentTable: table,
                                currentColumn: table.workoutTemplateProgramId,
                                referencedTable:
                                    $$WorkoutTemplateExerciseOverridesTableReferences
                                        ._workoutTemplateProgramIdTable(db),
                                referencedColumn:
                                    $$WorkoutTemplateExerciseOverridesTableReferences
                                        ._workoutTemplateProgramIdTable(db)
                                        .id,
                              )
                              as T;
                    }

                    return state;
                  },
              getPrefetchedDataCallback: (items) async {
                return [];
              },
            );
          },
        ),
      );
}

typedef $$WorkoutTemplateExerciseOverridesTableProcessedTableManager =
    ProcessedTableManager<
      _$AppDatabase,
      $WorkoutTemplateExerciseOverridesTable,
      WorkoutTemplateExerciseOverride,
      $$WorkoutTemplateExerciseOverridesTableFilterComposer,
      $$WorkoutTemplateExerciseOverridesTableOrderingComposer,
      $$WorkoutTemplateExerciseOverridesTableAnnotationComposer,
      $$WorkoutTemplateExerciseOverridesTableCreateCompanionBuilder,
      $$WorkoutTemplateExerciseOverridesTableUpdateCompanionBuilder,
      (
        WorkoutTemplateExerciseOverride,
        $$WorkoutTemplateExerciseOverridesTableReferences,
      ),
      WorkoutTemplateExerciseOverride,
      PrefetchHooks Function({bool workoutTemplateProgramId})
    >;

class $AppDatabaseManager {
  final _$AppDatabase _db;
  $AppDatabaseManager(this._db);
  $$WorkoutTemplatesTableTableManager get workoutTemplates =>
      $$WorkoutTemplatesTableTableManager(_db, _db.workoutTemplates);
  $$ActiveWorkoutSessionsTableTableManager get activeWorkoutSessions =>
      $$ActiveWorkoutSessionsTableTableManager(_db, _db.activeWorkoutSessions);
  $$ActiveExerciseStepProgressStatesTableTableManager
  get activeExerciseStepProgressStates =>
      $$ActiveExerciseStepProgressStatesTableTableManager(
        _db,
        _db.activeExerciseStepProgressStates,
      );
  $$ActiveExerciseStepResultsTableTableManager get activeExerciseStepResults =>
      $$ActiveExerciseStepResultsTableTableManager(
        _db,
        _db.activeExerciseStepResults,
      );
  $$ActiveRestStatesTableTableManager get activeRestStates =>
      $$ActiveRestStatesTableTableManager(_db, _db.activeRestStates);
  $$ActiveScoreStopwatchStatesTableTableManager
  get activeScoreStopwatchStates =>
      $$ActiveScoreStopwatchStatesTableTableManager(
        _db,
        _db.activeScoreStopwatchStates,
      );
  $$ActiveSetTimerStatesTableTableManager get activeSetTimerStates =>
      $$ActiveSetTimerStatesTableTableManager(_db, _db.activeSetTimerStates);
  $$ActiveSetResultsTableTableManager get activeSetResults =>
      $$ActiveSetResultsTableTableManager(_db, _db.activeSetResults);
  $$ChangeLogEntriesTableTableManager get changeLogEntries =>
      $$ChangeLogEntriesTableTableManager(_db, _db.changeLogEntries);
  $$MediaAssetsTableTableManager get mediaAssets =>
      $$MediaAssetsTableTableManager(_db, _db.mediaAssets);
  $$ExercisesTableTableManager get exercises =>
      $$ExercisesTableTableManager(_db, _db.exercises);
  $$ExerciseImagesTableTableManager get exerciseImages =>
      $$ExerciseImagesTableTableManager(_db, _db.exerciseImages);
  $$ExerciseStepsTableTableManager get exerciseSteps =>
      $$ExerciseStepsTableTableManager(_db, _db.exerciseSteps);
  $$LocalSeedMetadataTableTableManager get localSeedMetadata =>
      $$LocalSeedMetadataTableTableManager(_db, _db.localSeedMetadata);
  $$OnlineAccountSessionsTableTableManager get onlineAccountSessions =>
      $$OnlineAccountSessionsTableTableManager(_db, _db.onlineAccountSessions);
  $$PendingShareActionsTableTableManager get pendingShareActions =>
      $$PendingShareActionsTableTableManager(_db, _db.pendingShareActions);
  $$ProgramsTableTableManager get programs =>
      $$ProgramsTableTableManager(_db, _db.programs);
  $$ProgramExercisesTableTableManager get programExercises =>
      $$ProgramExercisesTableTableManager(_db, _db.programExercises);
  $$RemoteResourceMappingsTableTableManager get remoteResourceMappings =>
      $$RemoteResourceMappingsTableTableManager(
        _db,
        _db.remoteResourceMappings,
      );
  $$ShareInboxItemsTableTableManager get shareInboxItems =>
      $$ShareInboxItemsTableTableManager(_db, _db.shareInboxItems);
  $$SyncMetadataEntriesTableTableManager get syncMetadataEntries =>
      $$SyncMetadataEntriesTableTableManager(_db, _db.syncMetadataEntries);
  $$WorkoutHistoriesTableTableManager get workoutHistories =>
      $$WorkoutHistoriesTableTableManager(_db, _db.workoutHistories);
  $$WorkoutHistorySetResultsTableTableManager get workoutHistorySetResults =>
      $$WorkoutHistorySetResultsTableTableManager(
        _db,
        _db.workoutHistorySetResults,
      );
  $$WorkoutHistoryStepResultsTableTableManager get workoutHistoryStepResults =>
      $$WorkoutHistoryStepResultsTableTableManager(
        _db,
        _db.workoutHistoryStepResults,
      );
  $$WorkoutTemplateProgramsTableTableManager get workoutTemplatePrograms =>
      $$WorkoutTemplateProgramsTableTableManager(
        _db,
        _db.workoutTemplatePrograms,
      );
  $$WorkoutTemplateExerciseOverridesTableTableManager
  get workoutTemplateExerciseOverrides =>
      $$WorkoutTemplateExerciseOverridesTableTableManager(
        _db,
        _db.workoutTemplateExerciseOverrides,
      );
}
