// dart format width=80
// GENERATED BY drift_dev, DO NOT MODIFY.
// ignore_for_file: type=lint,unused_import
//
import 'package:drift/drift.dart';

class Rooms extends Table with TableInfo<Rooms, RoomsData> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  Rooms(this.attachedDatabase, [this._alias]);
  late final GeneratedColumn<int> id = GeneratedColumn<int>(
    'id',
    aliasedName,
    false,
    hasAutoIncrement: true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT',
  );
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<String> iconName = GeneratedColumn<String>(
    'icon_name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
    'sort_order',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NOT NULL DEFAULT 0',
    defaultValue: const CustomExpression('0'),
  );
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    name,
    iconName,
    sortOrder,
    createdAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'rooms';
  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  RoomsData map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return RoomsData(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}id'],
      )!,
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      iconName: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}icon_name'],
      )!,
      sortOrder: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}sort_order'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
    );
  }

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

  @override
  bool get dontWriteConstraints => true;
}

class RoomsData extends DataClass implements Insertable<RoomsData> {
  final int id;
  final String name;
  final String iconName;
  final int sortOrder;
  final int createdAt;
  const RoomsData({
    required this.id,
    required this.name,
    required this.iconName,
    required this.sortOrder,
    required this.createdAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<int>(id);
    map['name'] = Variable<String>(name);
    map['icon_name'] = Variable<String>(iconName);
    map['sort_order'] = Variable<int>(sortOrder);
    map['created_at'] = Variable<int>(createdAt);
    return map;
  }

  RoomsCompanion toCompanion(bool nullToAbsent) {
    return RoomsCompanion(
      id: Value(id),
      name: Value(name),
      iconName: Value(iconName),
      sortOrder: Value(sortOrder),
      createdAt: Value(createdAt),
    );
  }

  factory RoomsData.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return RoomsData(
      id: serializer.fromJson<int>(json['id']),
      name: serializer.fromJson<String>(json['name']),
      iconName: serializer.fromJson<String>(json['iconName']),
      sortOrder: serializer.fromJson<int>(json['sortOrder']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<int>(id),
      'name': serializer.toJson<String>(name),
      'iconName': serializer.toJson<String>(iconName),
      'sortOrder': serializer.toJson<int>(sortOrder),
      'createdAt': serializer.toJson<int>(createdAt),
    };
  }

  RoomsData copyWith({
    int? id,
    String? name,
    String? iconName,
    int? sortOrder,
    int? createdAt,
  }) => RoomsData(
    id: id ?? this.id,
    name: name ?? this.name,
    iconName: iconName ?? this.iconName,
    sortOrder: sortOrder ?? this.sortOrder,
    createdAt: createdAt ?? this.createdAt,
  );
  RoomsData copyWithCompanion(RoomsCompanion data) {
    return RoomsData(
      id: data.id.present ? data.id.value : this.id,
      name: data.name.present ? data.name.value : this.name,
      iconName: data.iconName.present ? data.iconName.value : this.iconName,
      sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('RoomsData(')
          ..write('id: $id, ')
          ..write('name: $name, ')
          ..write('iconName: $iconName, ')
          ..write('sortOrder: $sortOrder, ')
          ..write('createdAt: $createdAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(id, name, iconName, sortOrder, createdAt);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is RoomsData &&
          other.id == this.id &&
          other.name == this.name &&
          other.iconName == this.iconName &&
          other.sortOrder == this.sortOrder &&
          other.createdAt == this.createdAt);
}

class RoomsCompanion extends UpdateCompanion<RoomsData> {
  final Value<int> id;
  final Value<String> name;
  final Value<String> iconName;
  final Value<int> sortOrder;
  final Value<int> createdAt;
  const RoomsCompanion({
    this.id = const Value.absent(),
    this.name = const Value.absent(),
    this.iconName = const Value.absent(),
    this.sortOrder = const Value.absent(),
    this.createdAt = const Value.absent(),
  });
  RoomsCompanion.insert({
    this.id = const Value.absent(),
    required String name,
    required String iconName,
    this.sortOrder = const Value.absent(),
    required int createdAt,
  }) : name = Value(name),
       iconName = Value(iconName),
       createdAt = Value(createdAt);
  static Insertable<RoomsData> custom({
    Expression<int>? id,
    Expression<String>? name,
    Expression<String>? iconName,
    Expression<int>? sortOrder,
    Expression<int>? createdAt,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (name != null) 'name': name,
      if (iconName != null) 'icon_name': iconName,
      if (sortOrder != null) 'sort_order': sortOrder,
      if (createdAt != null) 'created_at': createdAt,
    });
  }

  RoomsCompanion copyWith({
    Value<int>? id,
    Value<String>? name,
    Value<String>? iconName,
    Value<int>? sortOrder,
    Value<int>? createdAt,
  }) {
    return RoomsCompanion(
      id: id ?? this.id,
      name: name ?? this.name,
      iconName: iconName ?? this.iconName,
      sortOrder: sortOrder ?? this.sortOrder,
      createdAt: createdAt ?? this.createdAt,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<int>(id.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (iconName.present) {
      map['icon_name'] = Variable<String>(iconName.value);
    }
    if (sortOrder.present) {
      map['sort_order'] = Variable<int>(sortOrder.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('RoomsCompanion(')
          ..write('id: $id, ')
          ..write('name: $name, ')
          ..write('iconName: $iconName, ')
          ..write('sortOrder: $sortOrder, ')
          ..write('createdAt: $createdAt')
          ..write(')'))
        .toString();
  }
}

class Tasks extends Table with TableInfo<Tasks, TasksData> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  Tasks(this.attachedDatabase, [this._alias]);
  late final GeneratedColumn<int> id = GeneratedColumn<int>(
    'id',
    aliasedName,
    false,
    hasAutoIncrement: true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT',
  );
  late final GeneratedColumn<int> roomId = GeneratedColumn<int>(
    'room_id',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL REFERENCES rooms(id)',
  );
  late final GeneratedColumn<String> name = GeneratedColumn<String>(
    'name',
    aliasedName,
    false,
    type: DriftSqlType.string,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<String> description = GeneratedColumn<String>(
    'description',
    aliasedName,
    true,
    type: DriftSqlType.string,
    requiredDuringInsert: false,
    $customConstraints: 'NULL',
  );
  late final GeneratedColumn<int> intervalType = GeneratedColumn<int>(
    'interval_type',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<int> intervalDays = GeneratedColumn<int>(
    'interval_days',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NOT NULL DEFAULT 1',
    defaultValue: const CustomExpression('1'),
  );
  late final GeneratedColumn<int> anchorDay = GeneratedColumn<int>(
    'anchor_day',
    aliasedName,
    true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NULL',
  );
  late final GeneratedColumn<int> effortLevel = GeneratedColumn<int>(
    'effort_level',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<int> nextDueDate = GeneratedColumn<int>(
    'next_due_date',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  late final GeneratedColumn<int> createdAt = GeneratedColumn<int>(
    'created_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  @override
  List<GeneratedColumn> get $columns => [
    id,
    roomId,
    name,
    description,
    intervalType,
    intervalDays,
    anchorDay,
    effortLevel,
    nextDueDate,
    createdAt,
  ];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'tasks';
  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  TasksData map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return TasksData(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}id'],
      )!,
      roomId: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}room_id'],
      )!,
      name: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}name'],
      )!,
      description: attachedDatabase.typeMapping.read(
        DriftSqlType.string,
        data['${effectivePrefix}description'],
      ),
      intervalType: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}interval_type'],
      )!,
      intervalDays: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}interval_days'],
      )!,
      anchorDay: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}anchor_day'],
      ),
      effortLevel: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}effort_level'],
      )!,
      nextDueDate: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}next_due_date'],
      )!,
      createdAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}created_at'],
      )!,
    );
  }

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

  @override
  bool get dontWriteConstraints => true;
}

