import 'package:drift/internal/versioned_schema.dart' as i0;
import 'package:drift/drift.dart' as i1;
import 'package:drift/drift.dart'; // ignore_for_file: type=lint,unused_import

// GENERATED BY drift_dev, DO NOT MODIFY.
final class _S2 extends i0.VersionedSchema {
  _S2({required super.database}) : super(version: 2);
  @override
  late final List<i1.DatabaseSchemaEntity> entities = [
    categories,
    todoEntries,
    textEntries,
    todosInsert,
  ];
  late final Shape0 categories = Shape0(
      source: i0.VersionedTable(
        entityName: 'categories',
        withoutRowId: false,
        isStrict: false,
        tableConstraints: [],
        columns: [
          _column_0,
          _column_1,
          _column_2,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  late final Shape1 todoEntries = Shape1(
      source: i0.VersionedTable(
        entityName: 'todo_entries',
        withoutRowId: false,
        isStrict: false,
        tableConstraints: [],
        columns: [
          _column_0,
          _column_3,
          _column_4,
          _column_5,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  late final Shape2 textEntries = Shape2(
      source: i0.VersionedVirtualTable(
        entityName: 'text_entries',
        moduleAndArgs:
            'fts5(description, content=todo_entries, content_rowid=id)',
        columns: [
          _column_6,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  final i1.Trigger todosInsert = i1.Trigger(
      'CREATE TRIGGER todos_insert AFTER INSERT ON todo_entries BEGIN\n  INSERT INTO text_entries(rowid, description) VALUES (new.id, new.description);\nEND;',
      'todos_insert');
}

class Shape0 extends i0.VersionedTable {
  Shape0({required super.source, required super.alias}) : super.aliased();
  i1.GeneratedColumn<int> get id =>
      columnsByName['id']! as i1.GeneratedColumn<int>;
  i1.GeneratedColumn<String> get name =>
      columnsByName['name']! as i1.GeneratedColumn<String>;
  i1.GeneratedColumn<int> get color =>
      columnsByName['color']! as i1.GeneratedColumn<int>;
}

i1.GeneratedColumn<int> _column_0(String aliasedName) =>
    i1.GeneratedColumn<int>('id', aliasedName, false,
        hasAutoIncrement: true,
        type: i1.DriftSqlType.int,
        defaultConstraints:
            i1.GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
i1.GeneratedColumn<String> _column_1(String aliasedName) =>
    i1.GeneratedColumn<String>('name', aliasedName, false,
        type: i1.DriftSqlType.string);
i1.GeneratedColumn<int> _column_2(String aliasedName) =>
    i1.GeneratedColumn<int>('color', aliasedName, false,
        type: i1.DriftSqlType.int);

class Shape1 extends i0.VersionedTable {
  Shape1({required super.source, required super.alias}) : super.aliased();
  i1.GeneratedColumn<int> get id =>
      columnsByName['id']! as i1.GeneratedColumn<int>;
  i1.GeneratedColumn<String> get description =>
      columnsByName['description']! as i1.GeneratedColumn<String>;
  i1.GeneratedColumn<int> get category =>
      columnsByName['category']! as i1.GeneratedColumn<int>;
  i1.GeneratedColumn<DateTime> get dueDate =>
      columnsByName['due_date']! as i1.GeneratedColumn<DateTime>;
}

i1.GeneratedColumn<String> _column_3(String aliasedName) =>
    i1.GeneratedColumn<String>('description', aliasedName, false,
        type: i1.DriftSqlType.string);
i1.GeneratedColumn<int> _column_4(String aliasedName) =>
    i1.GeneratedColumn<int>('category', aliasedName, true,
        type: i1.DriftSqlType.int);
i1.GeneratedColumn<DateTime> _column_5(String aliasedName) =>
    i1.GeneratedColumn<DateTime>('due_date', aliasedName, true,
        type: i1.DriftSqlType.dateTime);

class Shape2 extends i0.VersionedVirtualTable {
  Shape2({required super.source, required super.alias}) : super.aliased();
  i1.GeneratedColumn<String> get description =>
      columnsByName['description']! as i1.GeneratedColumn<String>;
}

i1.GeneratedColumn<String> _column_6(String aliasedName) =>
    i1.GeneratedColumn<String>('description', aliasedName, false,
        type: i1.DriftSqlType.string, $customConstraints: '');

final class _S3 extends i0.VersionedSchema {
  _S3({required super.database}) : super(version: 3);
  @override
  late final List<i1.DatabaseSchemaEntity> entities = [
    categories,
    todoEntries,
    textEntries,
    todosInsert,
    todosDelete,
    todosUpdate,
  ];
  late final Shape0 categories = Shape0(
      source: i0.VersionedTable(
        entityName: 'categories',
        withoutRowId: false,
        isStrict: false,
        tableConstraints: [],
        columns: [
          _column_0,
          _column_1,
          _column_2,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  late final Shape1 todoEntries = Shape1(
      source: i0.VersionedTable(
        entityName: 'todo_entries',
        withoutRowId: false,
        isStrict: false,
        tableConstraints: [],
        columns: [
          _column_0,
          _column_3,
          _column_7,
          _column_5,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  late final Shape2 textEntries = Shape2(
      source: i0.VersionedVirtualTable(
        entityName: 'text_entries',
        moduleAndArgs:
            'fts5(description, content=todo_entries, content_rowid=id)',
        columns: [
          _column_6,
        ],
        attachedDatabase: database,
      ),
      alias: null);
  final i1.Trigger todosInsert = i1.Trigger(
      'CREATE TRIGGER todos_insert AFTER INSERT ON todo_entries BEGIN INSERT INTO text_entries ("rowid", description) VALUES (new.id, new.description);END',
      'todos_insert');
  final i1.Trigger todosDelete = i1.Trigger(
      'CREATE TRIGGER todos_delete AFTER DELETE ON todo_entries BEGIN INSERT INTO text_entries (text_entries, "rowid", description) VALUES (\'delete\', old.id, old.description);END',
      'todos_delete');
  final i1.Trigger todosUpdate = i1.Trigger(
      'CREATE TRIGGER todos_update AFTER UPDATE ON todo_entries BEGIN INSERT INTO text_entries (text_entries, "rowid", description) VALUES (\'delete\', new.id, new.description);INSERT INTO text_entries ("rowid", description) VALUES (new.id, new.description);END',
      'todos_update');
}

i1.GeneratedColumn<int> _column_7(String aliasedName) =>
    i1.GeneratedColumn<int>('category', aliasedName, true,
        type: i1.DriftSqlType.int,
        defaultConstraints: i1.GeneratedColumn.constraintIsAlways(
            'REFERENCES categories (id)'));
i0.MigrationStepWithVersion migrationSteps({
  required Future<void> Function(i1.Migrator m, _S2 schema) from1To2,
  required Future<void> Function(i1.Migrator m, _S3 schema) from2To3,
}) {
  return (currentVersion, database) async {
    switch (currentVersion) {
      case 1:
        final schema = _S2(database: database);
        final migrator = i1.Migrator(database, schema);
        await from1To2(migrator, schema);
        return 2;
      case 2:
        final schema = _S3(database: database);
        final migrator = i1.Migrator(database, schema);
        await from2To3(migrator, schema);
        return 3;
      default:
        throw ArgumentError.value('Unknown migration from $currentVersion');
    }
  };
}

i1.OnUpgrade stepByStep({
  required Future<void> Function(i1.Migrator m, _S2 schema) from1To2,
  required Future<void> Function(i1.Migrator m, _S3 schema) from2To3,
}) =>
    i0.VersionedSchema.stepByStepHelper(
        step: migrationSteps(
      from1To2: from1To2,
      from2To3: from2To3,
    ));
