import 'package:drift/drift.dart';

@DataClassName('DriftChat')
class Chats extends Table {
  IntColumn get id => integer()();
  IntColumn get typ => integer().nullable()();
  IntColumn get lastId => integer().nullable()();
  IntColumn get lastTyp => integer().nullable()();
  TextColumn get lastMsg => text().nullable()();
  IntColumn get lastTime => integer().nullable()();
  IntColumn get lastPos => integer().withDefault(const Constant(0))();
  IntColumn get firstPos => integer().withDefault(const Constant(-1))();
  IntColumn get msgIdx => integer().nullable()();
  TextColumn get profile => text().nullable()();
  TextColumn get pin => text().nullable()();
  TextColumn get icon => text().nullable()();
  TextColumn get iconGaussian => text().withDefault(const Constant(''))();
  TextColumn get name => text().nullable()();
  IntColumn get userId => integer().nullable()();
  IntColumn get chatId => integer().nullable()();
  IntColumn get friendId => integer().nullable()();
  IntColumn get sort => integer().nullable()();
  IntColumn get unreadNum => integer().nullable()();
  IntColumn get unreadCount => integer().nullable()();
  IntColumn get hideChatMsgIdx => integer().nullable()();
  IntColumn get readChatMsgIdx => integer().nullable()();
  IntColumn get otherReadIdx => integer().nullable()();
  TextColumn get unreadAtMsgIdx => text().nullable()();
  IntColumn get deleteTime => integer().nullable()();
  IntColumn get addIndex => integer().nullable()();
  IntColumn get flag => integer().withDefault(const Constant(0))();
  IntColumn get flagMy => integer().nullable()();
  IntColumn get autoDeleteInterval => integer().nullable()();
  IntColumn get mute => integer().nullable()();
  IntColumn get verified => integer().nullable()();
  IntColumn get createTime => integer().nullable()();
  IntColumn get startIdx => integer().nullable()();
  IntColumn get isReadMsg => integer().nullable()();
  TextColumn get translateOutgoing => text().withDefault(const Constant(''))();
  TextColumn get translateIncoming => text().withDefault(const Constant(''))();
  IntColumn get incomingIdx => integer().withDefault(const Constant(0))();
  IntColumn get outgoingIdx => integer().withDefault(const Constant(0))();
  IntColumn get incomingSoundId => integer().withDefault(const Constant(0))();
  IntColumn get outgoingSoundId => integer().withDefault(const Constant(0))();
  IntColumn get notificationSoundId => integer().withDefault(const Constant(0))();
  TextColumn get chatKey => text().withDefault(const Constant(''))();
  TextColumn get activeChatKey => text().withDefault(const Constant(''))();
  IntColumn get coverIdx => integer().withDefault(const Constant(0))();
  IntColumn get round => integer().withDefault(const Constant(0))();
  IntColumn get workspaceId => integer().withDefault(const Constant(0))();
  IntColumn get localPermission => integer().withDefault(const Constant(0))();

  @override
  Set<Column> get primaryKey => {id};

  @override
  String get tableName => 'chat';
}