class TasksData extends DataClass implements Insertable<TasksData> {
  final int id;
  final int roomId;
  final String name;
  final String? description;
  final int intervalType;
  final int intervalDays;
  final int? anchorDay;
  final int effortLevel;
  final int nextDueDate;
  final int createdAt;
  const TasksData({
    required this.id,
    required this.roomId,
    required this.name,
    this.description,
    required this.intervalType,
    required this.intervalDays,
    this.anchorDay,
    required this.effortLevel,
    required this.nextDueDate,
    required this.createdAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<int>(id);
    map['room_id'] = Variable<int>(roomId);
    map['name'] = Variable<String>(name);
    if (!nullToAbsent || description != null) {
      map['description'] = Variable<String>(description);
    }
    map['interval_type'] = Variable<int>(intervalType);
    map['interval_days'] = Variable<int>(intervalDays);
    if (!nullToAbsent || anchorDay != null) {
      map['anchor_day'] = Variable<int>(anchorDay);
    }
    map['effort_level'] = Variable<int>(effortLevel);
    map['next_due_date'] = Variable<int>(nextDueDate);
    map['created_at'] = Variable<int>(createdAt);
    return map;
  }

  TasksCompanion toCompanion(bool nullToAbsent) {
    return TasksCompanion(
      id: Value(id),
      roomId: Value(roomId),
      name: Value(name),
      description: description == null && nullToAbsent
          ? const Value.absent()
          : Value(description),
      intervalType: Value(intervalType),
      intervalDays: Value(intervalDays),
      anchorDay: anchorDay == null && nullToAbsent
          ? const Value.absent()
          : Value(anchorDay),
      effortLevel: Value(effortLevel),
      nextDueDate: Value(nextDueDate),
      createdAt: Value(createdAt),
    );
  }

  factory TasksData.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return TasksData(
      id: serializer.fromJson<int>(json['id']),
      roomId: serializer.fromJson<int>(json['roomId']),
      name: serializer.fromJson<String>(json['name']),
      description: serializer.fromJson<String?>(json['description']),
      intervalType: serializer.fromJson<int>(json['intervalType']),
      intervalDays: serializer.fromJson<int>(json['intervalDays']),
      anchorDay: serializer.fromJson<int?>(json['anchorDay']),
      effortLevel: serializer.fromJson<int>(json['effortLevel']),
      nextDueDate: serializer.fromJson<int>(json['nextDueDate']),
      createdAt: serializer.fromJson<int>(json['createdAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<int>(id),
      'roomId': serializer.toJson<int>(roomId),
      'name': serializer.toJson<String>(name),
      'description': serializer.toJson<String?>(description),
      'intervalType': serializer.toJson<int>(intervalType),
      'intervalDays': serializer.toJson<int>(intervalDays),
      'anchorDay': serializer.toJson<int?>(anchorDay),
      'effortLevel': serializer.toJson<int>(effortLevel),
      'nextDueDate': serializer.toJson<int>(nextDueDate),
      'createdAt': serializer.toJson<int>(createdAt),
    };
  }

  TasksData copyWith({
    int? id,
    int? roomId,
    String? name,
    Value<String?> description = const Value.absent(),
    int? intervalType,
    int? intervalDays,
    Value<int?> anchorDay = const Value.absent(),
    int? effortLevel,
    int? nextDueDate,
    int? createdAt,
  }) => TasksData(
    id: id ?? this.id,
    roomId: roomId ?? this.roomId,
    name: name ?? this.name,
    description: description.present ? description.value : this.description,
    intervalType: intervalType ?? this.intervalType,
    intervalDays: intervalDays ?? this.intervalDays,
    anchorDay: anchorDay.present ? anchorDay.value : this.anchorDay,
    effortLevel: effortLevel ?? this.effortLevel,
    nextDueDate: nextDueDate ?? this.nextDueDate,
    createdAt: createdAt ?? this.createdAt,
  );
  TasksData copyWithCompanion(TasksCompanion data) {
    return TasksData(
      id: data.id.present ? data.id.value : this.id,
      roomId: data.roomId.present ? data.roomId.value : this.roomId,
      name: data.name.present ? data.name.value : this.name,
      description: data.description.present
          ? data.description.value
          : this.description,
      intervalType: data.intervalType.present
          ? data.intervalType.value
          : this.intervalType,
      intervalDays: data.intervalDays.present
          ? data.intervalDays.value
          : this.intervalDays,
      anchorDay: data.anchorDay.present ? data.anchorDay.value : this.anchorDay,
      effortLevel: data.effortLevel.present
          ? data.effortLevel.value
          : this.effortLevel,
      nextDueDate: data.nextDueDate.present
          ? data.nextDueDate.value
          : this.nextDueDate,
      createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('TasksData(')
          ..write('id: $id, ')
          ..write('roomId: $roomId, ')
          ..write('name: $name, ')
          ..write('description: $description, ')
          ..write('intervalType: $intervalType, ')
          ..write('intervalDays: $intervalDays, ')
          ..write('anchorDay: $anchorDay, ')
          ..write('effortLevel: $effortLevel, ')
          ..write('nextDueDate: $nextDueDate, ')
          ..write('createdAt: $createdAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(
    id,
    roomId,
    name,
    description,
    intervalType,
    intervalDays,
    anchorDay,
    effortLevel,
    nextDueDate,
    createdAt,
  );
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is TasksData &&
          other.id == this.id &&
          other.roomId == this.roomId &&
          other.name == this.name &&
          other.description == this.description &&
          other.intervalType == this.intervalType &&
          other.intervalDays == this.intervalDays &&
          other.anchorDay == this.anchorDay &&
          other.effortLevel == this.effortLevel &&
          other.nextDueDate == this.nextDueDate &&
          other.createdAt == this.createdAt);
}

class TasksCompanion extends UpdateCompanion<TasksData> {
  final Value<int> id;
  final Value<int> roomId;
  final Value<String> name;
  final Value<String?> description;
  final Value<int> intervalType;
  final Value<int> intervalDays;
  final Value<int?> anchorDay;
  final Value<int> effortLevel;
  final Value<int> nextDueDate;
  final Value<int> createdAt;
  const TasksCompanion({
    this.id = const Value.absent(),
    this.roomId = const Value.absent(),
    this.name = const Value.absent(),
    this.description = const Value.absent(),
    this.intervalType = const Value.absent(),
    this.intervalDays = const Value.absent(),
    this.anchorDay = const Value.absent(),
    this.effortLevel = const Value.absent(),
    this.nextDueDate = const Value.absent(),
    this.createdAt = const Value.absent(),
  });
  TasksCompanion.insert({
    this.id = const Value.absent(),
    required int roomId,
    required String name,
    this.description = const Value.absent(),
    required int intervalType,
    this.intervalDays = const Value.absent(),
    this.anchorDay = const Value.absent(),
    required int effortLevel,
    required int nextDueDate,
    required int createdAt,
  }) : roomId = Value(roomId),
       name = Value(name),
       intervalType = Value(intervalType),
       effortLevel = Value(effortLevel),
       nextDueDate = Value(nextDueDate),
       createdAt = Value(createdAt);
  static Insertable<TasksData> custom({
    Expression<int>? id,
    Expression<int>? roomId,
    Expression<String>? name,
    Expression<String>? description,
    Expression<int>? intervalType,
    Expression<int>? intervalDays,
    Expression<int>? anchorDay,
    Expression<int>? effortLevel,
    Expression<int>? nextDueDate,
    Expression<int>? createdAt,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (roomId != null) 'room_id': roomId,
      if (name != null) 'name': name,
      if (description != null) 'description': description,
      if (intervalType != null) 'interval_type': intervalType,
      if (intervalDays != null) 'interval_days': intervalDays,
      if (anchorDay != null) 'anchor_day': anchorDay,
      if (effortLevel != null) 'effort_level': effortLevel,
      if (nextDueDate != null) 'next_due_date': nextDueDate,
      if (createdAt != null) 'created_at': createdAt,
    });
  }

  TasksCompanion copyWith({
    Value<int>? id,
    Value<int>? roomId,
    Value<String>? name,
    Value<String?>? description,
    Value<int>? intervalType,
    Value<int>? intervalDays,
    Value<int?>? anchorDay,
    Value<int>? effortLevel,
    Value<int>? nextDueDate,
    Value<int>? createdAt,
  }) {
    return TasksCompanion(
      id: id ?? this.id,
      roomId: roomId ?? this.roomId,
      name: name ?? this.name,
      description: description ?? this.description,
      intervalType: intervalType ?? this.intervalType,
      intervalDays: intervalDays ?? this.intervalDays,
      anchorDay: anchorDay ?? this.anchorDay,
      effortLevel: effortLevel ?? this.effortLevel,
      nextDueDate: nextDueDate ?? this.nextDueDate,
      createdAt: createdAt ?? this.createdAt,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<int>(id.value);
    }
    if (roomId.present) {
      map['room_id'] = Variable<int>(roomId.value);
    }
    if (name.present) {
      map['name'] = Variable<String>(name.value);
    }
    if (description.present) {
      map['description'] = Variable<String>(description.value);
    }
    if (intervalType.present) {
      map['interval_type'] = Variable<int>(intervalType.value);
    }
    if (intervalDays.present) {
      map['interval_days'] = Variable<int>(intervalDays.value);
    }
    if (anchorDay.present) {
      map['anchor_day'] = Variable<int>(anchorDay.value);
    }
    if (effortLevel.present) {
      map['effort_level'] = Variable<int>(effortLevel.value);
    }
    if (nextDueDate.present) {
      map['next_due_date'] = Variable<int>(nextDueDate.value);
    }
    if (createdAt.present) {
      map['created_at'] = Variable<int>(createdAt.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('TasksCompanion(')
          ..write('id: $id, ')
          ..write('roomId: $roomId, ')
          ..write('name: $name, ')
          ..write('description: $description, ')
          ..write('intervalType: $intervalType, ')
          ..write('intervalDays: $intervalDays, ')
          ..write('anchorDay: $anchorDay, ')
          ..write('effortLevel: $effortLevel, ')
          ..write('nextDueDate: $nextDueDate, ')
          ..write('createdAt: $createdAt')
          ..write(')'))
        .toString();
  }
}

class TaskCompletions extends Table
    with TableInfo<TaskCompletions, TaskCompletionsData> {
  @override
  final GeneratedDatabase attachedDatabase;
  final String? _alias;
  TaskCompletions(this.attachedDatabase, [this._alias]);
  late final GeneratedColumn<int> id = GeneratedColumn<int>(
    'id',
    aliasedName,
    false,
    hasAutoIncrement: true,
    type: DriftSqlType.int,
    requiredDuringInsert: false,
    $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT',
  );
  late final GeneratedColumn<int> taskId = GeneratedColumn<int>(
    'task_id',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL REFERENCES tasks(id)',
  );
  late final GeneratedColumn<int> completedAt = GeneratedColumn<int>(
    'completed_at',
    aliasedName,
    false,
    type: DriftSqlType.int,
    requiredDuringInsert: true,
    $customConstraints: 'NOT NULL',
  );
  @override
  List<GeneratedColumn> get $columns => [id, taskId, completedAt];
  @override
  String get aliasedName => _alias ?? actualTableName;
  @override
  String get actualTableName => $name;
  static const String $name = 'task_completions';
  @override
  Set<GeneratedColumn> get $primaryKey => {id};
  @override
  TaskCompletionsData map(Map<String, dynamic> data, {String? tablePrefix}) {
    final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
    return TaskCompletionsData(
      id: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}id'],
      )!,
      taskId: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}task_id'],
      )!,
      completedAt: attachedDatabase.typeMapping.read(
        DriftSqlType.int,
        data['${effectivePrefix}completed_at'],
      )!,
    );
  }

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

  @override
  bool get dontWriteConstraints => true;
}

