import 'package:drift/drift.dart';
import 'package:uuid/uuid.dart';

class Outlets extends Table {
  TextColumn get localId => text().clientDefault(() => const Uuid().v7().toString())();
  TextColumn get serverId => text().nullable()();
  TextColumn get name => text()();
  TextColumn get email => text().nullable()();
  TextColumn get phoneNumber => text().nullable()();
  TextColumn get fullAddress => text().nullable()();
  RealColumn get latitude => real().nullable()();
  RealColumn get longitude => real().nullable()();
  TextColumn get localPhotoPath => text().nullable()();
  TextColumn get localBannerPath => text().nullable()();
  TextColumn get serverPhotoUrl => text().nullable()();
  TextColumn get serverBannerUrl => text().nullable()();
  BoolColumn get isMainOutlet => boolean().withDefault(const Constant(false))();
  BoolColumn get isActive => boolean().withDefault(const Constant(true))();
  TextColumn get syncStatus => text().withDefault(const Constant('dirty'))();
  DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
  DateTimeColumn get updatedAt => dateTime().withDefault(currentDateAndTime)();
  DateTimeColumn get deletedAt => dateTime().nullable()();

  @override
  Set<Column<Object>>? get primaryKey => {localId};
}
