import 'package:drift/drift.dart';
import 'package:niogu_app/core/utils/string_map_converter.dart';

class SyncQueues extends Table {
  IntColumn get id => integer().autoIncrement()();
  TextColumn get tableType => text()();
  TextColumn get tableLocalId => text()();
  TextColumn get action => text()();
  TextColumn get status => text()();
  TextColumn get payload => text().map(StringMapConverter())();
  TextColumn get batchId => text().nullable()();
  TextColumn get lastError => text().nullable()();
  IntColumn get retryCount => integer().withDefault(const Constant(0))();
  DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
  DateTimeColumn get lastAttempt => dateTime().nullable()();
}