class TaskCompletionsData extends DataClass
    implements Insertable<TaskCompletionsData> {
  final int id;
  final int taskId;
  final int completedAt;
  const TaskCompletionsData({
    required this.id,
    required this.taskId,
    required this.completedAt,
  });
  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    map['id'] = Variable<int>(id);
    map['task_id'] = Variable<int>(taskId);
    map['completed_at'] = Variable<int>(completedAt);
    return map;
  }

  TaskCompletionsCompanion toCompanion(bool nullToAbsent) {
    return TaskCompletionsCompanion(
      id: Value(id),
      taskId: Value(taskId),
      completedAt: Value(completedAt),
    );
  }

  factory TaskCompletionsData.fromJson(
    Map<String, dynamic> json, {
    ValueSerializer? serializer,
  }) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return TaskCompletionsData(
      id: serializer.fromJson<int>(json['id']),
      taskId: serializer.fromJson<int>(json['taskId']),
      completedAt: serializer.fromJson<int>(json['completedAt']),
    );
  }
  @override
  Map<String, dynamic> toJson({ValueSerializer? serializer}) {
    serializer ??= driftRuntimeOptions.defaultSerializer;
    return <String, dynamic>{
      'id': serializer.toJson<int>(id),
      'taskId': serializer.toJson<int>(taskId),
      'completedAt': serializer.toJson<int>(completedAt),
    };
  }

  TaskCompletionsData copyWith({int? id, int? taskId, int? completedAt}) =>
      TaskCompletionsData(
        id: id ?? this.id,
        taskId: taskId ?? this.taskId,
        completedAt: completedAt ?? this.completedAt,
      );
  TaskCompletionsData copyWithCompanion(TaskCompletionsCompanion data) {
    return TaskCompletionsData(
      id: data.id.present ? data.id.value : this.id,
      taskId: data.taskId.present ? data.taskId.value : this.taskId,
      completedAt: data.completedAt.present
          ? data.completedAt.value
          : this.completedAt,
    );
  }

  @override
  String toString() {
    return (StringBuffer('TaskCompletionsData(')
          ..write('id: $id, ')
          ..write('taskId: $taskId, ')
          ..write('completedAt: $completedAt')
          ..write(')'))
        .toString();
  }

  @override
  int get hashCode => Object.hash(id, taskId, completedAt);
  @override
  bool operator ==(Object other) =>
      identical(this, other) ||
      (other is TaskCompletionsData &&
          other.id == this.id &&
          other.taskId == this.taskId &&
          other.completedAt == this.completedAt);
}

class TaskCompletionsCompanion extends UpdateCompanion<TaskCompletionsData> {
  final Value<int> id;
  final Value<int> taskId;
  final Value<int> completedAt;
  const TaskCompletionsCompanion({
    this.id = const Value.absent(),
    this.taskId = const Value.absent(),
    this.completedAt = const Value.absent(),
  });
  TaskCompletionsCompanion.insert({
    this.id = const Value.absent(),
    required int taskId,
    required int completedAt,
  }) : taskId = Value(taskId),
       completedAt = Value(completedAt);
  static Insertable<TaskCompletionsData> custom({
    Expression<int>? id,
    Expression<int>? taskId,
    Expression<int>? completedAt,
  }) {
    return RawValuesInsertable({
      if (id != null) 'id': id,
      if (taskId != null) 'task_id': taskId,
      if (completedAt != null) 'completed_at': completedAt,
    });
  }

  TaskCompletionsCompanion copyWith({
    Value<int>? id,
    Value<int>? taskId,
    Value<int>? completedAt,
  }) {
    return TaskCompletionsCompanion(
      id: id ?? this.id,
      taskId: taskId ?? this.taskId,
      completedAt: completedAt ?? this.completedAt,
    );
  }

  @override
  Map<String, Expression> toColumns(bool nullToAbsent) {
    final map = <String, Expression>{};
    if (id.present) {
      map['id'] = Variable<int>(id.value);
    }
    if (taskId.present) {
      map['task_id'] = Variable<int>(taskId.value);
    }
    if (completedAt.present) {
      map['completed_at'] = Variable<int>(completedAt.value);
    }
    return map;
  }

  @override
  String toString() {
    return (StringBuffer('TaskCompletionsCompanion(')
          ..write('id: $id, ')
          ..write('taskId: $taskId, ')
          ..write('completedAt: $completedAt')
          ..write(')'))
        .toString();
  }
}

class DatabaseAtV2 extends GeneratedDatabase {
  DatabaseAtV2(QueryExecutor e) : super(e);
  late final Rooms rooms = Rooms(this);
  late final Tasks tasks = Tasks(this);
  late final TaskCompletions taskCompletions = TaskCompletions(this);
  @override
  Iterable<TableInfo<Table, Object?>> get allTables =>
      allSchemaEntities.whereType<TableInfo<Table, Object?>>();
  @override
  List<DatabaseSchemaEntity> get allSchemaEntities => [
    rooms,
    tasks,
    taskCompletions,
  ];
  @override
  int get schemaVersion => 2;
}
