// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class $UsersTable extends Users with TableInfo<$UsersTable, User> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UsersTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _externalUserIdMeta = const VerificationMeta('externalUserId'); @override late final GeneratedColumn externalUserId = GeneratedColumn( 'external_user_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _emailMeta = const VerificationMeta('email'); @override late final GeneratedColumn email = GeneratedColumn( 'email', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _adminMeta = const VerificationMeta('admin'); @override late final GeneratedColumn admin = GeneratedColumn( 'admin', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("admin" IN (0, 1))'), defaultValue: const Constant(false)); static const VerificationMeta _userSettingsMeta = const VerificationMeta('userSettings'); @override late final GeneratedColumn userSettings = GeneratedColumn( 'user_settings', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _purchasesMeta = const VerificationMeta('purchases'); @override late final GeneratedColumnWithTypeConverter, String> purchases = GeneratedColumn('purchases', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($UsersTable.$converterpurchases); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, externalUserId, name, email, admin, userSettings, purchases, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'users'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('external_user_id')) { context.handle( _externalUserIdMeta, externalUserId.isAcceptableOrUnknown( data['external_user_id']!, _externalUserIdMeta)); } else if (isInserting) { context.missing(_externalUserIdMeta); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } if (data.containsKey('email')) { context.handle( _emailMeta, email.isAcceptableOrUnknown(data['email']!, _emailMeta)); } if (data.containsKey('admin')) { context.handle( _adminMeta, admin.isAcceptableOrUnknown(data['admin']!, _adminMeta)); } if (data.containsKey('user_settings')) { context.handle( _userSettingsMeta, userSettings.isAcceptableOrUnknown( data['user_settings']!, _userSettingsMeta)); } context.handle(_purchasesMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override User map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return User( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, externalUserId: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}external_user_id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name']), email: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}email']), admin: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}admin'])!, userSettings: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}user_settings']), purchases: $UsersTable.$converterpurchases.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}purchases'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $UsersTable createAlias(String alias) { return $UsersTable(attachedDatabase, alias); } static TypeConverter, String> $converterpurchases = const StringListConverter(); } class User extends DataClass implements Insertable { final int id; final String externalUserId; final String? name; final String? email; final bool admin; final String? userSettings; final List purchases; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const User( {required this.id, required this.externalUserId, this.name, this.email, required this.admin, this.userSettings, required this.purchases, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['external_user_id'] = Variable(externalUserId); if (!nullToAbsent || name != null) { map['name'] = Variable(name); } if (!nullToAbsent || email != null) { map['email'] = Variable(email); } map['admin'] = Variable(admin); if (!nullToAbsent || userSettings != null) { map['user_settings'] = Variable(userSettings); } { map['purchases'] = Variable($UsersTable.$converterpurchases.toSql(purchases)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } UsersCompanion toCompanion(bool nullToAbsent) { return UsersCompanion( id: Value(id), externalUserId: Value(externalUserId), name: name == null && nullToAbsent ? const Value.absent() : Value(name), email: email == null && nullToAbsent ? const Value.absent() : Value(email), admin: Value(admin), userSettings: userSettings == null && nullToAbsent ? const Value.absent() : Value(userSettings), purchases: Value(purchases), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory User.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return User( id: serializer.fromJson(json['id']), externalUserId: serializer.fromJson(json['externalUserId']), name: serializer.fromJson(json['name']), email: serializer.fromJson(json['email']), admin: serializer.fromJson(json['admin']), userSettings: serializer.fromJson(json['userSettings']), purchases: serializer.fromJson>(json['purchases']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'externalUserId': serializer.toJson(externalUserId), 'name': serializer.toJson(name), 'email': serializer.toJson(email), 'admin': serializer.toJson(admin), 'userSettings': serializer.toJson(userSettings), 'purchases': serializer.toJson>(purchases), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } User copyWith( {int? id, String? externalUserId, Value name = const Value.absent(), Value email = const Value.absent(), bool? admin, Value userSettings = const Value.absent(), List? purchases, DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => User( id: id ?? this.id, externalUserId: externalUserId ?? this.externalUserId, name: name.present ? name.value : this.name, email: email.present ? email.value : this.email, admin: admin ?? this.admin, userSettings: userSettings.present ? userSettings.value : this.userSettings, purchases: purchases ?? this.purchases, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('User(') ..write('id: $id, ') ..write('externalUserId: $externalUserId, ') ..write('name: $name, ') ..write('email: $email, ') ..write('admin: $admin, ') ..write('userSettings: $userSettings, ') ..write('purchases: $purchases, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, externalUserId, name, email, admin, userSettings, purchases, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is User && other.id == this.id && other.externalUserId == this.externalUserId && other.name == this.name && other.email == this.email && other.admin == this.admin && other.userSettings == this.userSettings && other.purchases == this.purchases && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class UsersCompanion extends UpdateCompanion { final Value id; final Value externalUserId; final Value name; final Value email; final Value admin; final Value userSettings; final Value> purchases; final Value createdAt; final Value updatedAt; final Value isDeleted; const UsersCompanion({ this.id = const Value.absent(), this.externalUserId = const Value.absent(), this.name = const Value.absent(), this.email = const Value.absent(), this.admin = const Value.absent(), this.userSettings = const Value.absent(), this.purchases = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); UsersCompanion.insert({ this.id = const Value.absent(), required String externalUserId, this.name = const Value.absent(), this.email = const Value.absent(), this.admin = const Value.absent(), this.userSettings = const Value.absent(), this.purchases = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : externalUserId = Value(externalUserId); static Insertable custom({ Expression? id, Expression? externalUserId, Expression? name, Expression? email, Expression? admin, Expression? userSettings, Expression? purchases, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (externalUserId != null) 'external_user_id': externalUserId, if (name != null) 'name': name, if (email != null) 'email': email, if (admin != null) 'admin': admin, if (userSettings != null) 'user_settings': userSettings, if (purchases != null) 'purchases': purchases, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } UsersCompanion copyWith( {Value? id, Value? externalUserId, Value? name, Value? email, Value? admin, Value? userSettings, Value>? purchases, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return UsersCompanion( id: id ?? this.id, externalUserId: externalUserId ?? this.externalUserId, name: name ?? this.name, email: email ?? this.email, admin: admin ?? this.admin, userSettings: userSettings ?? this.userSettings, purchases: purchases ?? this.purchases, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (externalUserId.present) { map['external_user_id'] = Variable(externalUserId.value); } if (name.present) { map['name'] = Variable(name.value); } if (email.present) { map['email'] = Variable(email.value); } if (admin.present) { map['admin'] = Variable(admin.value); } if (userSettings.present) { map['user_settings'] = Variable(userSettings.value); } if (purchases.present) { map['purchases'] = Variable( $UsersTable.$converterpurchases.toSql(purchases.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('UsersCompanion(') ..write('id: $id, ') ..write('externalUserId: $externalUserId, ') ..write('name: $name, ') ..write('email: $email, ') ..write('admin: $admin, ') ..write('userSettings: $userSettings, ') ..write('purchases: $purchases, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $UserDatasTable extends UserDatas with TableInfo<$UserDatasTable, UserData> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserDatasTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'UNIQUE REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _totalStudyTimeMinutesMeta = const VerificationMeta('totalStudyTimeMinutes'); @override late final GeneratedColumn totalStudyTimeMinutes = GeneratedColumn( 'total_study_time_minutes', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _currentStreakMeta = const VerificationMeta('currentStreak'); @override late final GeneratedColumn currentStreak = GeneratedColumn( 'current_streak', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _longestStreakMeta = const VerificationMeta('longestStreak'); @override late final GeneratedColumn longestStreak = GeneratedColumn( 'longest_streak', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _totalCardsMeta = const VerificationMeta('totalCards'); @override late final GeneratedColumn totalCards = GeneratedColumn( 'total_cards', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _totalTestsMeta = const VerificationMeta('totalTests'); @override late final GeneratedColumn totalTests = GeneratedColumn( 'total_tests', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _lastTimeOnlineMeta = const VerificationMeta('lastTimeOnline'); @override late final GeneratedColumn lastTimeOnline = GeneratedColumn('last_time_online', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _registrationDateMeta = const VerificationMeta('registrationDate'); @override late final GeneratedColumn registrationDate = GeneratedColumn('registration_date', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _lastTestSessionTokenMeta = const VerificationMeta('lastTestSessionToken'); @override late final GeneratedColumn lastTestSessionToken = GeneratedColumn('last_test_session_token', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _wordsMeta = const VerificationMeta('words'); @override late final GeneratedColumnWithTypeConverter?, String> words = GeneratedColumn('words', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>($UserDatasTable.$converterwords); static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); @override late final GeneratedColumnWithTypeConverter, String> tags = GeneratedColumn('tags', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($UserDatasTable.$convertertags); static const VerificationMeta _packProgressMeta = const VerificationMeta('packProgress'); @override late final GeneratedColumnWithTypeConverter?, String> packProgress = GeneratedColumn( 'pack_progress', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>( $UserDatasTable.$converterpackProgress); static const VerificationMeta _studyDatesMeta = const VerificationMeta('studyDates'); @override late final GeneratedColumnWithTypeConverter?, String> studyDates = GeneratedColumn('study_dates', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>($UserDatasTable.$converterstudyDates); static const VerificationMeta _achievementsMeta = const VerificationMeta('achievements'); @override late final GeneratedColumnWithTypeConverter?, String> achievements = GeneratedColumn('achievements', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>( $UserDatasTable.$converterachievements); static const VerificationMeta _categoryMinutesMeta = const VerificationMeta('categoryMinutes'); @override late final GeneratedColumnWithTypeConverter?, String> categoryMinutes = GeneratedColumn( 'category_minutes', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('{}')) .withConverter?>( $UserDatasTable.$convertercategoryMinutes); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, userId, totalStudyTimeMinutes, currentStreak, longestStreak, totalCards, totalTests, lastTimeOnline, registrationDate, lastTestSessionToken, words, tags, packProgress, studyDates, achievements, categoryMinutes, createdAt, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_datas'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('total_study_time_minutes')) { context.handle( _totalStudyTimeMinutesMeta, totalStudyTimeMinutes.isAcceptableOrUnknown( data['total_study_time_minutes']!, _totalStudyTimeMinutesMeta)); } if (data.containsKey('current_streak')) { context.handle( _currentStreakMeta, currentStreak.isAcceptableOrUnknown( data['current_streak']!, _currentStreakMeta)); } if (data.containsKey('longest_streak')) { context.handle( _longestStreakMeta, longestStreak.isAcceptableOrUnknown( data['longest_streak']!, _longestStreakMeta)); } if (data.containsKey('total_cards')) { context.handle( _totalCardsMeta, totalCards.isAcceptableOrUnknown( data['total_cards']!, _totalCardsMeta)); } if (data.containsKey('total_tests')) { context.handle( _totalTestsMeta, totalTests.isAcceptableOrUnknown( data['total_tests']!, _totalTestsMeta)); } if (data.containsKey('last_time_online')) { context.handle( _lastTimeOnlineMeta, lastTimeOnline.isAcceptableOrUnknown( data['last_time_online']!, _lastTimeOnlineMeta)); } if (data.containsKey('registration_date')) { context.handle( _registrationDateMeta, registrationDate.isAcceptableOrUnknown( data['registration_date']!, _registrationDateMeta)); } if (data.containsKey('last_test_session_token')) { context.handle( _lastTestSessionTokenMeta, lastTestSessionToken.isAcceptableOrUnknown( data['last_test_session_token']!, _lastTestSessionTokenMeta)); } context.handle(_wordsMeta, const VerificationResult.success()); context.handle(_tagsMeta, const VerificationResult.success()); context.handle(_packProgressMeta, const VerificationResult.success()); context.handle(_studyDatesMeta, const VerificationResult.success()); context.handle(_achievementsMeta, const VerificationResult.success()); context.handle(_categoryMinutesMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserData( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, totalStudyTimeMinutes: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}total_study_time_minutes'])!, currentStreak: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}current_streak'])!, longestStreak: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}longest_streak'])!, totalCards: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}total_cards'])!, totalTests: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}total_tests'])!, lastTimeOnline: attachedDatabase.typeMapping.read( DriftSqlType.dateTime, data['${effectivePrefix}last_time_online']), registrationDate: attachedDatabase.typeMapping.read( DriftSqlType.dateTime, data['${effectivePrefix}registration_date'])!, lastTestSessionToken: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}last_test_session_token']), words: $UserDatasTable.$converterwords.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}words'])!), tags: $UserDatasTable.$convertertags.fromSql(attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), packProgress: $UserDatasTable.$converterpackProgress.fromSql( attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}pack_progress'])!), studyDates: $UserDatasTable.$converterstudyDates.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}study_dates'])!), achievements: $UserDatasTable.$converterachievements.fromSql( attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}achievements'])!), categoryMinutes: $UserDatasTable.$convertercategoryMinutes.fromSql( attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}category_minutes'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $UserDatasTable createAlias(String alias) { return $UserDatasTable(attachedDatabase, alias); } static TypeConverter?, String> $converterwords = const JsonListConverter(); static TypeConverter, String> $convertertags = const StringListConverter(); static TypeConverter?, String> $converterpackProgress = const JsonListConverter(); static TypeConverter?, String> $converterstudyDates = const DateTimeListConverter(); static TypeConverter?, String> $converterachievements = const JsonListConverter(); static TypeConverter?, String> $convertercategoryMinutes = const JsonMapConverter(); } class UserData extends DataClass implements Insertable { final int id; final int userId; final int totalStudyTimeMinutes; final int currentStreak; final int longestStreak; final int totalCards; final int totalTests; final DateTime? lastTimeOnline; final DateTime registrationDate; final String? lastTestSessionToken; final List? words; final List tags; final List? packProgress; final List? studyDates; final List? achievements; final Map? categoryMinutes; final DateTime createdAt; final DateTime updatedAt; const UserData( {required this.id, required this.userId, required this.totalStudyTimeMinutes, required this.currentStreak, required this.longestStreak, required this.totalCards, required this.totalTests, this.lastTimeOnline, required this.registrationDate, this.lastTestSessionToken, this.words, required this.tags, this.packProgress, this.studyDates, this.achievements, this.categoryMinutes, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['total_study_time_minutes'] = Variable(totalStudyTimeMinutes); map['current_streak'] = Variable(currentStreak); map['longest_streak'] = Variable(longestStreak); map['total_cards'] = Variable(totalCards); map['total_tests'] = Variable(totalTests); if (!nullToAbsent || lastTimeOnline != null) { map['last_time_online'] = Variable(lastTimeOnline); } map['registration_date'] = Variable(registrationDate); if (!nullToAbsent || lastTestSessionToken != null) { map['last_test_session_token'] = Variable(lastTestSessionToken); } if (!nullToAbsent || words != null) { map['words'] = Variable($UserDatasTable.$converterwords.toSql(words)); } { map['tags'] = Variable($UserDatasTable.$convertertags.toSql(tags)); } if (!nullToAbsent || packProgress != null) { map['pack_progress'] = Variable( $UserDatasTable.$converterpackProgress.toSql(packProgress)); } if (!nullToAbsent || studyDates != null) { map['study_dates'] = Variable( $UserDatasTable.$converterstudyDates.toSql(studyDates)); } if (!nullToAbsent || achievements != null) { map['achievements'] = Variable( $UserDatasTable.$converterachievements.toSql(achievements)); } if (!nullToAbsent || categoryMinutes != null) { map['category_minutes'] = Variable( $UserDatasTable.$convertercategoryMinutes.toSql(categoryMinutes)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } UserDatasCompanion toCompanion(bool nullToAbsent) { return UserDatasCompanion( id: Value(id), userId: Value(userId), totalStudyTimeMinutes: Value(totalStudyTimeMinutes), currentStreak: Value(currentStreak), longestStreak: Value(longestStreak), totalCards: Value(totalCards), totalTests: Value(totalTests), lastTimeOnline: lastTimeOnline == null && nullToAbsent ? const Value.absent() : Value(lastTimeOnline), registrationDate: Value(registrationDate), lastTestSessionToken: lastTestSessionToken == null && nullToAbsent ? const Value.absent() : Value(lastTestSessionToken), words: words == null && nullToAbsent ? const Value.absent() : Value(words), tags: Value(tags), packProgress: packProgress == null && nullToAbsent ? const Value.absent() : Value(packProgress), studyDates: studyDates == null && nullToAbsent ? const Value.absent() : Value(studyDates), achievements: achievements == null && nullToAbsent ? const Value.absent() : Value(achievements), categoryMinutes: categoryMinutes == null && nullToAbsent ? const Value.absent() : Value(categoryMinutes), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory UserData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserData( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), totalStudyTimeMinutes: serializer.fromJson(json['totalStudyTimeMinutes']), currentStreak: serializer.fromJson(json['currentStreak']), longestStreak: serializer.fromJson(json['longestStreak']), totalCards: serializer.fromJson(json['totalCards']), totalTests: serializer.fromJson(json['totalTests']), lastTimeOnline: serializer.fromJson(json['lastTimeOnline']), registrationDate: serializer.fromJson(json['registrationDate']), lastTestSessionToken: serializer.fromJson(json['lastTestSessionToken']), words: serializer.fromJson?>(json['words']), tags: serializer.fromJson>(json['tags']), packProgress: serializer.fromJson?>(json['packProgress']), studyDates: serializer.fromJson?>(json['studyDates']), achievements: serializer.fromJson?>(json['achievements']), categoryMinutes: serializer.fromJson?>(json['categoryMinutes']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'totalStudyTimeMinutes': serializer.toJson(totalStudyTimeMinutes), 'currentStreak': serializer.toJson(currentStreak), 'longestStreak': serializer.toJson(longestStreak), 'totalCards': serializer.toJson(totalCards), 'totalTests': serializer.toJson(totalTests), 'lastTimeOnline': serializer.toJson(lastTimeOnline), 'registrationDate': serializer.toJson(registrationDate), 'lastTestSessionToken': serializer.toJson(lastTestSessionToken), 'words': serializer.toJson?>(words), 'tags': serializer.toJson>(tags), 'packProgress': serializer.toJson?>(packProgress), 'studyDates': serializer.toJson?>(studyDates), 'achievements': serializer.toJson?>(achievements), 'categoryMinutes': serializer.toJson?>(categoryMinutes), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } UserData copyWith( {int? id, int? userId, int? totalStudyTimeMinutes, int? currentStreak, int? longestStreak, int? totalCards, int? totalTests, Value lastTimeOnline = const Value.absent(), DateTime? registrationDate, Value lastTestSessionToken = const Value.absent(), Value?> words = const Value.absent(), List? tags, Value?> packProgress = const Value.absent(), Value?> studyDates = const Value.absent(), Value?> achievements = const Value.absent(), Value?> categoryMinutes = const Value.absent(), DateTime? createdAt, DateTime? updatedAt}) => UserData( id: id ?? this.id, userId: userId ?? this.userId, totalStudyTimeMinutes: totalStudyTimeMinutes ?? this.totalStudyTimeMinutes, currentStreak: currentStreak ?? this.currentStreak, longestStreak: longestStreak ?? this.longestStreak, totalCards: totalCards ?? this.totalCards, totalTests: totalTests ?? this.totalTests, lastTimeOnline: lastTimeOnline.present ? lastTimeOnline.value : this.lastTimeOnline, registrationDate: registrationDate ?? this.registrationDate, lastTestSessionToken: lastTestSessionToken.present ? lastTestSessionToken.value : this.lastTestSessionToken, words: words.present ? words.value : this.words, tags: tags ?? this.tags, packProgress: packProgress.present ? packProgress.value : this.packProgress, studyDates: studyDates.present ? studyDates.value : this.studyDates, achievements: achievements.present ? achievements.value : this.achievements, categoryMinutes: categoryMinutes.present ? categoryMinutes.value : this.categoryMinutes, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('UserData(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('totalStudyTimeMinutes: $totalStudyTimeMinutes, ') ..write('currentStreak: $currentStreak, ') ..write('longestStreak: $longestStreak, ') ..write('totalCards: $totalCards, ') ..write('totalTests: $totalTests, ') ..write('lastTimeOnline: $lastTimeOnline, ') ..write('registrationDate: $registrationDate, ') ..write('lastTestSessionToken: $lastTestSessionToken, ') ..write('words: $words, ') ..write('tags: $tags, ') ..write('packProgress: $packProgress, ') ..write('studyDates: $studyDates, ') ..write('achievements: $achievements, ') ..write('categoryMinutes: $categoryMinutes, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, userId, totalStudyTimeMinutes, currentStreak, longestStreak, totalCards, totalTests, lastTimeOnline, registrationDate, lastTestSessionToken, words, tags, packProgress, studyDates, achievements, categoryMinutes, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserData && other.id == this.id && other.userId == this.userId && other.totalStudyTimeMinutes == this.totalStudyTimeMinutes && other.currentStreak == this.currentStreak && other.longestStreak == this.longestStreak && other.totalCards == this.totalCards && other.totalTests == this.totalTests && other.lastTimeOnline == this.lastTimeOnline && other.registrationDate == this.registrationDate && other.lastTestSessionToken == this.lastTestSessionToken && other.words == this.words && other.tags == this.tags && other.packProgress == this.packProgress && other.studyDates == this.studyDates && other.achievements == this.achievements && other.categoryMinutes == this.categoryMinutes && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class UserDatasCompanion extends UpdateCompanion { final Value id; final Value userId; final Value totalStudyTimeMinutes; final Value currentStreak; final Value longestStreak; final Value totalCards; final Value totalTests; final Value lastTimeOnline; final Value registrationDate; final Value lastTestSessionToken; final Value?> words; final Value> tags; final Value?> packProgress; final Value?> studyDates; final Value?> achievements; final Value?> categoryMinutes; final Value createdAt; final Value updatedAt; const UserDatasCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.totalStudyTimeMinutes = const Value.absent(), this.currentStreak = const Value.absent(), this.longestStreak = const Value.absent(), this.totalCards = const Value.absent(), this.totalTests = const Value.absent(), this.lastTimeOnline = const Value.absent(), this.registrationDate = const Value.absent(), this.lastTestSessionToken = const Value.absent(), this.words = const Value.absent(), this.tags = const Value.absent(), this.packProgress = const Value.absent(), this.studyDates = const Value.absent(), this.achievements = const Value.absent(), this.categoryMinutes = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); UserDatasCompanion.insert({ this.id = const Value.absent(), required int userId, this.totalStudyTimeMinutes = const Value.absent(), this.currentStreak = const Value.absent(), this.longestStreak = const Value.absent(), this.totalCards = const Value.absent(), this.totalTests = const Value.absent(), this.lastTimeOnline = const Value.absent(), this.registrationDate = const Value.absent(), this.lastTestSessionToken = const Value.absent(), this.words = const Value.absent(), this.tags = const Value.absent(), this.packProgress = const Value.absent(), this.studyDates = const Value.absent(), this.achievements = const Value.absent(), this.categoryMinutes = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId); static Insertable custom({ Expression? id, Expression? userId, Expression? totalStudyTimeMinutes, Expression? currentStreak, Expression? longestStreak, Expression? totalCards, Expression? totalTests, Expression? lastTimeOnline, Expression? registrationDate, Expression? lastTestSessionToken, Expression? words, Expression? tags, Expression? packProgress, Expression? studyDates, Expression? achievements, Expression? categoryMinutes, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (totalStudyTimeMinutes != null) 'total_study_time_minutes': totalStudyTimeMinutes, if (currentStreak != null) 'current_streak': currentStreak, if (longestStreak != null) 'longest_streak': longestStreak, if (totalCards != null) 'total_cards': totalCards, if (totalTests != null) 'total_tests': totalTests, if (lastTimeOnline != null) 'last_time_online': lastTimeOnline, if (registrationDate != null) 'registration_date': registrationDate, if (lastTestSessionToken != null) 'last_test_session_token': lastTestSessionToken, if (words != null) 'words': words, if (tags != null) 'tags': tags, if (packProgress != null) 'pack_progress': packProgress, if (studyDates != null) 'study_dates': studyDates, if (achievements != null) 'achievements': achievements, if (categoryMinutes != null) 'category_minutes': categoryMinutes, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } UserDatasCompanion copyWith( {Value? id, Value? userId, Value? totalStudyTimeMinutes, Value? currentStreak, Value? longestStreak, Value? totalCards, Value? totalTests, Value? lastTimeOnline, Value? registrationDate, Value? lastTestSessionToken, Value?>? words, Value>? tags, Value?>? packProgress, Value?>? studyDates, Value?>? achievements, Value?>? categoryMinutes, Value? createdAt, Value? updatedAt}) { return UserDatasCompanion( id: id ?? this.id, userId: userId ?? this.userId, totalStudyTimeMinutes: totalStudyTimeMinutes ?? this.totalStudyTimeMinutes, currentStreak: currentStreak ?? this.currentStreak, longestStreak: longestStreak ?? this.longestStreak, totalCards: totalCards ?? this.totalCards, totalTests: totalTests ?? this.totalTests, lastTimeOnline: lastTimeOnline ?? this.lastTimeOnline, registrationDate: registrationDate ?? this.registrationDate, lastTestSessionToken: lastTestSessionToken ?? this.lastTestSessionToken, words: words ?? this.words, tags: tags ?? this.tags, packProgress: packProgress ?? this.packProgress, studyDates: studyDates ?? this.studyDates, achievements: achievements ?? this.achievements, categoryMinutes: categoryMinutes ?? this.categoryMinutes, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (totalStudyTimeMinutes.present) { map['total_study_time_minutes'] = Variable(totalStudyTimeMinutes.value); } if (currentStreak.present) { map['current_streak'] = Variable(currentStreak.value); } if (longestStreak.present) { map['longest_streak'] = Variable(longestStreak.value); } if (totalCards.present) { map['total_cards'] = Variable(totalCards.value); } if (totalTests.present) { map['total_tests'] = Variable(totalTests.value); } if (lastTimeOnline.present) { map['last_time_online'] = Variable(lastTimeOnline.value); } if (registrationDate.present) { map['registration_date'] = Variable(registrationDate.value); } if (lastTestSessionToken.present) { map['last_test_session_token'] = Variable(lastTestSessionToken.value); } if (words.present) { map['words'] = Variable($UserDatasTable.$converterwords.toSql(words.value)); } if (tags.present) { map['tags'] = Variable($UserDatasTable.$convertertags.toSql(tags.value)); } if (packProgress.present) { map['pack_progress'] = Variable( $UserDatasTable.$converterpackProgress.toSql(packProgress.value)); } if (studyDates.present) { map['study_dates'] = Variable( $UserDatasTable.$converterstudyDates.toSql(studyDates.value)); } if (achievements.present) { map['achievements'] = Variable( $UserDatasTable.$converterachievements.toSql(achievements.value)); } if (categoryMinutes.present) { map['category_minutes'] = Variable($UserDatasTable .$convertercategoryMinutes .toSql(categoryMinutes.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('UserDatasCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('totalStudyTimeMinutes: $totalStudyTimeMinutes, ') ..write('currentStreak: $currentStreak, ') ..write('longestStreak: $longestStreak, ') ..write('totalCards: $totalCards, ') ..write('totalTests: $totalTests, ') ..write('lastTimeOnline: $lastTimeOnline, ') ..write('registrationDate: $registrationDate, ') ..write('lastTestSessionToken: $lastTestSessionToken, ') ..write('words: $words, ') ..write('tags: $tags, ') ..write('packProgress: $packProgress, ') ..write('studyDates: $studyDates, ') ..write('achievements: $achievements, ') ..write('categoryMinutes: $categoryMinutes, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $TokensTable extends Tokens with TableInfo<$TokensTable, Token> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TokensTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _tokenMeta = const VerificationMeta('token'); @override late final GeneratedColumn token = GeneratedColumn( 'token', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _externalUserIdMeta = const VerificationMeta('externalUserId'); @override late final GeneratedColumn externalUserId = GeneratedColumn( 'external_user_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _createdMeta = const VerificationMeta('created'); @override late final GeneratedColumn created = GeneratedColumn( 'created', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _expiresMeta = const VerificationMeta('expires'); @override late final GeneratedColumn expires = GeneratedColumn( 'expires', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); @override List get $columns => [id, userId, token, externalUserId, created, expires]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'tokens'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('token')) { context.handle( _tokenMeta, token.isAcceptableOrUnknown(data['token']!, _tokenMeta)); } else if (isInserting) { context.missing(_tokenMeta); } if (data.containsKey('external_user_id')) { context.handle( _externalUserIdMeta, externalUserId.isAcceptableOrUnknown( data['external_user_id']!, _externalUserIdMeta)); } else if (isInserting) { context.missing(_externalUserIdMeta); } if (data.containsKey('created')) { context.handle(_createdMeta, created.isAcceptableOrUnknown(data['created']!, _createdMeta)); } if (data.containsKey('expires')) { context.handle(_expiresMeta, expires.isAcceptableOrUnknown(data['expires']!, _expiresMeta)); } else if (isInserting) { context.missing(_expiresMeta); } return context; } @override Set get $primaryKey => {id}; @override Token map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Token( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, token: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}token'])!, externalUserId: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}external_user_id'])!, created: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created'])!, expires: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}expires'])!, ); } @override $TokensTable createAlias(String alias) { return $TokensTable(attachedDatabase, alias); } } class Token extends DataClass implements Insertable { final int id; final int userId; final String token; final String externalUserId; final DateTime created; final DateTime expires; const Token( {required this.id, required this.userId, required this.token, required this.externalUserId, required this.created, required this.expires}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['token'] = Variable(token); map['external_user_id'] = Variable(externalUserId); map['created'] = Variable(created); map['expires'] = Variable(expires); return map; } TokensCompanion toCompanion(bool nullToAbsent) { return TokensCompanion( id: Value(id), userId: Value(userId), token: Value(token), externalUserId: Value(externalUserId), created: Value(created), expires: Value(expires), ); } factory Token.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Token( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), token: serializer.fromJson(json['token']), externalUserId: serializer.fromJson(json['externalUserId']), created: serializer.fromJson(json['created']), expires: serializer.fromJson(json['expires']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'token': serializer.toJson(token), 'externalUserId': serializer.toJson(externalUserId), 'created': serializer.toJson(created), 'expires': serializer.toJson(expires), }; } Token copyWith( {int? id, int? userId, String? token, String? externalUserId, DateTime? created, DateTime? expires}) => Token( id: id ?? this.id, userId: userId ?? this.userId, token: token ?? this.token, externalUserId: externalUserId ?? this.externalUserId, created: created ?? this.created, expires: expires ?? this.expires, ); @override String toString() { return (StringBuffer('Token(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('token: $token, ') ..write('externalUserId: $externalUserId, ') ..write('created: $created, ') ..write('expires: $expires') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, userId, token, externalUserId, created, expires); @override bool operator ==(Object other) => identical(this, other) || (other is Token && other.id == this.id && other.userId == this.userId && other.token == this.token && other.externalUserId == this.externalUserId && other.created == this.created && other.expires == this.expires); } class TokensCompanion extends UpdateCompanion { final Value id; final Value userId; final Value token; final Value externalUserId; final Value created; final Value expires; const TokensCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.token = const Value.absent(), this.externalUserId = const Value.absent(), this.created = const Value.absent(), this.expires = const Value.absent(), }); TokensCompanion.insert({ this.id = const Value.absent(), required int userId, required String token, required String externalUserId, this.created = const Value.absent(), required DateTime expires, }) : userId = Value(userId), token = Value(token), externalUserId = Value(externalUserId), expires = Value(expires); static Insertable custom({ Expression? id, Expression? userId, Expression? token, Expression? externalUserId, Expression? created, Expression? expires, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (token != null) 'token': token, if (externalUserId != null) 'external_user_id': externalUserId, if (created != null) 'created': created, if (expires != null) 'expires': expires, }); } TokensCompanion copyWith( {Value? id, Value? userId, Value? token, Value? externalUserId, Value? created, Value? expires}) { return TokensCompanion( id: id ?? this.id, userId: userId ?? this.userId, token: token ?? this.token, externalUserId: externalUserId ?? this.externalUserId, created: created ?? this.created, expires: expires ?? this.expires, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (token.present) { map['token'] = Variable(token.value); } if (externalUserId.present) { map['external_user_id'] = Variable(externalUserId.value); } if (created.present) { map['created'] = Variable(created.value); } if (expires.present) { map['expires'] = Variable(expires.value); } return map; } @override String toString() { return (StringBuffer('TokensCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('token: $token, ') ..write('externalUserId: $externalUserId, ') ..write('created: $created, ') ..write('expires: $expires') ..write(')')) .toString(); } } class $RefreshTokensTable extends RefreshTokens with TableInfo<$RefreshTokensTable, RefreshToken> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $RefreshTokensTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _jtiMeta = const VerificationMeta('jti'); @override late final GeneratedColumn jti = GeneratedColumn( 'jti', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _isBlacklistedMeta = const VerificationMeta('isBlacklisted'); @override late final GeneratedColumn isBlacklisted = GeneratedColumn( 'is_blacklisted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways( 'CHECK ("is_blacklisted" IN (0, 1))'), defaultValue: const Constant(false)); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _expiresAtMeta = const VerificationMeta('expiresAt'); @override late final GeneratedColumn expiresAt = GeneratedColumn( 'expires_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); @override List get $columns => [id, userId, jti, isBlacklisted, createdAt, expiresAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'refresh_tokens'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('jti')) { context.handle( _jtiMeta, jti.isAcceptableOrUnknown(data['jti']!, _jtiMeta)); } else if (isInserting) { context.missing(_jtiMeta); } if (data.containsKey('is_blacklisted')) { context.handle( _isBlacklistedMeta, isBlacklisted.isAcceptableOrUnknown( data['is_blacklisted']!, _isBlacklistedMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('expires_at')) { context.handle(_expiresAtMeta, expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta)); } else if (isInserting) { context.missing(_expiresAtMeta); } return context; } @override Set get $primaryKey => {id}; @override RefreshToken map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return RefreshToken( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, jti: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}jti'])!, isBlacklisted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_blacklisted'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, expiresAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}expires_at'])!, ); } @override $RefreshTokensTable createAlias(String alias) { return $RefreshTokensTable(attachedDatabase, alias); } } class RefreshToken extends DataClass implements Insertable { final int id; final int userId; final String jti; final bool isBlacklisted; final DateTime createdAt; final DateTime expiresAt; const RefreshToken( {required this.id, required this.userId, required this.jti, required this.isBlacklisted, required this.createdAt, required this.expiresAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['jti'] = Variable(jti); map['is_blacklisted'] = Variable(isBlacklisted); map['created_at'] = Variable(createdAt); map['expires_at'] = Variable(expiresAt); return map; } RefreshTokensCompanion toCompanion(bool nullToAbsent) { return RefreshTokensCompanion( id: Value(id), userId: Value(userId), jti: Value(jti), isBlacklisted: Value(isBlacklisted), createdAt: Value(createdAt), expiresAt: Value(expiresAt), ); } factory RefreshToken.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return RefreshToken( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), jti: serializer.fromJson(json['jti']), isBlacklisted: serializer.fromJson(json['isBlacklisted']), createdAt: serializer.fromJson(json['createdAt']), expiresAt: serializer.fromJson(json['expiresAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'jti': serializer.toJson(jti), 'isBlacklisted': serializer.toJson(isBlacklisted), 'createdAt': serializer.toJson(createdAt), 'expiresAt': serializer.toJson(expiresAt), }; } RefreshToken copyWith( {int? id, int? userId, String? jti, bool? isBlacklisted, DateTime? createdAt, DateTime? expiresAt}) => RefreshToken( id: id ?? this.id, userId: userId ?? this.userId, jti: jti ?? this.jti, isBlacklisted: isBlacklisted ?? this.isBlacklisted, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, ); @override String toString() { return (StringBuffer('RefreshToken(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('jti: $jti, ') ..write('isBlacklisted: $isBlacklisted, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, userId, jti, isBlacklisted, createdAt, expiresAt); @override bool operator ==(Object other) => identical(this, other) || (other is RefreshToken && other.id == this.id && other.userId == this.userId && other.jti == this.jti && other.isBlacklisted == this.isBlacklisted && other.createdAt == this.createdAt && other.expiresAt == this.expiresAt); } class RefreshTokensCompanion extends UpdateCompanion { final Value id; final Value userId; final Value jti; final Value isBlacklisted; final Value createdAt; final Value expiresAt; const RefreshTokensCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.jti = const Value.absent(), this.isBlacklisted = const Value.absent(), this.createdAt = const Value.absent(), this.expiresAt = const Value.absent(), }); RefreshTokensCompanion.insert({ this.id = const Value.absent(), required int userId, required String jti, this.isBlacklisted = const Value.absent(), this.createdAt = const Value.absent(), required DateTime expiresAt, }) : userId = Value(userId), jti = Value(jti), expiresAt = Value(expiresAt); static Insertable custom({ Expression? id, Expression? userId, Expression? jti, Expression? isBlacklisted, Expression? createdAt, Expression? expiresAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (jti != null) 'jti': jti, if (isBlacklisted != null) 'is_blacklisted': isBlacklisted, if (createdAt != null) 'created_at': createdAt, if (expiresAt != null) 'expires_at': expiresAt, }); } RefreshTokensCompanion copyWith( {Value? id, Value? userId, Value? jti, Value? isBlacklisted, Value? createdAt, Value? expiresAt}) { return RefreshTokensCompanion( id: id ?? this.id, userId: userId ?? this.userId, jti: jti ?? this.jti, isBlacklisted: isBlacklisted ?? this.isBlacklisted, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (jti.present) { map['jti'] = Variable(jti.value); } if (isBlacklisted.present) { map['is_blacklisted'] = Variable(isBlacklisted.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (expiresAt.present) { map['expires_at'] = Variable(expiresAt.value); } return map; } @override String toString() { return (StringBuffer('RefreshTokensCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('jti: $jti, ') ..write('isBlacklisted: $isBlacklisted, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt') ..write(')')) .toString(); } } class $TelegramAuthCodesTable extends TelegramAuthCodes with TableInfo<$TelegramAuthCodesTable, TelegramAuthCode> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TelegramAuthCodesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _codeMeta = const VerificationMeta('code'); @override late final GeneratedColumn code = GeneratedColumn( 'code', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _telegramUserIdMeta = const VerificationMeta('telegramUserId'); @override late final GeneratedColumn telegramUserId = GeneratedColumn( 'telegram_user_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _telegramUsernameMeta = const VerificationMeta('telegramUsername'); @override late final GeneratedColumn telegramUsername = GeneratedColumn( 'telegram_username', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _firstNameMeta = const VerificationMeta('firstName'); @override late final GeneratedColumn firstName = GeneratedColumn( 'first_name', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _lastNameMeta = const VerificationMeta('lastName'); @override late final GeneratedColumn lastName = GeneratedColumn( 'last_name', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _isUsedMeta = const VerificationMeta('isUsed'); @override late final GeneratedColumn isUsed = GeneratedColumn( 'is_used', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_used" IN (0, 1))'), defaultValue: const Constant(false)); static const VerificationMeta _usedAtMeta = const VerificationMeta('usedAt'); @override late final GeneratedColumn usedAt = GeneratedColumn( 'used_at', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _expiresAtMeta = const VerificationMeta('expiresAt'); @override late final GeneratedColumn expiresAt = GeneratedColumn( 'expires_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); @override List get $columns => [ id, code, telegramUserId, telegramUsername, firstName, lastName, isUsed, usedAt, createdAt, expiresAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'telegram_auth_codes'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('code')) { context.handle( _codeMeta, code.isAcceptableOrUnknown(data['code']!, _codeMeta)); } else if (isInserting) { context.missing(_codeMeta); } if (data.containsKey('telegram_user_id')) { context.handle( _telegramUserIdMeta, telegramUserId.isAcceptableOrUnknown( data['telegram_user_id']!, _telegramUserIdMeta)); } else if (isInserting) { context.missing(_telegramUserIdMeta); } if (data.containsKey('telegram_username')) { context.handle( _telegramUsernameMeta, telegramUsername.isAcceptableOrUnknown( data['telegram_username']!, _telegramUsernameMeta)); } if (data.containsKey('first_name')) { context.handle(_firstNameMeta, firstName.isAcceptableOrUnknown(data['first_name']!, _firstNameMeta)); } if (data.containsKey('last_name')) { context.handle(_lastNameMeta, lastName.isAcceptableOrUnknown(data['last_name']!, _lastNameMeta)); } if (data.containsKey('is_used')) { context.handle(_isUsedMeta, isUsed.isAcceptableOrUnknown(data['is_used']!, _isUsedMeta)); } if (data.containsKey('used_at')) { context.handle(_usedAtMeta, usedAt.isAcceptableOrUnknown(data['used_at']!, _usedAtMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('expires_at')) { context.handle(_expiresAtMeta, expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta)); } else if (isInserting) { context.missing(_expiresAtMeta); } return context; } @override Set get $primaryKey => {id}; @override TelegramAuthCode map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TelegramAuthCode( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, code: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}code'])!, telegramUserId: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}telegram_user_id'])!, telegramUsername: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}telegram_username']), firstName: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}first_name']), lastName: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}last_name']), isUsed: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_used'])!, usedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}used_at']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, expiresAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}expires_at'])!, ); } @override $TelegramAuthCodesTable createAlias(String alias) { return $TelegramAuthCodesTable(attachedDatabase, alias); } } class TelegramAuthCode extends DataClass implements Insertable { final int id; final String code; final String telegramUserId; final String? telegramUsername; final String? firstName; final String? lastName; final bool isUsed; final DateTime? usedAt; final DateTime createdAt; final DateTime expiresAt; const TelegramAuthCode( {required this.id, required this.code, required this.telegramUserId, this.telegramUsername, this.firstName, this.lastName, required this.isUsed, this.usedAt, required this.createdAt, required this.expiresAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['code'] = Variable(code); map['telegram_user_id'] = Variable(telegramUserId); if (!nullToAbsent || telegramUsername != null) { map['telegram_username'] = Variable(telegramUsername); } if (!nullToAbsent || firstName != null) { map['first_name'] = Variable(firstName); } if (!nullToAbsent || lastName != null) { map['last_name'] = Variable(lastName); } map['is_used'] = Variable(isUsed); if (!nullToAbsent || usedAt != null) { map['used_at'] = Variable(usedAt); } map['created_at'] = Variable(createdAt); map['expires_at'] = Variable(expiresAt); return map; } TelegramAuthCodesCompanion toCompanion(bool nullToAbsent) { return TelegramAuthCodesCompanion( id: Value(id), code: Value(code), telegramUserId: Value(telegramUserId), telegramUsername: telegramUsername == null && nullToAbsent ? const Value.absent() : Value(telegramUsername), firstName: firstName == null && nullToAbsent ? const Value.absent() : Value(firstName), lastName: lastName == null && nullToAbsent ? const Value.absent() : Value(lastName), isUsed: Value(isUsed), usedAt: usedAt == null && nullToAbsent ? const Value.absent() : Value(usedAt), createdAt: Value(createdAt), expiresAt: Value(expiresAt), ); } factory TelegramAuthCode.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TelegramAuthCode( id: serializer.fromJson(json['id']), code: serializer.fromJson(json['code']), telegramUserId: serializer.fromJson(json['telegramUserId']), telegramUsername: serializer.fromJson(json['telegramUsername']), firstName: serializer.fromJson(json['firstName']), lastName: serializer.fromJson(json['lastName']), isUsed: serializer.fromJson(json['isUsed']), usedAt: serializer.fromJson(json['usedAt']), createdAt: serializer.fromJson(json['createdAt']), expiresAt: serializer.fromJson(json['expiresAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'code': serializer.toJson(code), 'telegramUserId': serializer.toJson(telegramUserId), 'telegramUsername': serializer.toJson(telegramUsername), 'firstName': serializer.toJson(firstName), 'lastName': serializer.toJson(lastName), 'isUsed': serializer.toJson(isUsed), 'usedAt': serializer.toJson(usedAt), 'createdAt': serializer.toJson(createdAt), 'expiresAt': serializer.toJson(expiresAt), }; } TelegramAuthCode copyWith( {int? id, String? code, String? telegramUserId, Value telegramUsername = const Value.absent(), Value firstName = const Value.absent(), Value lastName = const Value.absent(), bool? isUsed, Value usedAt = const Value.absent(), DateTime? createdAt, DateTime? expiresAt}) => TelegramAuthCode( id: id ?? this.id, code: code ?? this.code, telegramUserId: telegramUserId ?? this.telegramUserId, telegramUsername: telegramUsername.present ? telegramUsername.value : this.telegramUsername, firstName: firstName.present ? firstName.value : this.firstName, lastName: lastName.present ? lastName.value : this.lastName, isUsed: isUsed ?? this.isUsed, usedAt: usedAt.present ? usedAt.value : this.usedAt, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, ); @override String toString() { return (StringBuffer('TelegramAuthCode(') ..write('id: $id, ') ..write('code: $code, ') ..write('telegramUserId: $telegramUserId, ') ..write('telegramUsername: $telegramUsername, ') ..write('firstName: $firstName, ') ..write('lastName: $lastName, ') ..write('isUsed: $isUsed, ') ..write('usedAt: $usedAt, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, code, telegramUserId, telegramUsername, firstName, lastName, isUsed, usedAt, createdAt, expiresAt); @override bool operator ==(Object other) => identical(this, other) || (other is TelegramAuthCode && other.id == this.id && other.code == this.code && other.telegramUserId == this.telegramUserId && other.telegramUsername == this.telegramUsername && other.firstName == this.firstName && other.lastName == this.lastName && other.isUsed == this.isUsed && other.usedAt == this.usedAt && other.createdAt == this.createdAt && other.expiresAt == this.expiresAt); } class TelegramAuthCodesCompanion extends UpdateCompanion { final Value id; final Value code; final Value telegramUserId; final Value telegramUsername; final Value firstName; final Value lastName; final Value isUsed; final Value usedAt; final Value createdAt; final Value expiresAt; const TelegramAuthCodesCompanion({ this.id = const Value.absent(), this.code = const Value.absent(), this.telegramUserId = const Value.absent(), this.telegramUsername = const Value.absent(), this.firstName = const Value.absent(), this.lastName = const Value.absent(), this.isUsed = const Value.absent(), this.usedAt = const Value.absent(), this.createdAt = const Value.absent(), this.expiresAt = const Value.absent(), }); TelegramAuthCodesCompanion.insert({ this.id = const Value.absent(), required String code, required String telegramUserId, this.telegramUsername = const Value.absent(), this.firstName = const Value.absent(), this.lastName = const Value.absent(), this.isUsed = const Value.absent(), this.usedAt = const Value.absent(), this.createdAt = const Value.absent(), required DateTime expiresAt, }) : code = Value(code), telegramUserId = Value(telegramUserId), expiresAt = Value(expiresAt); static Insertable custom({ Expression? id, Expression? code, Expression? telegramUserId, Expression? telegramUsername, Expression? firstName, Expression? lastName, Expression? isUsed, Expression? usedAt, Expression? createdAt, Expression? expiresAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (code != null) 'code': code, if (telegramUserId != null) 'telegram_user_id': telegramUserId, if (telegramUsername != null) 'telegram_username': telegramUsername, if (firstName != null) 'first_name': firstName, if (lastName != null) 'last_name': lastName, if (isUsed != null) 'is_used': isUsed, if (usedAt != null) 'used_at': usedAt, if (createdAt != null) 'created_at': createdAt, if (expiresAt != null) 'expires_at': expiresAt, }); } TelegramAuthCodesCompanion copyWith( {Value? id, Value? code, Value? telegramUserId, Value? telegramUsername, Value? firstName, Value? lastName, Value? isUsed, Value? usedAt, Value? createdAt, Value? expiresAt}) { return TelegramAuthCodesCompanion( id: id ?? this.id, code: code ?? this.code, telegramUserId: telegramUserId ?? this.telegramUserId, telegramUsername: telegramUsername ?? this.telegramUsername, firstName: firstName ?? this.firstName, lastName: lastName ?? this.lastName, isUsed: isUsed ?? this.isUsed, usedAt: usedAt ?? this.usedAt, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (code.present) { map['code'] = Variable(code.value); } if (telegramUserId.present) { map['telegram_user_id'] = Variable(telegramUserId.value); } if (telegramUsername.present) { map['telegram_username'] = Variable(telegramUsername.value); } if (firstName.present) { map['first_name'] = Variable(firstName.value); } if (lastName.present) { map['last_name'] = Variable(lastName.value); } if (isUsed.present) { map['is_used'] = Variable(isUsed.value); } if (usedAt.present) { map['used_at'] = Variable(usedAt.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (expiresAt.present) { map['expires_at'] = Variable(expiresAt.value); } return map; } @override String toString() { return (StringBuffer('TelegramAuthCodesCompanion(') ..write('id: $id, ') ..write('code: $code, ') ..write('telegramUserId: $telegramUserId, ') ..write('telegramUsername: $telegramUsername, ') ..write('firstName: $firstName, ') ..write('lastName: $lastName, ') ..write('isUsed: $isUsed, ') ..write('usedAt: $usedAt, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt') ..write(')')) .toString(); } } class $CardPacksTable extends CardPacks with TableInfo<$CardPacksTable, CardPack> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $CardPacksTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _titleMeta = const VerificationMeta('title'); @override late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _subtitleMeta = const VerificationMeta('subtitle'); @override late final GeneratedColumn subtitle = GeneratedColumn( 'subtitle', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); @override late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _colorMeta = const VerificationMeta('color'); @override late final GeneratedColumn color = GeneratedColumn( 'color', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _coverMeta = const VerificationMeta('cover'); @override late final GeneratedColumn cover = GeneratedColumn( 'cover', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _sizeMeta = const VerificationMeta('size'); @override late final GeneratedColumn size = GeneratedColumn( 'size', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _versionMeta = const VerificationMeta('version'); @override late final GeneratedColumn version = GeneratedColumn( 'version', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _orderMeta = const VerificationMeta('order'); @override late final GeneratedColumn order = GeneratedColumn( 'order', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _enabledMeta = const VerificationMeta('enabled'); @override late final GeneratedColumn enabled = GeneratedColumn( 'enabled', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("enabled" IN (0, 1))'), defaultValue: const Constant(true)); static const VerificationMeta _cardsOrderMeta = const VerificationMeta('cardsOrder'); @override late final GeneratedColumnWithTypeConverter, String> cardsOrder = GeneratedColumn('cards_order', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($CardPacksTable.$convertercardsOrder); static const VerificationMeta _googlePlayIdMeta = const VerificationMeta('googlePlayId'); @override late final GeneratedColumn googlePlayId = GeneratedColumn( 'google_play_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _rustoreIdMeta = const VerificationMeta('rustoreId'); @override late final GeneratedColumn rustoreId = GeneratedColumn( 'rustore_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _appStoreIdMeta = const VerificationMeta('appStoreId'); @override late final GeneratedColumn appStoreId = GeneratedColumn( 'app_store_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _priceMeta = const VerificationMeta('price'); @override late final GeneratedColumn price = GeneratedColumn( 'price', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _currencyMeta = const VerificationMeta('currency'); @override late final GeneratedColumn currency = GeneratedColumn( 'currency', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('RUB')); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, title, subtitle, description, color, cover, size, version, order, enabled, cardsOrder, googlePlayId, rustoreId, appStoreId, price, currency, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'card_packs'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('title')) { context.handle( _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); } else if (isInserting) { context.missing(_titleMeta); } if (data.containsKey('subtitle')) { context.handle(_subtitleMeta, subtitle.isAcceptableOrUnknown(data['subtitle']!, _subtitleMeta)); } else if (isInserting) { context.missing(_subtitleMeta); } if (data.containsKey('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } if (data.containsKey('color')) { context.handle( _colorMeta, color.isAcceptableOrUnknown(data['color']!, _colorMeta)); } if (data.containsKey('cover')) { context.handle( _coverMeta, cover.isAcceptableOrUnknown(data['cover']!, _coverMeta)); } if (data.containsKey('size')) { context.handle( _sizeMeta, size.isAcceptableOrUnknown(data['size']!, _sizeMeta)); } else if (isInserting) { context.missing(_sizeMeta); } if (data.containsKey('version')) { context.handle(_versionMeta, version.isAcceptableOrUnknown(data['version']!, _versionMeta)); } if (data.containsKey('order')) { context.handle( _orderMeta, order.isAcceptableOrUnknown(data['order']!, _orderMeta)); } if (data.containsKey('enabled')) { context.handle(_enabledMeta, enabled.isAcceptableOrUnknown(data['enabled']!, _enabledMeta)); } context.handle(_cardsOrderMeta, const VerificationResult.success()); if (data.containsKey('google_play_id')) { context.handle( _googlePlayIdMeta, googlePlayId.isAcceptableOrUnknown( data['google_play_id']!, _googlePlayIdMeta)); } if (data.containsKey('rustore_id')) { context.handle(_rustoreIdMeta, rustoreId.isAcceptableOrUnknown(data['rustore_id']!, _rustoreIdMeta)); } if (data.containsKey('app_store_id')) { context.handle( _appStoreIdMeta, appStoreId.isAcceptableOrUnknown( data['app_store_id']!, _appStoreIdMeta)); } if (data.containsKey('price')) { context.handle( _priceMeta, price.isAcceptableOrUnknown(data['price']!, _priceMeta)); } if (data.containsKey('currency')) { context.handle(_currencyMeta, currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override CardPack map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return CardPack( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, subtitle: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}subtitle'])!, description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description']), color: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}color']), cover: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}cover']), size: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}size'])!, version: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}version']), order: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}order'])!, enabled: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}enabled'])!, cardsOrder: $CardPacksTable.$convertercardsOrder.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}cards_order'])!), googlePlayId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}google_play_id']), rustoreId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}rustore_id']), appStoreId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}app_store_id']), price: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}price']), currency: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}currency'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $CardPacksTable createAlias(String alias) { return $CardPacksTable(attachedDatabase, alias); } static TypeConverter, String> $convertercardsOrder = const IntListConverter(); } class CardPack extends DataClass implements Insertable { final int id; final String title; final String subtitle; final String? description; final String? color; final String? cover; final int size; final String? version; final int order; final bool enabled; final List cardsOrder; final String? googlePlayId; final String? rustoreId; final String? appStoreId; final String? price; final String currency; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const CardPack( {required this.id, required this.title, required this.subtitle, this.description, this.color, this.cover, required this.size, this.version, required this.order, required this.enabled, required this.cardsOrder, this.googlePlayId, this.rustoreId, this.appStoreId, this.price, required this.currency, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['title'] = Variable(title); map['subtitle'] = Variable(subtitle); if (!nullToAbsent || description != null) { map['description'] = Variable(description); } if (!nullToAbsent || color != null) { map['color'] = Variable(color); } if (!nullToAbsent || cover != null) { map['cover'] = Variable(cover); } map['size'] = Variable(size); if (!nullToAbsent || version != null) { map['version'] = Variable(version); } map['order'] = Variable(order); map['enabled'] = Variable(enabled); { map['cards_order'] = Variable( $CardPacksTable.$convertercardsOrder.toSql(cardsOrder)); } if (!nullToAbsent || googlePlayId != null) { map['google_play_id'] = Variable(googlePlayId); } if (!nullToAbsent || rustoreId != null) { map['rustore_id'] = Variable(rustoreId); } if (!nullToAbsent || appStoreId != null) { map['app_store_id'] = Variable(appStoreId); } if (!nullToAbsent || price != null) { map['price'] = Variable(price); } map['currency'] = Variable(currency); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } CardPacksCompanion toCompanion(bool nullToAbsent) { return CardPacksCompanion( id: Value(id), title: Value(title), subtitle: Value(subtitle), description: description == null && nullToAbsent ? const Value.absent() : Value(description), color: color == null && nullToAbsent ? const Value.absent() : Value(color), cover: cover == null && nullToAbsent ? const Value.absent() : Value(cover), size: Value(size), version: version == null && nullToAbsent ? const Value.absent() : Value(version), order: Value(order), enabled: Value(enabled), cardsOrder: Value(cardsOrder), googlePlayId: googlePlayId == null && nullToAbsent ? const Value.absent() : Value(googlePlayId), rustoreId: rustoreId == null && nullToAbsent ? const Value.absent() : Value(rustoreId), appStoreId: appStoreId == null && nullToAbsent ? const Value.absent() : Value(appStoreId), price: price == null && nullToAbsent ? const Value.absent() : Value(price), currency: Value(currency), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory CardPack.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return CardPack( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), subtitle: serializer.fromJson(json['subtitle']), description: serializer.fromJson(json['description']), color: serializer.fromJson(json['color']), cover: serializer.fromJson(json['cover']), size: serializer.fromJson(json['size']), version: serializer.fromJson(json['version']), order: serializer.fromJson(json['order']), enabled: serializer.fromJson(json['enabled']), cardsOrder: serializer.fromJson>(json['cardsOrder']), googlePlayId: serializer.fromJson(json['googlePlayId']), rustoreId: serializer.fromJson(json['rustoreId']), appStoreId: serializer.fromJson(json['appStoreId']), price: serializer.fromJson(json['price']), currency: serializer.fromJson(json['currency']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'subtitle': serializer.toJson(subtitle), 'description': serializer.toJson(description), 'color': serializer.toJson(color), 'cover': serializer.toJson(cover), 'size': serializer.toJson(size), 'version': serializer.toJson(version), 'order': serializer.toJson(order), 'enabled': serializer.toJson(enabled), 'cardsOrder': serializer.toJson>(cardsOrder), 'googlePlayId': serializer.toJson(googlePlayId), 'rustoreId': serializer.toJson(rustoreId), 'appStoreId': serializer.toJson(appStoreId), 'price': serializer.toJson(price), 'currency': serializer.toJson(currency), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } CardPack copyWith( {int? id, String? title, String? subtitle, Value description = const Value.absent(), Value color = const Value.absent(), Value cover = const Value.absent(), int? size, Value version = const Value.absent(), int? order, bool? enabled, List? cardsOrder, Value googlePlayId = const Value.absent(), Value rustoreId = const Value.absent(), Value appStoreId = const Value.absent(), Value price = const Value.absent(), String? currency, DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => CardPack( id: id ?? this.id, title: title ?? this.title, subtitle: subtitle ?? this.subtitle, description: description.present ? description.value : this.description, color: color.present ? color.value : this.color, cover: cover.present ? cover.value : this.cover, size: size ?? this.size, version: version.present ? version.value : this.version, order: order ?? this.order, enabled: enabled ?? this.enabled, cardsOrder: cardsOrder ?? this.cardsOrder, googlePlayId: googlePlayId.present ? googlePlayId.value : this.googlePlayId, rustoreId: rustoreId.present ? rustoreId.value : this.rustoreId, appStoreId: appStoreId.present ? appStoreId.value : this.appStoreId, price: price.present ? price.value : this.price, currency: currency ?? this.currency, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('CardPack(') ..write('id: $id, ') ..write('title: $title, ') ..write('subtitle: $subtitle, ') ..write('description: $description, ') ..write('color: $color, ') ..write('cover: $cover, ') ..write('size: $size, ') ..write('version: $version, ') ..write('order: $order, ') ..write('enabled: $enabled, ') ..write('cardsOrder: $cardsOrder, ') ..write('googlePlayId: $googlePlayId, ') ..write('rustoreId: $rustoreId, ') ..write('appStoreId: $appStoreId, ') ..write('price: $price, ') ..write('currency: $currency, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, title, subtitle, description, color, cover, size, version, order, enabled, cardsOrder, googlePlayId, rustoreId, appStoreId, price, currency, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is CardPack && other.id == this.id && other.title == this.title && other.subtitle == this.subtitle && other.description == this.description && other.color == this.color && other.cover == this.cover && other.size == this.size && other.version == this.version && other.order == this.order && other.enabled == this.enabled && other.cardsOrder == this.cardsOrder && other.googlePlayId == this.googlePlayId && other.rustoreId == this.rustoreId && other.appStoreId == this.appStoreId && other.price == this.price && other.currency == this.currency && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class CardPacksCompanion extends UpdateCompanion { final Value id; final Value title; final Value subtitle; final Value description; final Value color; final Value cover; final Value size; final Value version; final Value order; final Value enabled; final Value> cardsOrder; final Value googlePlayId; final Value rustoreId; final Value appStoreId; final Value price; final Value currency; final Value createdAt; final Value updatedAt; final Value isDeleted; const CardPacksCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.subtitle = const Value.absent(), this.description = const Value.absent(), this.color = const Value.absent(), this.cover = const Value.absent(), this.size = const Value.absent(), this.version = const Value.absent(), this.order = const Value.absent(), this.enabled = const Value.absent(), this.cardsOrder = const Value.absent(), this.googlePlayId = const Value.absent(), this.rustoreId = const Value.absent(), this.appStoreId = const Value.absent(), this.price = const Value.absent(), this.currency = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); CardPacksCompanion.insert({ this.id = const Value.absent(), required String title, required String subtitle, this.description = const Value.absent(), this.color = const Value.absent(), this.cover = const Value.absent(), required int size, this.version = const Value.absent(), this.order = const Value.absent(), this.enabled = const Value.absent(), this.cardsOrder = const Value.absent(), this.googlePlayId = const Value.absent(), this.rustoreId = const Value.absent(), this.appStoreId = const Value.absent(), this.price = const Value.absent(), this.currency = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : title = Value(title), subtitle = Value(subtitle), size = Value(size); static Insertable custom({ Expression? id, Expression? title, Expression? subtitle, Expression? description, Expression? color, Expression? cover, Expression? size, Expression? version, Expression? order, Expression? enabled, Expression? cardsOrder, Expression? googlePlayId, Expression? rustoreId, Expression? appStoreId, Expression? price, Expression? currency, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (title != null) 'title': title, if (subtitle != null) 'subtitle': subtitle, if (description != null) 'description': description, if (color != null) 'color': color, if (cover != null) 'cover': cover, if (size != null) 'size': size, if (version != null) 'version': version, if (order != null) 'order': order, if (enabled != null) 'enabled': enabled, if (cardsOrder != null) 'cards_order': cardsOrder, if (googlePlayId != null) 'google_play_id': googlePlayId, if (rustoreId != null) 'rustore_id': rustoreId, if (appStoreId != null) 'app_store_id': appStoreId, if (price != null) 'price': price, if (currency != null) 'currency': currency, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } CardPacksCompanion copyWith( {Value? id, Value? title, Value? subtitle, Value? description, Value? color, Value? cover, Value? size, Value? version, Value? order, Value? enabled, Value>? cardsOrder, Value? googlePlayId, Value? rustoreId, Value? appStoreId, Value? price, Value? currency, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return CardPacksCompanion( id: id ?? this.id, title: title ?? this.title, subtitle: subtitle ?? this.subtitle, description: description ?? this.description, color: color ?? this.color, cover: cover ?? this.cover, size: size ?? this.size, version: version ?? this.version, order: order ?? this.order, enabled: enabled ?? this.enabled, cardsOrder: cardsOrder ?? this.cardsOrder, googlePlayId: googlePlayId ?? this.googlePlayId, rustoreId: rustoreId ?? this.rustoreId, appStoreId: appStoreId ?? this.appStoreId, price: price ?? this.price, currency: currency ?? this.currency, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (title.present) { map['title'] = Variable(title.value); } if (subtitle.present) { map['subtitle'] = Variable(subtitle.value); } if (description.present) { map['description'] = Variable(description.value); } if (color.present) { map['color'] = Variable(color.value); } if (cover.present) { map['cover'] = Variable(cover.value); } if (size.present) { map['size'] = Variable(size.value); } if (version.present) { map['version'] = Variable(version.value); } if (order.present) { map['order'] = Variable(order.value); } if (enabled.present) { map['enabled'] = Variable(enabled.value); } if (cardsOrder.present) { map['cards_order'] = Variable( $CardPacksTable.$convertercardsOrder.toSql(cardsOrder.value)); } if (googlePlayId.present) { map['google_play_id'] = Variable(googlePlayId.value); } if (rustoreId.present) { map['rustore_id'] = Variable(rustoreId.value); } if (appStoreId.present) { map['app_store_id'] = Variable(appStoreId.value); } if (price.present) { map['price'] = Variable(price.value); } if (currency.present) { map['currency'] = Variable(currency.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('CardPacksCompanion(') ..write('id: $id, ') ..write('title: $title, ') ..write('subtitle: $subtitle, ') ..write('description: $description, ') ..write('color: $color, ') ..write('cover: $cover, ') ..write('size: $size, ') ..write('version: $version, ') ..write('order: $order, ') ..write('enabled: $enabled, ') ..write('cardsOrder: $cardsOrder, ') ..write('googlePlayId: $googlePlayId, ') ..write('rustoreId: $rustoreId, ') ..write('appStoreId: $appStoreId, ') ..write('price: $price, ') ..write('currency: $currency, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $GameCardsTable extends GameCards with TableInfo<$GameCardsTable, GameCard> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $GameCardsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES card_packs (id) ON DELETE CASCADE')); static const VerificationMeta _originalMeta = const VerificationMeta('original'); @override late final GeneratedColumn original = GeneratedColumn( 'original', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _translationMeta = const VerificationMeta('translation'); @override late final GeneratedColumn translation = GeneratedColumn( 'translation', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _mnemoMeta = const VerificationMeta('mnemo'); @override late final GeneratedColumn mnemo = GeneratedColumn( 'mnemo', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _imageMeta = const VerificationMeta('image'); @override late final GeneratedColumn image = GeneratedColumn( 'image', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _imageBackMeta = const VerificationMeta('imageBack'); @override late final GeneratedColumn imageBack = GeneratedColumn( 'image_back', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _transcriptionMeta = const VerificationMeta('transcription'); @override late final GeneratedColumn transcription = GeneratedColumn( 'transcription', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _transcriptionMnemoMeta = const VerificationMeta('transcriptionMnemo'); @override late final GeneratedColumn transcriptionMnemo = GeneratedColumn('transcription_mnemo', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _backMeta = const VerificationMeta('back'); @override late final GeneratedColumn back = GeneratedColumn( 'back', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, packId, original, translation, mnemo, image, imageBack, transcription, transcriptionMnemo, back, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'game_cards'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } else if (isInserting) { context.missing(_packIdMeta); } if (data.containsKey('original')) { context.handle(_originalMeta, original.isAcceptableOrUnknown(data['original']!, _originalMeta)); } else if (isInserting) { context.missing(_originalMeta); } if (data.containsKey('translation')) { context.handle( _translationMeta, translation.isAcceptableOrUnknown( data['translation']!, _translationMeta)); } else if (isInserting) { context.missing(_translationMeta); } if (data.containsKey('mnemo')) { context.handle( _mnemoMeta, mnemo.isAcceptableOrUnknown(data['mnemo']!, _mnemoMeta)); } if (data.containsKey('image')) { context.handle( _imageMeta, image.isAcceptableOrUnknown(data['image']!, _imageMeta)); } else if (isInserting) { context.missing(_imageMeta); } if (data.containsKey('image_back')) { context.handle(_imageBackMeta, imageBack.isAcceptableOrUnknown(data['image_back']!, _imageBackMeta)); } if (data.containsKey('transcription')) { context.handle( _transcriptionMeta, transcription.isAcceptableOrUnknown( data['transcription']!, _transcriptionMeta)); } if (data.containsKey('transcription_mnemo')) { context.handle( _transcriptionMnemoMeta, transcriptionMnemo.isAcceptableOrUnknown( data['transcription_mnemo']!, _transcriptionMnemoMeta)); } if (data.containsKey('back')) { context.handle( _backMeta, back.isAcceptableOrUnknown(data['back']!, _backMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override GameCard map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return GameCard( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, packId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}pack_id'])!, original: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}original'])!, translation: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}translation'])!, mnemo: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}mnemo']), image: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}image'])!, imageBack: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}image_back']), transcription: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}transcription']), transcriptionMnemo: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}transcription_mnemo']), back: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}back']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $GameCardsTable createAlias(String alias) { return $GameCardsTable(attachedDatabase, alias); } } class GameCard extends DataClass implements Insertable { final int id; final int packId; final String original; final String translation; final String? mnemo; final String image; final String? imageBack; final String? transcription; final String? transcriptionMnemo; final String? back; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const GameCard( {required this.id, required this.packId, required this.original, required this.translation, this.mnemo, required this.image, this.imageBack, this.transcription, this.transcriptionMnemo, this.back, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['pack_id'] = Variable(packId); map['original'] = Variable(original); map['translation'] = Variable(translation); if (!nullToAbsent || mnemo != null) { map['mnemo'] = Variable(mnemo); } map['image'] = Variable(image); if (!nullToAbsent || imageBack != null) { map['image_back'] = Variable(imageBack); } if (!nullToAbsent || transcription != null) { map['transcription'] = Variable(transcription); } if (!nullToAbsent || transcriptionMnemo != null) { map['transcription_mnemo'] = Variable(transcriptionMnemo); } if (!nullToAbsent || back != null) { map['back'] = Variable(back); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } GameCardsCompanion toCompanion(bool nullToAbsent) { return GameCardsCompanion( id: Value(id), packId: Value(packId), original: Value(original), translation: Value(translation), mnemo: mnemo == null && nullToAbsent ? const Value.absent() : Value(mnemo), image: Value(image), imageBack: imageBack == null && nullToAbsent ? const Value.absent() : Value(imageBack), transcription: transcription == null && nullToAbsent ? const Value.absent() : Value(transcription), transcriptionMnemo: transcriptionMnemo == null && nullToAbsent ? const Value.absent() : Value(transcriptionMnemo), back: back == null && nullToAbsent ? const Value.absent() : Value(back), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory GameCard.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return GameCard( id: serializer.fromJson(json['id']), packId: serializer.fromJson(json['packId']), original: serializer.fromJson(json['original']), translation: serializer.fromJson(json['translation']), mnemo: serializer.fromJson(json['mnemo']), image: serializer.fromJson(json['image']), imageBack: serializer.fromJson(json['imageBack']), transcription: serializer.fromJson(json['transcription']), transcriptionMnemo: serializer.fromJson(json['transcriptionMnemo']), back: serializer.fromJson(json['back']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'packId': serializer.toJson(packId), 'original': serializer.toJson(original), 'translation': serializer.toJson(translation), 'mnemo': serializer.toJson(mnemo), 'image': serializer.toJson(image), 'imageBack': serializer.toJson(imageBack), 'transcription': serializer.toJson(transcription), 'transcriptionMnemo': serializer.toJson(transcriptionMnemo), 'back': serializer.toJson(back), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } GameCard copyWith( {int? id, int? packId, String? original, String? translation, Value mnemo = const Value.absent(), String? image, Value imageBack = const Value.absent(), Value transcription = const Value.absent(), Value transcriptionMnemo = const Value.absent(), Value back = const Value.absent(), DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => GameCard( id: id ?? this.id, packId: packId ?? this.packId, original: original ?? this.original, translation: translation ?? this.translation, mnemo: mnemo.present ? mnemo.value : this.mnemo, image: image ?? this.image, imageBack: imageBack.present ? imageBack.value : this.imageBack, transcription: transcription.present ? transcription.value : this.transcription, transcriptionMnemo: transcriptionMnemo.present ? transcriptionMnemo.value : this.transcriptionMnemo, back: back.present ? back.value : this.back, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('GameCard(') ..write('id: $id, ') ..write('packId: $packId, ') ..write('original: $original, ') ..write('translation: $translation, ') ..write('mnemo: $mnemo, ') ..write('image: $image, ') ..write('imageBack: $imageBack, ') ..write('transcription: $transcription, ') ..write('transcriptionMnemo: $transcriptionMnemo, ') ..write('back: $back, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, packId, original, translation, mnemo, image, imageBack, transcription, transcriptionMnemo, back, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is GameCard && other.id == this.id && other.packId == this.packId && other.original == this.original && other.translation == this.translation && other.mnemo == this.mnemo && other.image == this.image && other.imageBack == this.imageBack && other.transcription == this.transcription && other.transcriptionMnemo == this.transcriptionMnemo && other.back == this.back && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class GameCardsCompanion extends UpdateCompanion { final Value id; final Value packId; final Value original; final Value translation; final Value mnemo; final Value image; final Value imageBack; final Value transcription; final Value transcriptionMnemo; final Value back; final Value createdAt; final Value updatedAt; final Value isDeleted; const GameCardsCompanion({ this.id = const Value.absent(), this.packId = const Value.absent(), this.original = const Value.absent(), this.translation = const Value.absent(), this.mnemo = const Value.absent(), this.image = const Value.absent(), this.imageBack = const Value.absent(), this.transcription = const Value.absent(), this.transcriptionMnemo = const Value.absent(), this.back = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); GameCardsCompanion.insert({ this.id = const Value.absent(), required int packId, required String original, required String translation, this.mnemo = const Value.absent(), required String image, this.imageBack = const Value.absent(), this.transcription = const Value.absent(), this.transcriptionMnemo = const Value.absent(), this.back = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : packId = Value(packId), original = Value(original), translation = Value(translation), image = Value(image); static Insertable custom({ Expression? id, Expression? packId, Expression? original, Expression? translation, Expression? mnemo, Expression? image, Expression? imageBack, Expression? transcription, Expression? transcriptionMnemo, Expression? back, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (packId != null) 'pack_id': packId, if (original != null) 'original': original, if (translation != null) 'translation': translation, if (mnemo != null) 'mnemo': mnemo, if (image != null) 'image': image, if (imageBack != null) 'image_back': imageBack, if (transcription != null) 'transcription': transcription, if (transcriptionMnemo != null) 'transcription_mnemo': transcriptionMnemo, if (back != null) 'back': back, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } GameCardsCompanion copyWith( {Value? id, Value? packId, Value? original, Value? translation, Value? mnemo, Value? image, Value? imageBack, Value? transcription, Value? transcriptionMnemo, Value? back, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return GameCardsCompanion( id: id ?? this.id, packId: packId ?? this.packId, original: original ?? this.original, translation: translation ?? this.translation, mnemo: mnemo ?? this.mnemo, image: image ?? this.image, imageBack: imageBack ?? this.imageBack, transcription: transcription ?? this.transcription, transcriptionMnemo: transcriptionMnemo ?? this.transcriptionMnemo, back: back ?? this.back, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (packId.present) { map['pack_id'] = Variable(packId.value); } if (original.present) { map['original'] = Variable(original.value); } if (translation.present) { map['translation'] = Variable(translation.value); } if (mnemo.present) { map['mnemo'] = Variable(mnemo.value); } if (image.present) { map['image'] = Variable(image.value); } if (imageBack.present) { map['image_back'] = Variable(imageBack.value); } if (transcription.present) { map['transcription'] = Variable(transcription.value); } if (transcriptionMnemo.present) { map['transcription_mnemo'] = Variable(transcriptionMnemo.value); } if (back.present) { map['back'] = Variable(back.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('GameCardsCompanion(') ..write('id: $id, ') ..write('packId: $packId, ') ..write('original: $original, ') ..write('translation: $translation, ') ..write('mnemo: $mnemo, ') ..write('image: $image, ') ..write('imageBack: $imageBack, ') ..write('transcription: $transcription, ') ..write('transcriptionMnemo: $transcriptionMnemo, ') ..write('back: $back, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $VoiceModelsTable extends VoiceModels with TableInfo<$VoiceModelsTable, VoiceModel> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $VoiceModelsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId'); @override late final GeneratedColumn cardId = GeneratedColumn( 'card_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES game_cards (id) ON DELETE CASCADE')); static const VerificationMeta _voiceUrlMeta = const VerificationMeta('voiceUrl'); @override late final GeneratedColumn voiceUrl = GeneratedColumn( 'voice_url', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _languageMeta = const VerificationMeta('language'); @override late final GeneratedColumn language = GeneratedColumn( 'language', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, cardId, voiceUrl, language, createdAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'voice_models'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('card_id')) { context.handle(_cardIdMeta, cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta)); } else if (isInserting) { context.missing(_cardIdMeta); } if (data.containsKey('voice_url')) { context.handle(_voiceUrlMeta, voiceUrl.isAcceptableOrUnknown(data['voice_url']!, _voiceUrlMeta)); } else if (isInserting) { context.missing(_voiceUrlMeta); } if (data.containsKey('language')) { context.handle(_languageMeta, language.isAcceptableOrUnknown(data['language']!, _languageMeta)); } else if (isInserting) { context.missing(_languageMeta); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override VoiceModel map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return VoiceModel( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, cardId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}card_id'])!, voiceUrl: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}voice_url'])!, language: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}language'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, ); } @override $VoiceModelsTable createAlias(String alias) { return $VoiceModelsTable(attachedDatabase, alias); } } class VoiceModel extends DataClass implements Insertable { final int id; final int cardId; final String voiceUrl; final String language; final DateTime createdAt; const VoiceModel( {required this.id, required this.cardId, required this.voiceUrl, required this.language, required this.createdAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['card_id'] = Variable(cardId); map['voice_url'] = Variable(voiceUrl); map['language'] = Variable(language); map['created_at'] = Variable(createdAt); return map; } VoiceModelsCompanion toCompanion(bool nullToAbsent) { return VoiceModelsCompanion( id: Value(id), cardId: Value(cardId), voiceUrl: Value(voiceUrl), language: Value(language), createdAt: Value(createdAt), ); } factory VoiceModel.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return VoiceModel( id: serializer.fromJson(json['id']), cardId: serializer.fromJson(json['cardId']), voiceUrl: serializer.fromJson(json['voiceUrl']), language: serializer.fromJson(json['language']), createdAt: serializer.fromJson(json['createdAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'cardId': serializer.toJson(cardId), 'voiceUrl': serializer.toJson(voiceUrl), 'language': serializer.toJson(language), 'createdAt': serializer.toJson(createdAt), }; } VoiceModel copyWith( {int? id, int? cardId, String? voiceUrl, String? language, DateTime? createdAt}) => VoiceModel( id: id ?? this.id, cardId: cardId ?? this.cardId, voiceUrl: voiceUrl ?? this.voiceUrl, language: language ?? this.language, createdAt: createdAt ?? this.createdAt, ); @override String toString() { return (StringBuffer('VoiceModel(') ..write('id: $id, ') ..write('cardId: $cardId, ') ..write('voiceUrl: $voiceUrl, ') ..write('language: $language, ') ..write('createdAt: $createdAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, cardId, voiceUrl, language, createdAt); @override bool operator ==(Object other) => identical(this, other) || (other is VoiceModel && other.id == this.id && other.cardId == this.cardId && other.voiceUrl == this.voiceUrl && other.language == this.language && other.createdAt == this.createdAt); } class VoiceModelsCompanion extends UpdateCompanion { final Value id; final Value cardId; final Value voiceUrl; final Value language; final Value createdAt; const VoiceModelsCompanion({ this.id = const Value.absent(), this.cardId = const Value.absent(), this.voiceUrl = const Value.absent(), this.language = const Value.absent(), this.createdAt = const Value.absent(), }); VoiceModelsCompanion.insert({ this.id = const Value.absent(), required int cardId, required String voiceUrl, required String language, this.createdAt = const Value.absent(), }) : cardId = Value(cardId), voiceUrl = Value(voiceUrl), language = Value(language); static Insertable custom({ Expression? id, Expression? cardId, Expression? voiceUrl, Expression? language, Expression? createdAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (cardId != null) 'card_id': cardId, if (voiceUrl != null) 'voice_url': voiceUrl, if (language != null) 'language': language, if (createdAt != null) 'created_at': createdAt, }); } VoiceModelsCompanion copyWith( {Value? id, Value? cardId, Value? voiceUrl, Value? language, Value? createdAt}) { return VoiceModelsCompanion( id: id ?? this.id, cardId: cardId ?? this.cardId, voiceUrl: voiceUrl ?? this.voiceUrl, language: language ?? this.language, createdAt: createdAt ?? this.createdAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (cardId.present) { map['card_id'] = Variable(cardId.value); } if (voiceUrl.present) { map['voice_url'] = Variable(voiceUrl.value); } if (language.present) { map['language'] = Variable(language.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } return map; } @override String toString() { return (StringBuffer('VoiceModelsCompanion(') ..write('id: $id, ') ..write('cardId: $cardId, ') ..write('voiceUrl: $voiceUrl, ') ..write('language: $language, ') ..write('createdAt: $createdAt') ..write(')')) .toString(); } } class $UserPacksTable extends UserPacks with TableInfo<$UserPacksTable, UserPack> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserPacksTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES card_packs (id) ON DELETE CASCADE')); static const VerificationMeta _grantedAtMeta = const VerificationMeta('grantedAt'); @override late final GeneratedColumn grantedAt = GeneratedColumn( 'granted_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _grantTypeMeta = const VerificationMeta('grantType'); @override late final GeneratedColumn grantType = GeneratedColumn( 'grant_type', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('purchase')); @override List get $columns => [userId, packId, grantedAt, grantType]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_packs'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } else if (isInserting) { context.missing(_packIdMeta); } if (data.containsKey('granted_at')) { context.handle(_grantedAtMeta, grantedAt.isAcceptableOrUnknown(data['granted_at']!, _grantedAtMeta)); } if (data.containsKey('grant_type')) { context.handle(_grantTypeMeta, grantType.isAcceptableOrUnknown(data['grant_type']!, _grantTypeMeta)); } return context; } @override Set get $primaryKey => {userId, packId}; @override UserPack map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserPack( userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, packId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}pack_id'])!, grantedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}granted_at'])!, grantType: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}grant_type'])!, ); } @override $UserPacksTable createAlias(String alias) { return $UserPacksTable(attachedDatabase, alias); } } class UserPack extends DataClass implements Insertable { final int userId; final int packId; final DateTime grantedAt; final String grantType; const UserPack( {required this.userId, required this.packId, required this.grantedAt, required this.grantType}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['user_id'] = Variable(userId); map['pack_id'] = Variable(packId); map['granted_at'] = Variable(grantedAt); map['grant_type'] = Variable(grantType); return map; } UserPacksCompanion toCompanion(bool nullToAbsent) { return UserPacksCompanion( userId: Value(userId), packId: Value(packId), grantedAt: Value(grantedAt), grantType: Value(grantType), ); } factory UserPack.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserPack( userId: serializer.fromJson(json['userId']), packId: serializer.fromJson(json['packId']), grantedAt: serializer.fromJson(json['grantedAt']), grantType: serializer.fromJson(json['grantType']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'userId': serializer.toJson(userId), 'packId': serializer.toJson(packId), 'grantedAt': serializer.toJson(grantedAt), 'grantType': serializer.toJson(grantType), }; } UserPack copyWith( {int? userId, int? packId, DateTime? grantedAt, String? grantType}) => UserPack( userId: userId ?? this.userId, packId: packId ?? this.packId, grantedAt: grantedAt ?? this.grantedAt, grantType: grantType ?? this.grantType, ); @override String toString() { return (StringBuffer('UserPack(') ..write('userId: $userId, ') ..write('packId: $packId, ') ..write('grantedAt: $grantedAt, ') ..write('grantType: $grantType') ..write(')')) .toString(); } @override int get hashCode => Object.hash(userId, packId, grantedAt, grantType); @override bool operator ==(Object other) => identical(this, other) || (other is UserPack && other.userId == this.userId && other.packId == this.packId && other.grantedAt == this.grantedAt && other.grantType == this.grantType); } class UserPacksCompanion extends UpdateCompanion { final Value userId; final Value packId; final Value grantedAt; final Value grantType; final Value rowid; const UserPacksCompanion({ this.userId = const Value.absent(), this.packId = const Value.absent(), this.grantedAt = const Value.absent(), this.grantType = const Value.absent(), this.rowid = const Value.absent(), }); UserPacksCompanion.insert({ required int userId, required int packId, this.grantedAt = const Value.absent(), this.grantType = const Value.absent(), this.rowid = const Value.absent(), }) : userId = Value(userId), packId = Value(packId); static Insertable custom({ Expression? userId, Expression? packId, Expression? grantedAt, Expression? grantType, Expression? rowid, }) { return RawValuesInsertable({ if (userId != null) 'user_id': userId, if (packId != null) 'pack_id': packId, if (grantedAt != null) 'granted_at': grantedAt, if (grantType != null) 'grant_type': grantType, if (rowid != null) 'rowid': rowid, }); } UserPacksCompanion copyWith( {Value? userId, Value? packId, Value? grantedAt, Value? grantType, Value? rowid}) { return UserPacksCompanion( userId: userId ?? this.userId, packId: packId ?? this.packId, grantedAt: grantedAt ?? this.grantedAt, grantType: grantType ?? this.grantType, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (userId.present) { map['user_id'] = Variable(userId.value); } if (packId.present) { map['pack_id'] = Variable(packId.value); } if (grantedAt.present) { map['granted_at'] = Variable(grantedAt.value); } if (grantType.present) { map['grant_type'] = Variable(grantType.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('UserPacksCompanion(') ..write('userId: $userId, ') ..write('packId: $packId, ') ..write('grantedAt: $grantedAt, ') ..write('grantType: $grantType, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $PreviewCardsTable extends PreviewCards with TableInfo<$PreviewCardsTable, PreviewCard> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $PreviewCardsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES card_packs (id) ON DELETE CASCADE')); static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId'); @override late final GeneratedColumn cardId = GeneratedColumn( 'card_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES game_cards (id) ON DELETE CASCADE')); static const VerificationMeta _orderMeta = const VerificationMeta('order'); @override late final GeneratedColumn order = GeneratedColumn( 'order', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); @override List get $columns => [packId, cardId, order]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'preview_cards'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } else if (isInserting) { context.missing(_packIdMeta); } if (data.containsKey('card_id')) { context.handle(_cardIdMeta, cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta)); } else if (isInserting) { context.missing(_cardIdMeta); } if (data.containsKey('order')) { context.handle( _orderMeta, order.isAcceptableOrUnknown(data['order']!, _orderMeta)); } return context; } @override Set get $primaryKey => {packId, cardId}; @override PreviewCard map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return PreviewCard( packId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}pack_id'])!, cardId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}card_id'])!, order: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}order'])!, ); } @override $PreviewCardsTable createAlias(String alias) { return $PreviewCardsTable(attachedDatabase, alias); } } class PreviewCard extends DataClass implements Insertable { final int packId; final int cardId; final int order; const PreviewCard( {required this.packId, required this.cardId, required this.order}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['pack_id'] = Variable(packId); map['card_id'] = Variable(cardId); map['order'] = Variable(order); return map; } PreviewCardsCompanion toCompanion(bool nullToAbsent) { return PreviewCardsCompanion( packId: Value(packId), cardId: Value(cardId), order: Value(order), ); } factory PreviewCard.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return PreviewCard( packId: serializer.fromJson(json['packId']), cardId: serializer.fromJson(json['cardId']), order: serializer.fromJson(json['order']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'packId': serializer.toJson(packId), 'cardId': serializer.toJson(cardId), 'order': serializer.toJson(order), }; } PreviewCard copyWith({int? packId, int? cardId, int? order}) => PreviewCard( packId: packId ?? this.packId, cardId: cardId ?? this.cardId, order: order ?? this.order, ); @override String toString() { return (StringBuffer('PreviewCard(') ..write('packId: $packId, ') ..write('cardId: $cardId, ') ..write('order: $order') ..write(')')) .toString(); } @override int get hashCode => Object.hash(packId, cardId, order); @override bool operator ==(Object other) => identical(this, other) || (other is PreviewCard && other.packId == this.packId && other.cardId == this.cardId && other.order == this.order); } class PreviewCardsCompanion extends UpdateCompanion { final Value packId; final Value cardId; final Value order; final Value rowid; const PreviewCardsCompanion({ this.packId = const Value.absent(), this.cardId = const Value.absent(), this.order = const Value.absent(), this.rowid = const Value.absent(), }); PreviewCardsCompanion.insert({ required int packId, required int cardId, this.order = const Value.absent(), this.rowid = const Value.absent(), }) : packId = Value(packId), cardId = Value(cardId); static Insertable custom({ Expression? packId, Expression? cardId, Expression? order, Expression? rowid, }) { return RawValuesInsertable({ if (packId != null) 'pack_id': packId, if (cardId != null) 'card_id': cardId, if (order != null) 'order': order, if (rowid != null) 'rowid': rowid, }); } PreviewCardsCompanion copyWith( {Value? packId, Value? cardId, Value? order, Value? rowid}) { return PreviewCardsCompanion( packId: packId ?? this.packId, cardId: cardId ?? this.cardId, order: order ?? this.order, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (packId.present) { map['pack_id'] = Variable(packId.value); } if (cardId.present) { map['card_id'] = Variable(cardId.value); } if (order.present) { map['order'] = Variable(order.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('PreviewCardsCompanion(') ..write('packId: $packId, ') ..write('cardId: $cardId, ') ..write('order: $order, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $CardPackCardsTable extends CardPackCards with TableInfo<$CardPackCardsTable, CardPackCard> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $CardPackCardsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES card_packs (id) ON DELETE CASCADE')); static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId'); @override late final GeneratedColumn cardId = GeneratedColumn( 'card_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES game_cards (id) ON DELETE CASCADE')); static const VerificationMeta _orderMeta = const VerificationMeta('order'); @override late final GeneratedColumn order = GeneratedColumn( 'order', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); @override List get $columns => [packId, cardId, order]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'card_pack_cards'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } else if (isInserting) { context.missing(_packIdMeta); } if (data.containsKey('card_id')) { context.handle(_cardIdMeta, cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta)); } else if (isInserting) { context.missing(_cardIdMeta); } if (data.containsKey('order')) { context.handle( _orderMeta, order.isAcceptableOrUnknown(data['order']!, _orderMeta)); } return context; } @override Set get $primaryKey => {packId, cardId}; @override CardPackCard map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return CardPackCard( packId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}pack_id'])!, cardId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}card_id'])!, order: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}order'])!, ); } @override $CardPackCardsTable createAlias(String alias) { return $CardPackCardsTable(attachedDatabase, alias); } } class CardPackCard extends DataClass implements Insertable { final int packId; final int cardId; final int order; const CardPackCard( {required this.packId, required this.cardId, required this.order}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['pack_id'] = Variable(packId); map['card_id'] = Variable(cardId); map['order'] = Variable(order); return map; } CardPackCardsCompanion toCompanion(bool nullToAbsent) { return CardPackCardsCompanion( packId: Value(packId), cardId: Value(cardId), order: Value(order), ); } factory CardPackCard.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return CardPackCard( packId: serializer.fromJson(json['packId']), cardId: serializer.fromJson(json['cardId']), order: serializer.fromJson(json['order']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'packId': serializer.toJson(packId), 'cardId': serializer.toJson(cardId), 'order': serializer.toJson(order), }; } CardPackCard copyWith({int? packId, int? cardId, int? order}) => CardPackCard( packId: packId ?? this.packId, cardId: cardId ?? this.cardId, order: order ?? this.order, ); @override String toString() { return (StringBuffer('CardPackCard(') ..write('packId: $packId, ') ..write('cardId: $cardId, ') ..write('order: $order') ..write(')')) .toString(); } @override int get hashCode => Object.hash(packId, cardId, order); @override bool operator ==(Object other) => identical(this, other) || (other is CardPackCard && other.packId == this.packId && other.cardId == this.cardId && other.order == this.order); } class CardPackCardsCompanion extends UpdateCompanion { final Value packId; final Value cardId; final Value order; final Value rowid; const CardPackCardsCompanion({ this.packId = const Value.absent(), this.cardId = const Value.absent(), this.order = const Value.absent(), this.rowid = const Value.absent(), }); CardPackCardsCompanion.insert({ required int packId, required int cardId, this.order = const Value.absent(), this.rowid = const Value.absent(), }) : packId = Value(packId), cardId = Value(cardId); static Insertable custom({ Expression? packId, Expression? cardId, Expression? order, Expression? rowid, }) { return RawValuesInsertable({ if (packId != null) 'pack_id': packId, if (cardId != null) 'card_id': cardId, if (order != null) 'order': order, if (rowid != null) 'rowid': rowid, }); } CardPackCardsCompanion copyWith( {Value? packId, Value? cardId, Value? order, Value? rowid}) { return CardPackCardsCompanion( packId: packId ?? this.packId, cardId: cardId ?? this.cardId, order: order ?? this.order, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (packId.present) { map['pack_id'] = Variable(packId.value); } if (cardId.present) { map['card_id'] = Variable(cardId.value); } if (order.present) { map['order'] = Variable(order.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('CardPackCardsCompanion(') ..write('packId: $packId, ') ..write('cardId: $cardId, ') ..write('order: $order, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $CardVoicesTable extends CardVoices with TableInfo<$CardVoicesTable, CardVoice> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $CardVoicesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId'); @override late final GeneratedColumn cardId = GeneratedColumn( 'card_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES game_cards (id) ON DELETE CASCADE')); static const VerificationMeta _voiceIdMeta = const VerificationMeta('voiceId'); @override late final GeneratedColumn voiceId = GeneratedColumn( 'voice_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES voice_models (id) ON DELETE CASCADE')); @override List get $columns => [cardId, voiceId]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'card_voices'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('card_id')) { context.handle(_cardIdMeta, cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta)); } else if (isInserting) { context.missing(_cardIdMeta); } if (data.containsKey('voice_id')) { context.handle(_voiceIdMeta, voiceId.isAcceptableOrUnknown(data['voice_id']!, _voiceIdMeta)); } else if (isInserting) { context.missing(_voiceIdMeta); } return context; } @override Set get $primaryKey => {cardId, voiceId}; @override CardVoice map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return CardVoice( cardId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}card_id'])!, voiceId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}voice_id'])!, ); } @override $CardVoicesTable createAlias(String alias) { return $CardVoicesTable(attachedDatabase, alias); } } class CardVoice extends DataClass implements Insertable { final int cardId; final int voiceId; const CardVoice({required this.cardId, required this.voiceId}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['card_id'] = Variable(cardId); map['voice_id'] = Variable(voiceId); return map; } CardVoicesCompanion toCompanion(bool nullToAbsent) { return CardVoicesCompanion( cardId: Value(cardId), voiceId: Value(voiceId), ); } factory CardVoice.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return CardVoice( cardId: serializer.fromJson(json['cardId']), voiceId: serializer.fromJson(json['voiceId']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'cardId': serializer.toJson(cardId), 'voiceId': serializer.toJson(voiceId), }; } CardVoice copyWith({int? cardId, int? voiceId}) => CardVoice( cardId: cardId ?? this.cardId, voiceId: voiceId ?? this.voiceId, ); @override String toString() { return (StringBuffer('CardVoice(') ..write('cardId: $cardId, ') ..write('voiceId: $voiceId') ..write(')')) .toString(); } @override int get hashCode => Object.hash(cardId, voiceId); @override bool operator ==(Object other) => identical(this, other) || (other is CardVoice && other.cardId == this.cardId && other.voiceId == this.voiceId); } class CardVoicesCompanion extends UpdateCompanion { final Value cardId; final Value voiceId; final Value rowid; const CardVoicesCompanion({ this.cardId = const Value.absent(), this.voiceId = const Value.absent(), this.rowid = const Value.absent(), }); CardVoicesCompanion.insert({ required int cardId, required int voiceId, this.rowid = const Value.absent(), }) : cardId = Value(cardId), voiceId = Value(voiceId); static Insertable custom({ Expression? cardId, Expression? voiceId, Expression? rowid, }) { return RawValuesInsertable({ if (cardId != null) 'card_id': cardId, if (voiceId != null) 'voice_id': voiceId, if (rowid != null) 'rowid': rowid, }); } CardVoicesCompanion copyWith( {Value? cardId, Value? voiceId, Value? rowid}) { return CardVoicesCompanion( cardId: cardId ?? this.cardId, voiceId: voiceId ?? this.voiceId, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (cardId.present) { map['card_id'] = Variable(cardId.value); } if (voiceId.present) { map['voice_id'] = Variable(voiceId.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('CardVoicesCompanion(') ..write('cardId: $cardId, ') ..write('voiceId: $voiceId, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $SubscriptionPlansTable extends SubscriptionPlans with TableInfo<$SubscriptionPlansTable, SubscriptionPlan> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $SubscriptionPlansTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _uiMeta = const VerificationMeta('ui'); @override late final GeneratedColumnWithTypeConverter?, String> ui = GeneratedColumn('ui', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false) .withConverter?>( $SubscriptionPlansTable.$converterui); static const VerificationMeta _priceMeta = const VerificationMeta('price'); @override late final GeneratedColumn price = GeneratedColumn( 'price', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _currencyMeta = const VerificationMeta('currency'); @override late final GeneratedColumn currency = GeneratedColumn( 'currency', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _durationDaysMeta = const VerificationMeta('durationDays'); @override late final GeneratedColumn durationDays = GeneratedColumn( 'duration_days', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _featuresMeta = const VerificationMeta('features'); @override late final GeneratedColumnWithTypeConverter?, String> features = GeneratedColumn('features', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>( $SubscriptionPlansTable.$converterfeatures); static const VerificationMeta _paymentIdMeta = const VerificationMeta('paymentId'); @override late final GeneratedColumn paymentId = GeneratedColumn( 'payment_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _paymentSystemMeta = const VerificationMeta('paymentSystem'); @override late final GeneratedColumn paymentSystem = GeneratedColumn( 'payment_system', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, ui, price, currency, durationDays, features, paymentId, paymentSystem, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'subscription_plans'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } context.handle(_uiMeta, const VerificationResult.success()); if (data.containsKey('price')) { context.handle( _priceMeta, price.isAcceptableOrUnknown(data['price']!, _priceMeta)); } else if (isInserting) { context.missing(_priceMeta); } if (data.containsKey('currency')) { context.handle(_currencyMeta, currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta)); } else if (isInserting) { context.missing(_currencyMeta); } if (data.containsKey('duration_days')) { context.handle( _durationDaysMeta, durationDays.isAcceptableOrUnknown( data['duration_days']!, _durationDaysMeta)); } else if (isInserting) { context.missing(_durationDaysMeta); } context.handle(_featuresMeta, const VerificationResult.success()); if (data.containsKey('payment_id')) { context.handle(_paymentIdMeta, paymentId.isAcceptableOrUnknown(data['payment_id']!, _paymentIdMeta)); } if (data.containsKey('payment_system')) { context.handle( _paymentSystemMeta, paymentSystem.isAcceptableOrUnknown( data['payment_system']!, _paymentSystemMeta)); } else if (isInserting) { context.missing(_paymentSystemMeta); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override SubscriptionPlan map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return SubscriptionPlan( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, ui: $SubscriptionPlansTable.$converterui.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}ui'])), price: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}price'])!, currency: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}currency'])!, durationDays: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}duration_days'])!, features: $SubscriptionPlansTable.$converterfeatures.fromSql( attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}features'])!), paymentId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}payment_id']), paymentSystem: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}payment_system'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $SubscriptionPlansTable createAlias(String alias) { return $SubscriptionPlansTable(attachedDatabase, alias); } static TypeConverter?, String?> $converterui = NullAwareTypeConverter.wrap(const JsonMapConverter()); static TypeConverter?, String> $converterfeatures = const JsonListConverter(); } class SubscriptionPlan extends DataClass implements Insertable { final int id; final Map? ui; final String price; final String currency; final int durationDays; final List? features; final String? paymentId; final String paymentSystem; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const SubscriptionPlan( {required this.id, this.ui, required this.price, required this.currency, required this.durationDays, this.features, this.paymentId, required this.paymentSystem, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); if (!nullToAbsent || ui != null) { map['ui'] = Variable($SubscriptionPlansTable.$converterui.toSql(ui)); } map['price'] = Variable(price); map['currency'] = Variable(currency); map['duration_days'] = Variable(durationDays); if (!nullToAbsent || features != null) { map['features'] = Variable( $SubscriptionPlansTable.$converterfeatures.toSql(features)); } if (!nullToAbsent || paymentId != null) { map['payment_id'] = Variable(paymentId); } map['payment_system'] = Variable(paymentSystem); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } SubscriptionPlansCompanion toCompanion(bool nullToAbsent) { return SubscriptionPlansCompanion( id: Value(id), ui: ui == null && nullToAbsent ? const Value.absent() : Value(ui), price: Value(price), currency: Value(currency), durationDays: Value(durationDays), features: features == null && nullToAbsent ? const Value.absent() : Value(features), paymentId: paymentId == null && nullToAbsent ? const Value.absent() : Value(paymentId), paymentSystem: Value(paymentSystem), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory SubscriptionPlan.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return SubscriptionPlan( id: serializer.fromJson(json['id']), ui: serializer.fromJson?>(json['ui']), price: serializer.fromJson(json['price']), currency: serializer.fromJson(json['currency']), durationDays: serializer.fromJson(json['durationDays']), features: serializer.fromJson?>(json['features']), paymentId: serializer.fromJson(json['paymentId']), paymentSystem: serializer.fromJson(json['paymentSystem']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'ui': serializer.toJson?>(ui), 'price': serializer.toJson(price), 'currency': serializer.toJson(currency), 'durationDays': serializer.toJson(durationDays), 'features': serializer.toJson?>(features), 'paymentId': serializer.toJson(paymentId), 'paymentSystem': serializer.toJson(paymentSystem), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } SubscriptionPlan copyWith( {int? id, Value?> ui = const Value.absent(), String? price, String? currency, int? durationDays, Value?> features = const Value.absent(), Value paymentId = const Value.absent(), String? paymentSystem, DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => SubscriptionPlan( id: id ?? this.id, ui: ui.present ? ui.value : this.ui, price: price ?? this.price, currency: currency ?? this.currency, durationDays: durationDays ?? this.durationDays, features: features.present ? features.value : this.features, paymentId: paymentId.present ? paymentId.value : this.paymentId, paymentSystem: paymentSystem ?? this.paymentSystem, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('SubscriptionPlan(') ..write('id: $id, ') ..write('ui: $ui, ') ..write('price: $price, ') ..write('currency: $currency, ') ..write('durationDays: $durationDays, ') ..write('features: $features, ') ..write('paymentId: $paymentId, ') ..write('paymentSystem: $paymentSystem, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, ui, price, currency, durationDays, features, paymentId, paymentSystem, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is SubscriptionPlan && other.id == this.id && other.ui == this.ui && other.price == this.price && other.currency == this.currency && other.durationDays == this.durationDays && other.features == this.features && other.paymentId == this.paymentId && other.paymentSystem == this.paymentSystem && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class SubscriptionPlansCompanion extends UpdateCompanion { final Value id; final Value?> ui; final Value price; final Value currency; final Value durationDays; final Value?> features; final Value paymentId; final Value paymentSystem; final Value createdAt; final Value updatedAt; final Value isDeleted; const SubscriptionPlansCompanion({ this.id = const Value.absent(), this.ui = const Value.absent(), this.price = const Value.absent(), this.currency = const Value.absent(), this.durationDays = const Value.absent(), this.features = const Value.absent(), this.paymentId = const Value.absent(), this.paymentSystem = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); SubscriptionPlansCompanion.insert({ this.id = const Value.absent(), this.ui = const Value.absent(), required String price, required String currency, required int durationDays, this.features = const Value.absent(), this.paymentId = const Value.absent(), required String paymentSystem, this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : price = Value(price), currency = Value(currency), durationDays = Value(durationDays), paymentSystem = Value(paymentSystem); static Insertable custom({ Expression? id, Expression? ui, Expression? price, Expression? currency, Expression? durationDays, Expression? features, Expression? paymentId, Expression? paymentSystem, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (ui != null) 'ui': ui, if (price != null) 'price': price, if (currency != null) 'currency': currency, if (durationDays != null) 'duration_days': durationDays, if (features != null) 'features': features, if (paymentId != null) 'payment_id': paymentId, if (paymentSystem != null) 'payment_system': paymentSystem, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } SubscriptionPlansCompanion copyWith( {Value? id, Value?>? ui, Value? price, Value? currency, Value? durationDays, Value?>? features, Value? paymentId, Value? paymentSystem, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return SubscriptionPlansCompanion( id: id ?? this.id, ui: ui ?? this.ui, price: price ?? this.price, currency: currency ?? this.currency, durationDays: durationDays ?? this.durationDays, features: features ?? this.features, paymentId: paymentId ?? this.paymentId, paymentSystem: paymentSystem ?? this.paymentSystem, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (ui.present) { map['ui'] = Variable( $SubscriptionPlansTable.$converterui.toSql(ui.value)); } if (price.present) { map['price'] = Variable(price.value); } if (currency.present) { map['currency'] = Variable(currency.value); } if (durationDays.present) { map['duration_days'] = Variable(durationDays.value); } if (features.present) { map['features'] = Variable( $SubscriptionPlansTable.$converterfeatures.toSql(features.value)); } if (paymentId.present) { map['payment_id'] = Variable(paymentId.value); } if (paymentSystem.present) { map['payment_system'] = Variable(paymentSystem.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('SubscriptionPlansCompanion(') ..write('id: $id, ') ..write('ui: $ui, ') ..write('price: $price, ') ..write('currency: $currency, ') ..write('durationDays: $durationDays, ') ..write('features: $features, ') ..write('paymentId: $paymentId, ') ..write('paymentSystem: $paymentSystem, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $UserSubscriptionsTable extends UserSubscriptions with TableInfo<$UserSubscriptionsTable, UserSubscription> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserSubscriptionsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'UNIQUE REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _startMeta = const VerificationMeta('start'); @override late final GeneratedColumn start = GeneratedColumn( 'start', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _finishMeta = const VerificationMeta('finish'); @override late final GeneratedColumn finish = GeneratedColumn( 'finish', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _featuresMeta = const VerificationMeta('features'); @override late final GeneratedColumnWithTypeConverter?, String> features = GeneratedColumn('features', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>( $UserSubscriptionsTable.$converterfeatures); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, userId, start, finish, features, createdAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_subscriptions'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('start')) { context.handle( _startMeta, start.isAcceptableOrUnknown(data['start']!, _startMeta)); } else if (isInserting) { context.missing(_startMeta); } if (data.containsKey('finish')) { context.handle(_finishMeta, finish.isAcceptableOrUnknown(data['finish']!, _finishMeta)); } else if (isInserting) { context.missing(_finishMeta); } context.handle(_featuresMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserSubscription map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserSubscription( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, start: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}start'])!, finish: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}finish'])!, features: $UserSubscriptionsTable.$converterfeatures.fromSql( attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}features'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $UserSubscriptionsTable createAlias(String alias) { return $UserSubscriptionsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterfeatures = const JsonListConverter(); } class UserSubscription extends DataClass implements Insertable { final int id; final int userId; final DateTime start; final DateTime finish; final List? features; final DateTime createdAt; final DateTime updatedAt; const UserSubscription( {required this.id, required this.userId, required this.start, required this.finish, this.features, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['start'] = Variable(start); map['finish'] = Variable(finish); if (!nullToAbsent || features != null) { map['features'] = Variable( $UserSubscriptionsTable.$converterfeatures.toSql(features)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } UserSubscriptionsCompanion toCompanion(bool nullToAbsent) { return UserSubscriptionsCompanion( id: Value(id), userId: Value(userId), start: Value(start), finish: Value(finish), features: features == null && nullToAbsent ? const Value.absent() : Value(features), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory UserSubscription.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserSubscription( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), start: serializer.fromJson(json['start']), finish: serializer.fromJson(json['finish']), features: serializer.fromJson?>(json['features']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'start': serializer.toJson(start), 'finish': serializer.toJson(finish), 'features': serializer.toJson?>(features), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } UserSubscription copyWith( {int? id, int? userId, DateTime? start, DateTime? finish, Value?> features = const Value.absent(), DateTime? createdAt, DateTime? updatedAt}) => UserSubscription( id: id ?? this.id, userId: userId ?? this.userId, start: start ?? this.start, finish: finish ?? this.finish, features: features.present ? features.value : this.features, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('UserSubscription(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('features: $features, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, userId, start, finish, features, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserSubscription && other.id == this.id && other.userId == this.userId && other.start == this.start && other.finish == this.finish && other.features == this.features && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class UserSubscriptionsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value start; final Value finish; final Value?> features; final Value createdAt; final Value updatedAt; const UserSubscriptionsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.start = const Value.absent(), this.finish = const Value.absent(), this.features = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); UserSubscriptionsCompanion.insert({ this.id = const Value.absent(), required int userId, required DateTime start, required DateTime finish, this.features = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), start = Value(start), finish = Value(finish); static Insertable custom({ Expression? id, Expression? userId, Expression? start, Expression? finish, Expression? features, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (start != null) 'start': start, if (finish != null) 'finish': finish, if (features != null) 'features': features, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } UserSubscriptionsCompanion copyWith( {Value? id, Value? userId, Value? start, Value? finish, Value?>? features, Value? createdAt, Value? updatedAt}) { return UserSubscriptionsCompanion( id: id ?? this.id, userId: userId ?? this.userId, start: start ?? this.start, finish: finish ?? this.finish, features: features ?? this.features, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (start.present) { map['start'] = Variable(start.value); } if (finish.present) { map['finish'] = Variable(finish.value); } if (features.present) { map['features'] = Variable( $UserSubscriptionsTable.$converterfeatures.toSql(features.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('UserSubscriptionsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('features: $features, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $PaymentsTable extends Payments with TableInfo<$PaymentsTable, Payment> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $PaymentsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _amountMeta = const VerificationMeta('amount'); @override late final GeneratedColumn amount = GeneratedColumn( 'amount', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _currencyMeta = const VerificationMeta('currency'); @override late final GeneratedColumn currency = GeneratedColumn( 'currency', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( 'status', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _paymentSystemMeta = const VerificationMeta('paymentSystem'); @override late final GeneratedColumn paymentSystem = GeneratedColumn( 'payment_system', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _externalTokenMeta = const VerificationMeta('externalToken'); @override late final GeneratedColumn externalToken = GeneratedColumn( 'external_token', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _metaMeta = const VerificationMeta('meta'); @override late final GeneratedColumn meta = GeneratedColumn( 'meta', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _dateMeta = const VerificationMeta('date'); @override late final GeneratedColumn date = GeneratedColumn( 'date', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _productsMeta = const VerificationMeta('products'); @override late final GeneratedColumnWithTypeConverter?, String> products = GeneratedColumn('products', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>($PaymentsTable.$converterproducts); static const VerificationMeta _packsMeta = const VerificationMeta('packs'); @override late final GeneratedColumnWithTypeConverter, String> packs = GeneratedColumn('packs', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($PaymentsTable.$converterpacks); static const VerificationMeta _subscriptionMeta = const VerificationMeta('subscription'); @override late final GeneratedColumn subscription = GeneratedColumn( 'subscription', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways( 'CHECK ("subscription" IN (0, 1))'), defaultValue: const Constant(false)); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, userId, amount, currency, status, paymentSystem, externalToken, meta, date, products, packs, subscription, createdAt, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'payments'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('amount')) { context.handle(_amountMeta, amount.isAcceptableOrUnknown(data['amount']!, _amountMeta)); } else if (isInserting) { context.missing(_amountMeta); } if (data.containsKey('currency')) { context.handle(_currencyMeta, currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta)); } else if (isInserting) { context.missing(_currencyMeta); } if (data.containsKey('status')) { context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); } else if (isInserting) { context.missing(_statusMeta); } if (data.containsKey('payment_system')) { context.handle( _paymentSystemMeta, paymentSystem.isAcceptableOrUnknown( data['payment_system']!, _paymentSystemMeta)); } else if (isInserting) { context.missing(_paymentSystemMeta); } if (data.containsKey('external_token')) { context.handle( _externalTokenMeta, externalToken.isAcceptableOrUnknown( data['external_token']!, _externalTokenMeta)); } if (data.containsKey('meta')) { context.handle( _metaMeta, meta.isAcceptableOrUnknown(data['meta']!, _metaMeta)); } if (data.containsKey('date')) { context.handle( _dateMeta, date.isAcceptableOrUnknown(data['date']!, _dateMeta)); } context.handle(_productsMeta, const VerificationResult.success()); context.handle(_packsMeta, const VerificationResult.success()); if (data.containsKey('subscription')) { context.handle( _subscriptionMeta, subscription.isAcceptableOrUnknown( data['subscription']!, _subscriptionMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override Payment map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Payment( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, amount: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}amount'])!, currency: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}currency'])!, status: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}status'])!, paymentSystem: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}payment_system'])!, externalToken: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}external_token']), meta: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}meta']), date: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}date'])!, products: $PaymentsTable.$converterproducts.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}products'])!), packs: $PaymentsTable.$converterpacks.fromSql(attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}packs'])!), subscription: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}subscription'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $PaymentsTable createAlias(String alias) { return $PaymentsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterproducts = const JsonListConverter(); static TypeConverter, String> $converterpacks = const StringListConverter(); } class Payment extends DataClass implements Insertable { final int id; final int userId; final String amount; final String currency; final String status; final String paymentSystem; final String? externalToken; final String? meta; final DateTime date; final List? products; final List packs; final bool subscription; final DateTime createdAt; final DateTime updatedAt; const Payment( {required this.id, required this.userId, required this.amount, required this.currency, required this.status, required this.paymentSystem, this.externalToken, this.meta, required this.date, this.products, required this.packs, required this.subscription, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['amount'] = Variable(amount); map['currency'] = Variable(currency); map['status'] = Variable(status); map['payment_system'] = Variable(paymentSystem); if (!nullToAbsent || externalToken != null) { map['external_token'] = Variable(externalToken); } if (!nullToAbsent || meta != null) { map['meta'] = Variable(meta); } map['date'] = Variable(date); if (!nullToAbsent || products != null) { map['products'] = Variable($PaymentsTable.$converterproducts.toSql(products)); } { map['packs'] = Variable($PaymentsTable.$converterpacks.toSql(packs)); } map['subscription'] = Variable(subscription); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } PaymentsCompanion toCompanion(bool nullToAbsent) { return PaymentsCompanion( id: Value(id), userId: Value(userId), amount: Value(amount), currency: Value(currency), status: Value(status), paymentSystem: Value(paymentSystem), externalToken: externalToken == null && nullToAbsent ? const Value.absent() : Value(externalToken), meta: meta == null && nullToAbsent ? const Value.absent() : Value(meta), date: Value(date), products: products == null && nullToAbsent ? const Value.absent() : Value(products), packs: Value(packs), subscription: Value(subscription), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory Payment.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Payment( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), amount: serializer.fromJson(json['amount']), currency: serializer.fromJson(json['currency']), status: serializer.fromJson(json['status']), paymentSystem: serializer.fromJson(json['paymentSystem']), externalToken: serializer.fromJson(json['externalToken']), meta: serializer.fromJson(json['meta']), date: serializer.fromJson(json['date']), products: serializer.fromJson?>(json['products']), packs: serializer.fromJson>(json['packs']), subscription: serializer.fromJson(json['subscription']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'amount': serializer.toJson(amount), 'currency': serializer.toJson(currency), 'status': serializer.toJson(status), 'paymentSystem': serializer.toJson(paymentSystem), 'externalToken': serializer.toJson(externalToken), 'meta': serializer.toJson(meta), 'date': serializer.toJson(date), 'products': serializer.toJson?>(products), 'packs': serializer.toJson>(packs), 'subscription': serializer.toJson(subscription), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } Payment copyWith( {int? id, int? userId, String? amount, String? currency, String? status, String? paymentSystem, Value externalToken = const Value.absent(), Value meta = const Value.absent(), DateTime? date, Value?> products = const Value.absent(), List? packs, bool? subscription, DateTime? createdAt, DateTime? updatedAt}) => Payment( id: id ?? this.id, userId: userId ?? this.userId, amount: amount ?? this.amount, currency: currency ?? this.currency, status: status ?? this.status, paymentSystem: paymentSystem ?? this.paymentSystem, externalToken: externalToken.present ? externalToken.value : this.externalToken, meta: meta.present ? meta.value : this.meta, date: date ?? this.date, products: products.present ? products.value : this.products, packs: packs ?? this.packs, subscription: subscription ?? this.subscription, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('Payment(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('amount: $amount, ') ..write('currency: $currency, ') ..write('status: $status, ') ..write('paymentSystem: $paymentSystem, ') ..write('externalToken: $externalToken, ') ..write('meta: $meta, ') ..write('date: $date, ') ..write('products: $products, ') ..write('packs: $packs, ') ..write('subscription: $subscription, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, userId, amount, currency, status, paymentSystem, externalToken, meta, date, products, packs, subscription, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is Payment && other.id == this.id && other.userId == this.userId && other.amount == this.amount && other.currency == this.currency && other.status == this.status && other.paymentSystem == this.paymentSystem && other.externalToken == this.externalToken && other.meta == this.meta && other.date == this.date && other.products == this.products && other.packs == this.packs && other.subscription == this.subscription && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class PaymentsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value amount; final Value currency; final Value status; final Value paymentSystem; final Value externalToken; final Value meta; final Value date; final Value?> products; final Value> packs; final Value subscription; final Value createdAt; final Value updatedAt; const PaymentsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.amount = const Value.absent(), this.currency = const Value.absent(), this.status = const Value.absent(), this.paymentSystem = const Value.absent(), this.externalToken = const Value.absent(), this.meta = const Value.absent(), this.date = const Value.absent(), this.products = const Value.absent(), this.packs = const Value.absent(), this.subscription = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); PaymentsCompanion.insert({ this.id = const Value.absent(), required int userId, required String amount, required String currency, required String status, required String paymentSystem, this.externalToken = const Value.absent(), this.meta = const Value.absent(), this.date = const Value.absent(), this.products = const Value.absent(), this.packs = const Value.absent(), this.subscription = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), amount = Value(amount), currency = Value(currency), status = Value(status), paymentSystem = Value(paymentSystem); static Insertable custom({ Expression? id, Expression? userId, Expression? amount, Expression? currency, Expression? status, Expression? paymentSystem, Expression? externalToken, Expression? meta, Expression? date, Expression? products, Expression? packs, Expression? subscription, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (amount != null) 'amount': amount, if (currency != null) 'currency': currency, if (status != null) 'status': status, if (paymentSystem != null) 'payment_system': paymentSystem, if (externalToken != null) 'external_token': externalToken, if (meta != null) 'meta': meta, if (date != null) 'date': date, if (products != null) 'products': products, if (packs != null) 'packs': packs, if (subscription != null) 'subscription': subscription, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } PaymentsCompanion copyWith( {Value? id, Value? userId, Value? amount, Value? currency, Value? status, Value? paymentSystem, Value? externalToken, Value? meta, Value? date, Value?>? products, Value>? packs, Value? subscription, Value? createdAt, Value? updatedAt}) { return PaymentsCompanion( id: id ?? this.id, userId: userId ?? this.userId, amount: amount ?? this.amount, currency: currency ?? this.currency, status: status ?? this.status, paymentSystem: paymentSystem ?? this.paymentSystem, externalToken: externalToken ?? this.externalToken, meta: meta ?? this.meta, date: date ?? this.date, products: products ?? this.products, packs: packs ?? this.packs, subscription: subscription ?? this.subscription, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (amount.present) { map['amount'] = Variable(amount.value); } if (currency.present) { map['currency'] = Variable(currency.value); } if (status.present) { map['status'] = Variable(status.value); } if (paymentSystem.present) { map['payment_system'] = Variable(paymentSystem.value); } if (externalToken.present) { map['external_token'] = Variable(externalToken.value); } if (meta.present) { map['meta'] = Variable(meta.value); } if (date.present) { map['date'] = Variable(date.value); } if (products.present) { map['products'] = Variable( $PaymentsTable.$converterproducts.toSql(products.value)); } if (packs.present) { map['packs'] = Variable($PaymentsTable.$converterpacks.toSql(packs.value)); } if (subscription.present) { map['subscription'] = Variable(subscription.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('PaymentsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('amount: $amount, ') ..write('currency: $currency, ') ..write('status: $status, ') ..write('paymentSystem: $paymentSystem, ') ..write('externalToken: $externalToken, ') ..write('meta: $meta, ') ..write('date: $date, ') ..write('products: $products, ') ..write('packs: $packs, ') ..write('subscription: $subscription, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $TestsTable extends Tests with TableInfo<$TestsTable, Test> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TestsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _colorMeta = const VerificationMeta('color'); @override late final GeneratedColumn color = GeneratedColumn( 'color', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _coverMeta = const VerificationMeta('cover'); @override late final GeneratedColumn cover = GeneratedColumn( 'cover', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _versionMeta = const VerificationMeta('version'); @override late final GeneratedColumn version = GeneratedColumn( 'version', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _timeMeta = const VerificationMeta('time'); @override late final GeneratedColumn time = GeneratedColumn( 'time', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _timeSubtitleMeta = const VerificationMeta('timeSubtitle'); @override late final GeneratedColumn timeSubtitle = GeneratedColumn( 'time_subtitle', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, name, color, cover, version, time, timeSubtitle, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'tests'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } if (data.containsKey('color')) { context.handle( _colorMeta, color.isAcceptableOrUnknown(data['color']!, _colorMeta)); } if (data.containsKey('cover')) { context.handle( _coverMeta, cover.isAcceptableOrUnknown(data['cover']!, _coverMeta)); } if (data.containsKey('version')) { context.handle(_versionMeta, version.isAcceptableOrUnknown(data['version']!, _versionMeta)); } if (data.containsKey('time')) { context.handle( _timeMeta, time.isAcceptableOrUnknown(data['time']!, _timeMeta)); } if (data.containsKey('time_subtitle')) { context.handle( _timeSubtitleMeta, timeSubtitle.isAcceptableOrUnknown( data['time_subtitle']!, _timeSubtitleMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override Test map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Test( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, color: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}color']), cover: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}cover']), version: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}version']), time: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}time']), timeSubtitle: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}time_subtitle']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $TestsTable createAlias(String alias) { return $TestsTable(attachedDatabase, alias); } } class Test extends DataClass implements Insertable { final int id; final String name; final String? color; final String? cover; final String? version; final String? time; final String? timeSubtitle; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const Test( {required this.id, required this.name, this.color, this.cover, this.version, this.time, this.timeSubtitle, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); if (!nullToAbsent || color != null) { map['color'] = Variable(color); } if (!nullToAbsent || cover != null) { map['cover'] = Variable(cover); } if (!nullToAbsent || version != null) { map['version'] = Variable(version); } if (!nullToAbsent || time != null) { map['time'] = Variable(time); } if (!nullToAbsent || timeSubtitle != null) { map['time_subtitle'] = Variable(timeSubtitle); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } TestsCompanion toCompanion(bool nullToAbsent) { return TestsCompanion( id: Value(id), name: Value(name), color: color == null && nullToAbsent ? const Value.absent() : Value(color), cover: cover == null && nullToAbsent ? const Value.absent() : Value(cover), version: version == null && nullToAbsent ? const Value.absent() : Value(version), time: time == null && nullToAbsent ? const Value.absent() : Value(time), timeSubtitle: timeSubtitle == null && nullToAbsent ? const Value.absent() : Value(timeSubtitle), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory Test.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Test( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), color: serializer.fromJson(json['color']), cover: serializer.fromJson(json['cover']), version: serializer.fromJson(json['version']), time: serializer.fromJson(json['time']), timeSubtitle: serializer.fromJson(json['timeSubtitle']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'color': serializer.toJson(color), 'cover': serializer.toJson(cover), 'version': serializer.toJson(version), 'time': serializer.toJson(time), 'timeSubtitle': serializer.toJson(timeSubtitle), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } Test copyWith( {int? id, String? name, Value color = const Value.absent(), Value cover = const Value.absent(), Value version = const Value.absent(), Value time = const Value.absent(), Value timeSubtitle = const Value.absent(), DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => Test( id: id ?? this.id, name: name ?? this.name, color: color.present ? color.value : this.color, cover: cover.present ? cover.value : this.cover, version: version.present ? version.value : this.version, time: time.present ? time.value : this.time, timeSubtitle: timeSubtitle.present ? timeSubtitle.value : this.timeSubtitle, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('Test(') ..write('id: $id, ') ..write('name: $name, ') ..write('color: $color, ') ..write('cover: $cover, ') ..write('version: $version, ') ..write('time: $time, ') ..write('timeSubtitle: $timeSubtitle, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, name, color, cover, version, time, timeSubtitle, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is Test && other.id == this.id && other.name == this.name && other.color == this.color && other.cover == this.cover && other.version == this.version && other.time == this.time && other.timeSubtitle == this.timeSubtitle && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class TestsCompanion extends UpdateCompanion { final Value id; final Value name; final Value color; final Value cover; final Value version; final Value time; final Value timeSubtitle; final Value createdAt; final Value updatedAt; final Value isDeleted; const TestsCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.color = const Value.absent(), this.cover = const Value.absent(), this.version = const Value.absent(), this.time = const Value.absent(), this.timeSubtitle = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); TestsCompanion.insert({ this.id = const Value.absent(), required String name, this.color = const Value.absent(), this.cover = const Value.absent(), this.version = const Value.absent(), this.time = const Value.absent(), this.timeSubtitle = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : name = Value(name); static Insertable custom({ Expression? id, Expression? name, Expression? color, Expression? cover, Expression? version, Expression? time, Expression? timeSubtitle, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (color != null) 'color': color, if (cover != null) 'cover': cover, if (version != null) 'version': version, if (time != null) 'time': time, if (timeSubtitle != null) 'time_subtitle': timeSubtitle, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } TestsCompanion copyWith( {Value? id, Value? name, Value? color, Value? cover, Value? version, Value? time, Value? timeSubtitle, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return TestsCompanion( id: id ?? this.id, name: name ?? this.name, color: color ?? this.color, cover: cover ?? this.cover, version: version ?? this.version, time: time ?? this.time, timeSubtitle: timeSubtitle ?? this.timeSubtitle, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (color.present) { map['color'] = Variable(color.value); } if (cover.present) { map['cover'] = Variable(cover.value); } if (version.present) { map['version'] = Variable(version.value); } if (time.present) { map['time'] = Variable(time.value); } if (timeSubtitle.present) { map['time_subtitle'] = Variable(timeSubtitle.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('TestsCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('color: $color, ') ..write('cover: $cover, ') ..write('version: $version, ') ..write('time: $time, ') ..write('timeSubtitle: $timeSubtitle, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $TestQuestionsTable extends TestQuestions with TableInfo<$TestQuestionsTable, TestQuestion> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TestQuestionsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _testIdMeta = const VerificationMeta('testId'); @override late final GeneratedColumn testId = GeneratedColumn( 'test_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES tests (id) ON DELETE CASCADE')); static const VerificationMeta _questionTypeMeta = const VerificationMeta('questionType'); @override late final GeneratedColumn questionType = GeneratedColumn( 'question_type', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _bodyMeta = const VerificationMeta('body'); @override late final GeneratedColumn body = GeneratedColumn( 'body', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, testId, questionType, body, createdAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'test_questions'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('test_id')) { context.handle(_testIdMeta, testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta)); } else if (isInserting) { context.missing(_testIdMeta); } if (data.containsKey('question_type')) { context.handle( _questionTypeMeta, questionType.isAcceptableOrUnknown( data['question_type']!, _questionTypeMeta)); } else if (isInserting) { context.missing(_questionTypeMeta); } if (data.containsKey('body')) { context.handle( _bodyMeta, body.isAcceptableOrUnknown(data['body']!, _bodyMeta)); } else if (isInserting) { context.missing(_bodyMeta); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override TestQuestion map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TestQuestion( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, testId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}test_id'])!, questionType: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}question_type'])!, body: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}body'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $TestQuestionsTable createAlias(String alias) { return $TestQuestionsTable(attachedDatabase, alias); } } class TestQuestion extends DataClass implements Insertable { final int id; final int testId; final String questionType; final String body; final DateTime createdAt; final DateTime updatedAt; const TestQuestion( {required this.id, required this.testId, required this.questionType, required this.body, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['test_id'] = Variable(testId); map['question_type'] = Variable(questionType); map['body'] = Variable(body); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } TestQuestionsCompanion toCompanion(bool nullToAbsent) { return TestQuestionsCompanion( id: Value(id), testId: Value(testId), questionType: Value(questionType), body: Value(body), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory TestQuestion.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TestQuestion( id: serializer.fromJson(json['id']), testId: serializer.fromJson(json['testId']), questionType: serializer.fromJson(json['questionType']), body: serializer.fromJson(json['body']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'testId': serializer.toJson(testId), 'questionType': serializer.toJson(questionType), 'body': serializer.toJson(body), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } TestQuestion copyWith( {int? id, int? testId, String? questionType, String? body, DateTime? createdAt, DateTime? updatedAt}) => TestQuestion( id: id ?? this.id, testId: testId ?? this.testId, questionType: questionType ?? this.questionType, body: body ?? this.body, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('TestQuestion(') ..write('id: $id, ') ..write('testId: $testId, ') ..write('questionType: $questionType, ') ..write('body: $body, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, testId, questionType, body, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is TestQuestion && other.id == this.id && other.testId == this.testId && other.questionType == this.questionType && other.body == this.body && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class TestQuestionsCompanion extends UpdateCompanion { final Value id; final Value testId; final Value questionType; final Value body; final Value createdAt; final Value updatedAt; const TestQuestionsCompanion({ this.id = const Value.absent(), this.testId = const Value.absent(), this.questionType = const Value.absent(), this.body = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); TestQuestionsCompanion.insert({ this.id = const Value.absent(), required int testId, required String questionType, required String body, this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : testId = Value(testId), questionType = Value(questionType), body = Value(body); static Insertable custom({ Expression? id, Expression? testId, Expression? questionType, Expression? body, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (testId != null) 'test_id': testId, if (questionType != null) 'question_type': questionType, if (body != null) 'body': body, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } TestQuestionsCompanion copyWith( {Value? id, Value? testId, Value? questionType, Value? body, Value? createdAt, Value? updatedAt}) { return TestQuestionsCompanion( id: id ?? this.id, testId: testId ?? this.testId, questionType: questionType ?? this.questionType, body: body ?? this.body, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (testId.present) { map['test_id'] = Variable(testId.value); } if (questionType.present) { map['question_type'] = Variable(questionType.value); } if (body.present) { map['body'] = Variable(body.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('TestQuestionsCompanion(') ..write('id: $id, ') ..write('testId: $testId, ') ..write('questionType: $questionType, ') ..write('body: $body, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $TestPackRelationsTable extends TestPackRelations with TableInfo<$TestPackRelationsTable, TestPackRelation> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TestPackRelationsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _testIdMeta = const VerificationMeta('testId'); @override late final GeneratedColumn testId = GeneratedColumn( 'test_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES tests (id) ON DELETE CASCADE')); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES card_packs (id) ON DELETE CASCADE')); @override List get $columns => [testId, packId]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'test_pack_relations'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('test_id')) { context.handle(_testIdMeta, testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta)); } else if (isInserting) { context.missing(_testIdMeta); } if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } else if (isInserting) { context.missing(_packIdMeta); } return context; } @override Set get $primaryKey => {testId, packId}; @override TestPackRelation map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TestPackRelation( testId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}test_id'])!, packId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}pack_id'])!, ); } @override $TestPackRelationsTable createAlias(String alias) { return $TestPackRelationsTable(attachedDatabase, alias); } } class TestPackRelation extends DataClass implements Insertable { final int testId; final int packId; const TestPackRelation({required this.testId, required this.packId}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['test_id'] = Variable(testId); map['pack_id'] = Variable(packId); return map; } TestPackRelationsCompanion toCompanion(bool nullToAbsent) { return TestPackRelationsCompanion( testId: Value(testId), packId: Value(packId), ); } factory TestPackRelation.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TestPackRelation( testId: serializer.fromJson(json['testId']), packId: serializer.fromJson(json['packId']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'testId': serializer.toJson(testId), 'packId': serializer.toJson(packId), }; } TestPackRelation copyWith({int? testId, int? packId}) => TestPackRelation( testId: testId ?? this.testId, packId: packId ?? this.packId, ); @override String toString() { return (StringBuffer('TestPackRelation(') ..write('testId: $testId, ') ..write('packId: $packId') ..write(')')) .toString(); } @override int get hashCode => Object.hash(testId, packId); @override bool operator ==(Object other) => identical(this, other) || (other is TestPackRelation && other.testId == this.testId && other.packId == this.packId); } class TestPackRelationsCompanion extends UpdateCompanion { final Value testId; final Value packId; final Value rowid; const TestPackRelationsCompanion({ this.testId = const Value.absent(), this.packId = const Value.absent(), this.rowid = const Value.absent(), }); TestPackRelationsCompanion.insert({ required int testId, required int packId, this.rowid = const Value.absent(), }) : testId = Value(testId), packId = Value(packId); static Insertable custom({ Expression? testId, Expression? packId, Expression? rowid, }) { return RawValuesInsertable({ if (testId != null) 'test_id': testId, if (packId != null) 'pack_id': packId, if (rowid != null) 'rowid': rowid, }); } TestPackRelationsCompanion copyWith( {Value? testId, Value? packId, Value? rowid}) { return TestPackRelationsCompanion( testId: testId ?? this.testId, packId: packId ?? this.packId, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (testId.present) { map['test_id'] = Variable(testId.value); } if (packId.present) { map['pack_id'] = Variable(packId.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('TestPackRelationsCompanion(') ..write('testId: $testId, ') ..write('packId: $packId, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $TestStatisticsTable extends TestStatistics with TableInfo<$TestStatisticsTable, TestStatistic> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TestStatisticsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _testIdMeta = const VerificationMeta('testId'); @override late final GeneratedColumn testId = GeneratedColumn( 'test_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES tests (id) ON DELETE CASCADE')); static const VerificationMeta _resultsMeta = const VerificationMeta('results'); @override late final GeneratedColumnWithTypeConverter?, String> results = GeneratedColumn('results', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('{}')) .withConverter?>( $TestStatisticsTable.$converterresults); static const VerificationMeta _completedAtMeta = const VerificationMeta('completedAt'); @override late final GeneratedColumn completedAt = GeneratedColumn( 'completed_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, userId, testId, results, completedAt, createdAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'test_statistics'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('test_id')) { context.handle(_testIdMeta, testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta)); } else if (isInserting) { context.missing(_testIdMeta); } context.handle(_resultsMeta, const VerificationResult.success()); if (data.containsKey('completed_at')) { context.handle( _completedAtMeta, completedAt.isAcceptableOrUnknown( data['completed_at']!, _completedAtMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override TestStatistic map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TestStatistic( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, testId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}test_id'])!, results: $TestStatisticsTable.$converterresults.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}results'])!), completedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}completed_at'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $TestStatisticsTable createAlias(String alias) { return $TestStatisticsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterresults = const JsonMapConverter(); } class TestStatistic extends DataClass implements Insertable { final int id; final int userId; final int testId; final Map? results; final DateTime completedAt; final DateTime createdAt; final DateTime updatedAt; const TestStatistic( {required this.id, required this.userId, required this.testId, this.results, required this.completedAt, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['test_id'] = Variable(testId); if (!nullToAbsent || results != null) { map['results'] = Variable( $TestStatisticsTable.$converterresults.toSql(results)); } map['completed_at'] = Variable(completedAt); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } TestStatisticsCompanion toCompanion(bool nullToAbsent) { return TestStatisticsCompanion( id: Value(id), userId: Value(userId), testId: Value(testId), results: results == null && nullToAbsent ? const Value.absent() : Value(results), completedAt: Value(completedAt), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory TestStatistic.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TestStatistic( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), testId: serializer.fromJson(json['testId']), results: serializer.fromJson?>(json['results']), completedAt: serializer.fromJson(json['completedAt']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'testId': serializer.toJson(testId), 'results': serializer.toJson?>(results), 'completedAt': serializer.toJson(completedAt), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } TestStatistic copyWith( {int? id, int? userId, int? testId, Value?> results = const Value.absent(), DateTime? completedAt, DateTime? createdAt, DateTime? updatedAt}) => TestStatistic( id: id ?? this.id, userId: userId ?? this.userId, testId: testId ?? this.testId, results: results.present ? results.value : this.results, completedAt: completedAt ?? this.completedAt, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('TestStatistic(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('testId: $testId, ') ..write('results: $results, ') ..write('completedAt: $completedAt, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, userId, testId, results, completedAt, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is TestStatistic && other.id == this.id && other.userId == this.userId && other.testId == this.testId && other.results == this.results && other.completedAt == this.completedAt && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class TestStatisticsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value testId; final Value?> results; final Value completedAt; final Value createdAt; final Value updatedAt; const TestStatisticsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.testId = const Value.absent(), this.results = const Value.absent(), this.completedAt = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); TestStatisticsCompanion.insert({ this.id = const Value.absent(), required int userId, required int testId, this.results = const Value.absent(), this.completedAt = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), testId = Value(testId); static Insertable custom({ Expression? id, Expression? userId, Expression? testId, Expression? results, Expression? completedAt, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (testId != null) 'test_id': testId, if (results != null) 'results': results, if (completedAt != null) 'completed_at': completedAt, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } TestStatisticsCompanion copyWith( {Value? id, Value? userId, Value? testId, Value?>? results, Value? completedAt, Value? createdAt, Value? updatedAt}) { return TestStatisticsCompanion( id: id ?? this.id, userId: userId ?? this.userId, testId: testId ?? this.testId, results: results ?? this.results, completedAt: completedAt ?? this.completedAt, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (testId.present) { map['test_id'] = Variable(testId.value); } if (results.present) { map['results'] = Variable( $TestStatisticsTable.$converterresults.toSql(results.value)); } if (completedAt.present) { map['completed_at'] = Variable(completedAt.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('TestStatisticsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('testId: $testId, ') ..write('results: $results, ') ..write('completedAt: $completedAt, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $TasksTable extends Tasks with TableInfo<$TasksTable, Task> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TasksTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _minCycleMillisMeta = const VerificationMeta('minCycleMillis'); @override late final GeneratedColumn minCycleMillis = GeneratedColumn( 'min_cycle_millis', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _maxCycleMillisMeta = const VerificationMeta('maxCycleMillis'); @override late final GeneratedColumn maxCycleMillis = GeneratedColumn( 'max_cycle_millis', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _intervalMillisMeta = const VerificationMeta('intervalMillis'); @override late final GeneratedColumn intervalMillis = GeneratedColumn( 'interval_millis', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _timeoutMillisMeta = const VerificationMeta('timeoutMillis'); @override late final GeneratedColumn timeoutMillis = GeneratedColumn( 'timeout_millis', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( 'status', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); @override late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _lastExecutionMeta = const VerificationMeta('lastExecution'); @override late final GeneratedColumn lastExecution = GeneratedColumn('last_execution', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, name, minCycleMillis, maxCycleMillis, intervalMillis, timeoutMillis, status, description, lastExecution, createdAt, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'tasks'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } if (data.containsKey('min_cycle_millis')) { context.handle( _minCycleMillisMeta, minCycleMillis.isAcceptableOrUnknown( data['min_cycle_millis']!, _minCycleMillisMeta)); } else if (isInserting) { context.missing(_minCycleMillisMeta); } if (data.containsKey('max_cycle_millis')) { context.handle( _maxCycleMillisMeta, maxCycleMillis.isAcceptableOrUnknown( data['max_cycle_millis']!, _maxCycleMillisMeta)); } else if (isInserting) { context.missing(_maxCycleMillisMeta); } if (data.containsKey('interval_millis')) { context.handle( _intervalMillisMeta, intervalMillis.isAcceptableOrUnknown( data['interval_millis']!, _intervalMillisMeta)); } else if (isInserting) { context.missing(_intervalMillisMeta); } if (data.containsKey('timeout_millis')) { context.handle( _timeoutMillisMeta, timeoutMillis.isAcceptableOrUnknown( data['timeout_millis']!, _timeoutMillisMeta)); } else if (isInserting) { context.missing(_timeoutMillisMeta); } if (data.containsKey('status')) { context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); } if (data.containsKey('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } if (data.containsKey('last_execution')) { context.handle( _lastExecutionMeta, lastExecution.isAcceptableOrUnknown( data['last_execution']!, _lastExecutionMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override Task map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Task( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, minCycleMillis: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}min_cycle_millis'])!, maxCycleMillis: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}max_cycle_millis'])!, intervalMillis: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}interval_millis'])!, timeoutMillis: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}timeout_millis'])!, status: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}status']), description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description']), lastExecution: attachedDatabase.typeMapping.read( DriftSqlType.dateTime, data['${effectivePrefix}last_execution']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $TasksTable createAlias(String alias) { return $TasksTable(attachedDatabase, alias); } } class Task extends DataClass implements Insertable { final int id; final String name; final int minCycleMillis; final int maxCycleMillis; final int intervalMillis; final int timeoutMillis; final String? status; final String? description; final DateTime? lastExecution; final DateTime createdAt; final DateTime updatedAt; const Task( {required this.id, required this.name, required this.minCycleMillis, required this.maxCycleMillis, required this.intervalMillis, required this.timeoutMillis, this.status, this.description, this.lastExecution, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); map['min_cycle_millis'] = Variable(minCycleMillis); map['max_cycle_millis'] = Variable(maxCycleMillis); map['interval_millis'] = Variable(intervalMillis); map['timeout_millis'] = Variable(timeoutMillis); if (!nullToAbsent || status != null) { map['status'] = Variable(status); } if (!nullToAbsent || description != null) { map['description'] = Variable(description); } if (!nullToAbsent || lastExecution != null) { map['last_execution'] = Variable(lastExecution); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } TasksCompanion toCompanion(bool nullToAbsent) { return TasksCompanion( id: Value(id), name: Value(name), minCycleMillis: Value(minCycleMillis), maxCycleMillis: Value(maxCycleMillis), intervalMillis: Value(intervalMillis), timeoutMillis: Value(timeoutMillis), status: status == null && nullToAbsent ? const Value.absent() : Value(status), description: description == null && nullToAbsent ? const Value.absent() : Value(description), lastExecution: lastExecution == null && nullToAbsent ? const Value.absent() : Value(lastExecution), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory Task.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Task( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), minCycleMillis: serializer.fromJson(json['minCycleMillis']), maxCycleMillis: serializer.fromJson(json['maxCycleMillis']), intervalMillis: serializer.fromJson(json['intervalMillis']), timeoutMillis: serializer.fromJson(json['timeoutMillis']), status: serializer.fromJson(json['status']), description: serializer.fromJson(json['description']), lastExecution: serializer.fromJson(json['lastExecution']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'minCycleMillis': serializer.toJson(minCycleMillis), 'maxCycleMillis': serializer.toJson(maxCycleMillis), 'intervalMillis': serializer.toJson(intervalMillis), 'timeoutMillis': serializer.toJson(timeoutMillis), 'status': serializer.toJson(status), 'description': serializer.toJson(description), 'lastExecution': serializer.toJson(lastExecution), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } Task copyWith( {int? id, String? name, int? minCycleMillis, int? maxCycleMillis, int? intervalMillis, int? timeoutMillis, Value status = const Value.absent(), Value description = const Value.absent(), Value lastExecution = const Value.absent(), DateTime? createdAt, DateTime? updatedAt}) => Task( id: id ?? this.id, name: name ?? this.name, minCycleMillis: minCycleMillis ?? this.minCycleMillis, maxCycleMillis: maxCycleMillis ?? this.maxCycleMillis, intervalMillis: intervalMillis ?? this.intervalMillis, timeoutMillis: timeoutMillis ?? this.timeoutMillis, status: status.present ? status.value : this.status, description: description.present ? description.value : this.description, lastExecution: lastExecution.present ? lastExecution.value : this.lastExecution, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('Task(') ..write('id: $id, ') ..write('name: $name, ') ..write('minCycleMillis: $minCycleMillis, ') ..write('maxCycleMillis: $maxCycleMillis, ') ..write('intervalMillis: $intervalMillis, ') ..write('timeoutMillis: $timeoutMillis, ') ..write('status: $status, ') ..write('description: $description, ') ..write('lastExecution: $lastExecution, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, name, minCycleMillis, maxCycleMillis, intervalMillis, timeoutMillis, status, description, lastExecution, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is Task && other.id == this.id && other.name == this.name && other.minCycleMillis == this.minCycleMillis && other.maxCycleMillis == this.maxCycleMillis && other.intervalMillis == this.intervalMillis && other.timeoutMillis == this.timeoutMillis && other.status == this.status && other.description == this.description && other.lastExecution == this.lastExecution && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class TasksCompanion extends UpdateCompanion { final Value id; final Value name; final Value minCycleMillis; final Value maxCycleMillis; final Value intervalMillis; final Value timeoutMillis; final Value status; final Value description; final Value lastExecution; final Value createdAt; final Value updatedAt; const TasksCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.minCycleMillis = const Value.absent(), this.maxCycleMillis = const Value.absent(), this.intervalMillis = const Value.absent(), this.timeoutMillis = const Value.absent(), this.status = const Value.absent(), this.description = const Value.absent(), this.lastExecution = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); TasksCompanion.insert({ this.id = const Value.absent(), required String name, required int minCycleMillis, required int maxCycleMillis, required int intervalMillis, required int timeoutMillis, this.status = const Value.absent(), this.description = const Value.absent(), this.lastExecution = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : name = Value(name), minCycleMillis = Value(minCycleMillis), maxCycleMillis = Value(maxCycleMillis), intervalMillis = Value(intervalMillis), timeoutMillis = Value(timeoutMillis); static Insertable custom({ Expression? id, Expression? name, Expression? minCycleMillis, Expression? maxCycleMillis, Expression? intervalMillis, Expression? timeoutMillis, Expression? status, Expression? description, Expression? lastExecution, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (minCycleMillis != null) 'min_cycle_millis': minCycleMillis, if (maxCycleMillis != null) 'max_cycle_millis': maxCycleMillis, if (intervalMillis != null) 'interval_millis': intervalMillis, if (timeoutMillis != null) 'timeout_millis': timeoutMillis, if (status != null) 'status': status, if (description != null) 'description': description, if (lastExecution != null) 'last_execution': lastExecution, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } TasksCompanion copyWith( {Value? id, Value? name, Value? minCycleMillis, Value? maxCycleMillis, Value? intervalMillis, Value? timeoutMillis, Value? status, Value? description, Value? lastExecution, Value? createdAt, Value? updatedAt}) { return TasksCompanion( id: id ?? this.id, name: name ?? this.name, minCycleMillis: minCycleMillis ?? this.minCycleMillis, maxCycleMillis: maxCycleMillis ?? this.maxCycleMillis, intervalMillis: intervalMillis ?? this.intervalMillis, timeoutMillis: timeoutMillis ?? this.timeoutMillis, status: status ?? this.status, description: description ?? this.description, lastExecution: lastExecution ?? this.lastExecution, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (minCycleMillis.present) { map['min_cycle_millis'] = Variable(minCycleMillis.value); } if (maxCycleMillis.present) { map['max_cycle_millis'] = Variable(maxCycleMillis.value); } if (intervalMillis.present) { map['interval_millis'] = Variable(intervalMillis.value); } if (timeoutMillis.present) { map['timeout_millis'] = Variable(timeoutMillis.value); } if (status.present) { map['status'] = Variable(status.value); } if (description.present) { map['description'] = Variable(description.value); } if (lastExecution.present) { map['last_execution'] = Variable(lastExecution.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('TasksCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('minCycleMillis: $minCycleMillis, ') ..write('maxCycleMillis: $maxCycleMillis, ') ..write('intervalMillis: $intervalMillis, ') ..write('timeoutMillis: $timeoutMillis, ') ..write('status: $status, ') ..write('description: $description, ') ..write('lastExecution: $lastExecution, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $UserTasksTable extends UserTasks with TableInfo<$UserTasksTable, UserTask> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserTasksTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _titleMeta = const VerificationMeta('title'); @override late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); @override late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _typeMeta = const VerificationMeta('type'); @override late final GeneratedColumn type = GeneratedColumn( 'type', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _difficultyMeta = const VerificationMeta('difficulty'); @override late final GeneratedColumn difficulty = GeneratedColumn( 'difficulty', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( 'status', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _rewardsMeta = const VerificationMeta('rewards'); @override late final GeneratedColumnWithTypeConverter?, String> rewards = GeneratedColumn('rewards', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>($UserTasksTable.$converterrewards); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _expiresAtMeta = const VerificationMeta('expiresAt'); @override late final GeneratedColumn expiresAt = GeneratedColumn( 'expires_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _completedAtMeta = const VerificationMeta('completedAt'); @override late final GeneratedColumn completedAt = GeneratedColumn( 'completed_at', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _proofUrlMeta = const VerificationMeta('proofUrl'); @override late final GeneratedColumn proofUrl = GeneratedColumn( 'proof_url', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _instructionsMeta = const VerificationMeta('instructions'); @override late final GeneratedColumn instructions = GeneratedColumn( 'instructions', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); @override late final GeneratedColumnWithTypeConverter, String> tags = GeneratedColumn('tags', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($UserTasksTable.$convertertags); static const VerificationMeta _imageUrlMeta = const VerificationMeta('imageUrl'); @override late final GeneratedColumn imageUrl = GeneratedColumn( 'image_url', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, title, description, type, difficulty, status, rewards, createdAt, expiresAt, completedAt, proofUrl, instructions, tags, imageUrl, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_tasks'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('title')) { context.handle( _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); } else if (isInserting) { context.missing(_titleMeta); } if (data.containsKey('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } else if (isInserting) { context.missing(_descriptionMeta); } if (data.containsKey('type')) { context.handle( _typeMeta, type.isAcceptableOrUnknown(data['type']!, _typeMeta)); } else if (isInserting) { context.missing(_typeMeta); } if (data.containsKey('difficulty')) { context.handle( _difficultyMeta, difficulty.isAcceptableOrUnknown( data['difficulty']!, _difficultyMeta)); } else if (isInserting) { context.missing(_difficultyMeta); } if (data.containsKey('status')) { context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); } else if (isInserting) { context.missing(_statusMeta); } context.handle(_rewardsMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('expires_at')) { context.handle(_expiresAtMeta, expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta)); } else if (isInserting) { context.missing(_expiresAtMeta); } if (data.containsKey('completed_at')) { context.handle( _completedAtMeta, completedAt.isAcceptableOrUnknown( data['completed_at']!, _completedAtMeta)); } if (data.containsKey('proof_url')) { context.handle(_proofUrlMeta, proofUrl.isAcceptableOrUnknown(data['proof_url']!, _proofUrlMeta)); } if (data.containsKey('instructions')) { context.handle( _instructionsMeta, instructions.isAcceptableOrUnknown( data['instructions']!, _instructionsMeta)); } context.handle(_tagsMeta, const VerificationResult.success()); if (data.containsKey('image_url')) { context.handle(_imageUrlMeta, imageUrl.isAcceptableOrUnknown(data['image_url']!, _imageUrlMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserTask map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserTask( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description'])!, type: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}type'])!, difficulty: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}difficulty'])!, status: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}status'])!, rewards: $UserTasksTable.$converterrewards.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}rewards'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, expiresAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}expires_at'])!, completedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}completed_at']), proofUrl: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}proof_url']), instructions: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}instructions']), tags: $UserTasksTable.$convertertags.fromSql(attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), imageUrl: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}image_url']), updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $UserTasksTable createAlias(String alias) { return $UserTasksTable(attachedDatabase, alias); } static TypeConverter?, String> $converterrewards = const JsonListConverter(); static TypeConverter, String> $convertertags = const StringListConverter(); } class UserTask extends DataClass implements Insertable { final int id; final String title; final String description; final String type; final String difficulty; final String status; final List? rewards; final DateTime createdAt; final DateTime expiresAt; final DateTime? completedAt; final String? proofUrl; final String? instructions; final List tags; final String? imageUrl; final DateTime updatedAt; const UserTask( {required this.id, required this.title, required this.description, required this.type, required this.difficulty, required this.status, this.rewards, required this.createdAt, required this.expiresAt, this.completedAt, this.proofUrl, this.instructions, required this.tags, this.imageUrl, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['title'] = Variable(title); map['description'] = Variable(description); map['type'] = Variable(type); map['difficulty'] = Variable(difficulty); map['status'] = Variable(status); if (!nullToAbsent || rewards != null) { map['rewards'] = Variable($UserTasksTable.$converterrewards.toSql(rewards)); } map['created_at'] = Variable(createdAt); map['expires_at'] = Variable(expiresAt); if (!nullToAbsent || completedAt != null) { map['completed_at'] = Variable(completedAt); } if (!nullToAbsent || proofUrl != null) { map['proof_url'] = Variable(proofUrl); } if (!nullToAbsent || instructions != null) { map['instructions'] = Variable(instructions); } { map['tags'] = Variable($UserTasksTable.$convertertags.toSql(tags)); } if (!nullToAbsent || imageUrl != null) { map['image_url'] = Variable(imageUrl); } map['updated_at'] = Variable(updatedAt); return map; } UserTasksCompanion toCompanion(bool nullToAbsent) { return UserTasksCompanion( id: Value(id), title: Value(title), description: Value(description), type: Value(type), difficulty: Value(difficulty), status: Value(status), rewards: rewards == null && nullToAbsent ? const Value.absent() : Value(rewards), createdAt: Value(createdAt), expiresAt: Value(expiresAt), completedAt: completedAt == null && nullToAbsent ? const Value.absent() : Value(completedAt), proofUrl: proofUrl == null && nullToAbsent ? const Value.absent() : Value(proofUrl), instructions: instructions == null && nullToAbsent ? const Value.absent() : Value(instructions), tags: Value(tags), imageUrl: imageUrl == null && nullToAbsent ? const Value.absent() : Value(imageUrl), updatedAt: Value(updatedAt), ); } factory UserTask.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserTask( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), description: serializer.fromJson(json['description']), type: serializer.fromJson(json['type']), difficulty: serializer.fromJson(json['difficulty']), status: serializer.fromJson(json['status']), rewards: serializer.fromJson?>(json['rewards']), createdAt: serializer.fromJson(json['createdAt']), expiresAt: serializer.fromJson(json['expiresAt']), completedAt: serializer.fromJson(json['completedAt']), proofUrl: serializer.fromJson(json['proofUrl']), instructions: serializer.fromJson(json['instructions']), tags: serializer.fromJson>(json['tags']), imageUrl: serializer.fromJson(json['imageUrl']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'description': serializer.toJson(description), 'type': serializer.toJson(type), 'difficulty': serializer.toJson(difficulty), 'status': serializer.toJson(status), 'rewards': serializer.toJson?>(rewards), 'createdAt': serializer.toJson(createdAt), 'expiresAt': serializer.toJson(expiresAt), 'completedAt': serializer.toJson(completedAt), 'proofUrl': serializer.toJson(proofUrl), 'instructions': serializer.toJson(instructions), 'tags': serializer.toJson>(tags), 'imageUrl': serializer.toJson(imageUrl), 'updatedAt': serializer.toJson(updatedAt), }; } UserTask copyWith( {int? id, String? title, String? description, String? type, String? difficulty, String? status, Value?> rewards = const Value.absent(), DateTime? createdAt, DateTime? expiresAt, Value completedAt = const Value.absent(), Value proofUrl = const Value.absent(), Value instructions = const Value.absent(), List? tags, Value imageUrl = const Value.absent(), DateTime? updatedAt}) => UserTask( id: id ?? this.id, title: title ?? this.title, description: description ?? this.description, type: type ?? this.type, difficulty: difficulty ?? this.difficulty, status: status ?? this.status, rewards: rewards.present ? rewards.value : this.rewards, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, completedAt: completedAt.present ? completedAt.value : this.completedAt, proofUrl: proofUrl.present ? proofUrl.value : this.proofUrl, instructions: instructions.present ? instructions.value : this.instructions, tags: tags ?? this.tags, imageUrl: imageUrl.present ? imageUrl.value : this.imageUrl, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('UserTask(') ..write('id: $id, ') ..write('title: $title, ') ..write('description: $description, ') ..write('type: $type, ') ..write('difficulty: $difficulty, ') ..write('status: $status, ') ..write('rewards: $rewards, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt, ') ..write('completedAt: $completedAt, ') ..write('proofUrl: $proofUrl, ') ..write('instructions: $instructions, ') ..write('tags: $tags, ') ..write('imageUrl: $imageUrl, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, title, description, type, difficulty, status, rewards, createdAt, expiresAt, completedAt, proofUrl, instructions, tags, imageUrl, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserTask && other.id == this.id && other.title == this.title && other.description == this.description && other.type == this.type && other.difficulty == this.difficulty && other.status == this.status && other.rewards == this.rewards && other.createdAt == this.createdAt && other.expiresAt == this.expiresAt && other.completedAt == this.completedAt && other.proofUrl == this.proofUrl && other.instructions == this.instructions && other.tags == this.tags && other.imageUrl == this.imageUrl && other.updatedAt == this.updatedAt); } class UserTasksCompanion extends UpdateCompanion { final Value id; final Value title; final Value description; final Value type; final Value difficulty; final Value status; final Value?> rewards; final Value createdAt; final Value expiresAt; final Value completedAt; final Value proofUrl; final Value instructions; final Value> tags; final Value imageUrl; final Value updatedAt; const UserTasksCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.description = const Value.absent(), this.type = const Value.absent(), this.difficulty = const Value.absent(), this.status = const Value.absent(), this.rewards = const Value.absent(), this.createdAt = const Value.absent(), this.expiresAt = const Value.absent(), this.completedAt = const Value.absent(), this.proofUrl = const Value.absent(), this.instructions = const Value.absent(), this.tags = const Value.absent(), this.imageUrl = const Value.absent(), this.updatedAt = const Value.absent(), }); UserTasksCompanion.insert({ this.id = const Value.absent(), required String title, required String description, required String type, required String difficulty, required String status, this.rewards = const Value.absent(), this.createdAt = const Value.absent(), required DateTime expiresAt, this.completedAt = const Value.absent(), this.proofUrl = const Value.absent(), this.instructions = const Value.absent(), this.tags = const Value.absent(), this.imageUrl = const Value.absent(), this.updatedAt = const Value.absent(), }) : title = Value(title), description = Value(description), type = Value(type), difficulty = Value(difficulty), status = Value(status), expiresAt = Value(expiresAt); static Insertable custom({ Expression? id, Expression? title, Expression? description, Expression? type, Expression? difficulty, Expression? status, Expression? rewards, Expression? createdAt, Expression? expiresAt, Expression? completedAt, Expression? proofUrl, Expression? instructions, Expression? tags, Expression? imageUrl, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (title != null) 'title': title, if (description != null) 'description': description, if (type != null) 'type': type, if (difficulty != null) 'difficulty': difficulty, if (status != null) 'status': status, if (rewards != null) 'rewards': rewards, if (createdAt != null) 'created_at': createdAt, if (expiresAt != null) 'expires_at': expiresAt, if (completedAt != null) 'completed_at': completedAt, if (proofUrl != null) 'proof_url': proofUrl, if (instructions != null) 'instructions': instructions, if (tags != null) 'tags': tags, if (imageUrl != null) 'image_url': imageUrl, if (updatedAt != null) 'updated_at': updatedAt, }); } UserTasksCompanion copyWith( {Value? id, Value? title, Value? description, Value? type, Value? difficulty, Value? status, Value?>? rewards, Value? createdAt, Value? expiresAt, Value? completedAt, Value? proofUrl, Value? instructions, Value>? tags, Value? imageUrl, Value? updatedAt}) { return UserTasksCompanion( id: id ?? this.id, title: title ?? this.title, description: description ?? this.description, type: type ?? this.type, difficulty: difficulty ?? this.difficulty, status: status ?? this.status, rewards: rewards ?? this.rewards, createdAt: createdAt ?? this.createdAt, expiresAt: expiresAt ?? this.expiresAt, completedAt: completedAt ?? this.completedAt, proofUrl: proofUrl ?? this.proofUrl, instructions: instructions ?? this.instructions, tags: tags ?? this.tags, imageUrl: imageUrl ?? this.imageUrl, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (title.present) { map['title'] = Variable(title.value); } if (description.present) { map['description'] = Variable(description.value); } if (type.present) { map['type'] = Variable(type.value); } if (difficulty.present) { map['difficulty'] = Variable(difficulty.value); } if (status.present) { map['status'] = Variable(status.value); } if (rewards.present) { map['rewards'] = Variable( $UserTasksTable.$converterrewards.toSql(rewards.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (expiresAt.present) { map['expires_at'] = Variable(expiresAt.value); } if (completedAt.present) { map['completed_at'] = Variable(completedAt.value); } if (proofUrl.present) { map['proof_url'] = Variable(proofUrl.value); } if (instructions.present) { map['instructions'] = Variable(instructions.value); } if (tags.present) { map['tags'] = Variable($UserTasksTable.$convertertags.toSql(tags.value)); } if (imageUrl.present) { map['image_url'] = Variable(imageUrl.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('UserTasksCompanion(') ..write('id: $id, ') ..write('title: $title, ') ..write('description: $description, ') ..write('type: $type, ') ..write('difficulty: $difficulty, ') ..write('status: $status, ') ..write('rewards: $rewards, ') ..write('createdAt: $createdAt, ') ..write('expiresAt: $expiresAt, ') ..write('completedAt: $completedAt, ') ..write('proofUrl: $proofUrl, ') ..write('instructions: $instructions, ') ..write('tags: $tags, ') ..write('imageUrl: $imageUrl, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $UserTaskProgressesTable extends UserTaskProgresses with TableInfo<$UserTaskProgressesTable, UserTaskProgresses> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserTaskProgressesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _taskIdMeta = const VerificationMeta('taskId'); @override late final GeneratedColumn taskId = GeneratedColumn( 'task_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _progressMeta = const VerificationMeta('progress'); @override late final GeneratedColumnWithTypeConverter?, String> progress = GeneratedColumn('progress', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('{}')) .withConverter?>( $UserTaskProgressesTable.$converterprogress); static const VerificationMeta _startedAtMeta = const VerificationMeta('startedAt'); @override late final GeneratedColumn startedAt = GeneratedColumn( 'started_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, userId, taskId, progress, startedAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_task_progresses'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('task_id')) { context.handle(_taskIdMeta, taskId.isAcceptableOrUnknown(data['task_id']!, _taskIdMeta)); } else if (isInserting) { context.missing(_taskIdMeta); } context.handle(_progressMeta, const VerificationResult.success()); if (data.containsKey('started_at')) { context.handle(_startedAtMeta, startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserTaskProgresses map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserTaskProgresses( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, taskId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}task_id'])!, progress: $UserTaskProgressesTable.$converterprogress.fromSql( attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}progress'])!), startedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}started_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $UserTaskProgressesTable createAlias(String alias) { return $UserTaskProgressesTable(attachedDatabase, alias); } static TypeConverter?, String> $converterprogress = const JsonMapConverter(); } class UserTaskProgresses extends DataClass implements Insertable { final int id; final int userId; final int taskId; final Map? progress; final DateTime startedAt; final DateTime updatedAt; const UserTaskProgresses( {required this.id, required this.userId, required this.taskId, this.progress, required this.startedAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['task_id'] = Variable(taskId); if (!nullToAbsent || progress != null) { map['progress'] = Variable( $UserTaskProgressesTable.$converterprogress.toSql(progress)); } map['started_at'] = Variable(startedAt); map['updated_at'] = Variable(updatedAt); return map; } UserTaskProgressesCompanion toCompanion(bool nullToAbsent) { return UserTaskProgressesCompanion( id: Value(id), userId: Value(userId), taskId: Value(taskId), progress: progress == null && nullToAbsent ? const Value.absent() : Value(progress), startedAt: Value(startedAt), updatedAt: Value(updatedAt), ); } factory UserTaskProgresses.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserTaskProgresses( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), taskId: serializer.fromJson(json['taskId']), progress: serializer.fromJson?>(json['progress']), startedAt: serializer.fromJson(json['startedAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'taskId': serializer.toJson(taskId), 'progress': serializer.toJson?>(progress), 'startedAt': serializer.toJson(startedAt), 'updatedAt': serializer.toJson(updatedAt), }; } UserTaskProgresses copyWith( {int? id, int? userId, int? taskId, Value?> progress = const Value.absent(), DateTime? startedAt, DateTime? updatedAt}) => UserTaskProgresses( id: id ?? this.id, userId: userId ?? this.userId, taskId: taskId ?? this.taskId, progress: progress.present ? progress.value : this.progress, startedAt: startedAt ?? this.startedAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('UserTaskProgresses(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('taskId: $taskId, ') ..write('progress: $progress, ') ..write('startedAt: $startedAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, userId, taskId, progress, startedAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserTaskProgresses && other.id == this.id && other.userId == this.userId && other.taskId == this.taskId && other.progress == this.progress && other.startedAt == this.startedAt && other.updatedAt == this.updatedAt); } class UserTaskProgressesCompanion extends UpdateCompanion { final Value id; final Value userId; final Value taskId; final Value?> progress; final Value startedAt; final Value updatedAt; const UserTaskProgressesCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.taskId = const Value.absent(), this.progress = const Value.absent(), this.startedAt = const Value.absent(), this.updatedAt = const Value.absent(), }); UserTaskProgressesCompanion.insert({ this.id = const Value.absent(), required int userId, required int taskId, this.progress = const Value.absent(), this.startedAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), taskId = Value(taskId); static Insertable custom({ Expression? id, Expression? userId, Expression? taskId, Expression? progress, Expression? startedAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (taskId != null) 'task_id': taskId, if (progress != null) 'progress': progress, if (startedAt != null) 'started_at': startedAt, if (updatedAt != null) 'updated_at': updatedAt, }); } UserTaskProgressesCompanion copyWith( {Value? id, Value? userId, Value? taskId, Value?>? progress, Value? startedAt, Value? updatedAt}) { return UserTaskProgressesCompanion( id: id ?? this.id, userId: userId ?? this.userId, taskId: taskId ?? this.taskId, progress: progress ?? this.progress, startedAt: startedAt ?? this.startedAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (taskId.present) { map['task_id'] = Variable(taskId.value); } if (progress.present) { map['progress'] = Variable( $UserTaskProgressesTable.$converterprogress.toSql(progress.value)); } if (startedAt.present) { map['started_at'] = Variable(startedAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('UserTaskProgressesCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('taskId: $taskId, ') ..write('progress: $progress, ') ..write('startedAt: $startedAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $UserTaskResultsTable extends UserTaskResults with TableInfo<$UserTaskResultsTable, UserTaskResult> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserTaskResultsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _taskIdMeta = const VerificationMeta('taskId'); @override late final GeneratedColumn taskId = GeneratedColumn( 'task_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _resultsMeta = const VerificationMeta('results'); @override late final GeneratedColumnWithTypeConverter?, String> results = GeneratedColumn('results', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('{}')) .withConverter?>( $UserTaskResultsTable.$converterresults); static const VerificationMeta _completedAtMeta = const VerificationMeta('completedAt'); @override late final GeneratedColumn completedAt = GeneratedColumn( 'completed_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, userId, taskId, results, completedAt, createdAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_task_results'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('task_id')) { context.handle(_taskIdMeta, taskId.isAcceptableOrUnknown(data['task_id']!, _taskIdMeta)); } else if (isInserting) { context.missing(_taskIdMeta); } context.handle(_resultsMeta, const VerificationResult.success()); if (data.containsKey('completed_at')) { context.handle( _completedAtMeta, completedAt.isAcceptableOrUnknown( data['completed_at']!, _completedAtMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserTaskResult map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserTaskResult( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, taskId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}task_id'])!, results: $UserTaskResultsTable.$converterresults.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}results'])!), completedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}completed_at'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, ); } @override $UserTaskResultsTable createAlias(String alias) { return $UserTaskResultsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterresults = const JsonMapConverter(); } class UserTaskResult extends DataClass implements Insertable { final int id; final int userId; final int taskId; final Map? results; final DateTime completedAt; final DateTime createdAt; const UserTaskResult( {required this.id, required this.userId, required this.taskId, this.results, required this.completedAt, required this.createdAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['task_id'] = Variable(taskId); if (!nullToAbsent || results != null) { map['results'] = Variable( $UserTaskResultsTable.$converterresults.toSql(results)); } map['completed_at'] = Variable(completedAt); map['created_at'] = Variable(createdAt); return map; } UserTaskResultsCompanion toCompanion(bool nullToAbsent) { return UserTaskResultsCompanion( id: Value(id), userId: Value(userId), taskId: Value(taskId), results: results == null && nullToAbsent ? const Value.absent() : Value(results), completedAt: Value(completedAt), createdAt: Value(createdAt), ); } factory UserTaskResult.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserTaskResult( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), taskId: serializer.fromJson(json['taskId']), results: serializer.fromJson?>(json['results']), completedAt: serializer.fromJson(json['completedAt']), createdAt: serializer.fromJson(json['createdAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'taskId': serializer.toJson(taskId), 'results': serializer.toJson?>(results), 'completedAt': serializer.toJson(completedAt), 'createdAt': serializer.toJson(createdAt), }; } UserTaskResult copyWith( {int? id, int? userId, int? taskId, Value?> results = const Value.absent(), DateTime? completedAt, DateTime? createdAt}) => UserTaskResult( id: id ?? this.id, userId: userId ?? this.userId, taskId: taskId ?? this.taskId, results: results.present ? results.value : this.results, completedAt: completedAt ?? this.completedAt, createdAt: createdAt ?? this.createdAt, ); @override String toString() { return (StringBuffer('UserTaskResult(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('taskId: $taskId, ') ..write('results: $results, ') ..write('completedAt: $completedAt, ') ..write('createdAt: $createdAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, userId, taskId, results, completedAt, createdAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserTaskResult && other.id == this.id && other.userId == this.userId && other.taskId == this.taskId && other.results == this.results && other.completedAt == this.completedAt && other.createdAt == this.createdAt); } class UserTaskResultsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value taskId; final Value?> results; final Value completedAt; final Value createdAt; const UserTaskResultsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.taskId = const Value.absent(), this.results = const Value.absent(), this.completedAt = const Value.absent(), this.createdAt = const Value.absent(), }); UserTaskResultsCompanion.insert({ this.id = const Value.absent(), required int userId, required int taskId, this.results = const Value.absent(), this.completedAt = const Value.absent(), this.createdAt = const Value.absent(), }) : userId = Value(userId), taskId = Value(taskId); static Insertable custom({ Expression? id, Expression? userId, Expression? taskId, Expression? results, Expression? completedAt, Expression? createdAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (taskId != null) 'task_id': taskId, if (results != null) 'results': results, if (completedAt != null) 'completed_at': completedAt, if (createdAt != null) 'created_at': createdAt, }); } UserTaskResultsCompanion copyWith( {Value? id, Value? userId, Value? taskId, Value?>? results, Value? completedAt, Value? createdAt}) { return UserTaskResultsCompanion( id: id ?? this.id, userId: userId ?? this.userId, taskId: taskId ?? this.taskId, results: results ?? this.results, completedAt: completedAt ?? this.completedAt, createdAt: createdAt ?? this.createdAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (taskId.present) { map['task_id'] = Variable(taskId.value); } if (results.present) { map['results'] = Variable( $UserTaskResultsTable.$converterresults.toSql(results.value)); } if (completedAt.present) { map['completed_at'] = Variable(completedAt.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } return map; } @override String toString() { return (StringBuffer('UserTaskResultsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('taskId: $taskId, ') ..write('results: $results, ') ..write('completedAt: $completedAt, ') ..write('createdAt: $createdAt') ..write(')')) .toString(); } } class $PromoCodesCampaignsTable extends PromoCodesCampaigns with TableInfo<$PromoCodesCampaignsTable, PromoCodesCampaign> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $PromoCodesCampaignsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _templateMeta = const VerificationMeta('template'); @override late final GeneratedColumn template = GeneratedColumn( 'template', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _productsMeta = const VerificationMeta('products'); @override late final GeneratedColumnWithTypeConverter?, String> products = GeneratedColumn('products', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>( $PromoCodesCampaignsTable.$converterproducts); static const VerificationMeta _activationsPerCodeMeta = const VerificationMeta('activationsPerCode'); @override late final GeneratedColumn activationsPerCode = GeneratedColumn( 'activations_per_code', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _activationsPerUserMeta = const VerificationMeta('activationsPerUser'); @override late final GeneratedColumn activationsPerUser = GeneratedColumn( 'activations_per_user', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _generationSizeMeta = const VerificationMeta('generationSize'); @override late final GeneratedColumn generationSize = GeneratedColumn( 'generation_size', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true); static const VerificationMeta _startMeta = const VerificationMeta('start'); @override late final GeneratedColumn start = GeneratedColumn( 'start', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _finishMeta = const VerificationMeta('finish'); @override late final GeneratedColumn finish = GeneratedColumn( 'finish', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( 'status', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); @override late final GeneratedColumnWithTypeConverter, String> tags = GeneratedColumn('tags', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>( $PromoCodesCampaignsTable.$convertertags); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, template, name, products, activationsPerCode, activationsPerUser, generationSize, start, finish, status, tags, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'promo_codes_campaigns'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('template')) { context.handle(_templateMeta, template.isAcceptableOrUnknown(data['template']!, _templateMeta)); } else if (isInserting) { context.missing(_templateMeta); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } context.handle(_productsMeta, const VerificationResult.success()); if (data.containsKey('activations_per_code')) { context.handle( _activationsPerCodeMeta, activationsPerCode.isAcceptableOrUnknown( data['activations_per_code']!, _activationsPerCodeMeta)); } else if (isInserting) { context.missing(_activationsPerCodeMeta); } if (data.containsKey('activations_per_user')) { context.handle( _activationsPerUserMeta, activationsPerUser.isAcceptableOrUnknown( data['activations_per_user']!, _activationsPerUserMeta)); } else if (isInserting) { context.missing(_activationsPerUserMeta); } if (data.containsKey('generation_size')) { context.handle( _generationSizeMeta, generationSize.isAcceptableOrUnknown( data['generation_size']!, _generationSizeMeta)); } else if (isInserting) { context.missing(_generationSizeMeta); } if (data.containsKey('start')) { context.handle( _startMeta, start.isAcceptableOrUnknown(data['start']!, _startMeta)); } else if (isInserting) { context.missing(_startMeta); } if (data.containsKey('finish')) { context.handle(_finishMeta, finish.isAcceptableOrUnknown(data['finish']!, _finishMeta)); } else if (isInserting) { context.missing(_finishMeta); } if (data.containsKey('status')) { context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); } else if (isInserting) { context.missing(_statusMeta); } context.handle(_tagsMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override PromoCodesCampaign map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return PromoCodesCampaign( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, template: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}template'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name']), products: $PromoCodesCampaignsTable.$converterproducts.fromSql( attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}products'])!), activationsPerCode: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}activations_per_code'])!, activationsPerUser: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}activations_per_user'])!, generationSize: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}generation_size'])!, start: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}start'])!, finish: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}finish'])!, status: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}status'])!, tags: $PromoCodesCampaignsTable.$convertertags.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $PromoCodesCampaignsTable createAlias(String alias) { return $PromoCodesCampaignsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterproducts = const JsonListConverter(); static TypeConverter, String> $convertertags = const StringListConverter(); } class PromoCodesCampaign extends DataClass implements Insertable { final int id; final String template; final String? name; final List? products; final int activationsPerCode; final int activationsPerUser; final int generationSize; final DateTime start; final DateTime finish; final String status; final List tags; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const PromoCodesCampaign( {required this.id, required this.template, this.name, this.products, required this.activationsPerCode, required this.activationsPerUser, required this.generationSize, required this.start, required this.finish, required this.status, required this.tags, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['template'] = Variable(template); if (!nullToAbsent || name != null) { map['name'] = Variable(name); } if (!nullToAbsent || products != null) { map['products'] = Variable( $PromoCodesCampaignsTable.$converterproducts.toSql(products)); } map['activations_per_code'] = Variable(activationsPerCode); map['activations_per_user'] = Variable(activationsPerUser); map['generation_size'] = Variable(generationSize); map['start'] = Variable(start); map['finish'] = Variable(finish); map['status'] = Variable(status); { map['tags'] = Variable( $PromoCodesCampaignsTable.$convertertags.toSql(tags)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } PromoCodesCampaignsCompanion toCompanion(bool nullToAbsent) { return PromoCodesCampaignsCompanion( id: Value(id), template: Value(template), name: name == null && nullToAbsent ? const Value.absent() : Value(name), products: products == null && nullToAbsent ? const Value.absent() : Value(products), activationsPerCode: Value(activationsPerCode), activationsPerUser: Value(activationsPerUser), generationSize: Value(generationSize), start: Value(start), finish: Value(finish), status: Value(status), tags: Value(tags), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory PromoCodesCampaign.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return PromoCodesCampaign( id: serializer.fromJson(json['id']), template: serializer.fromJson(json['template']), name: serializer.fromJson(json['name']), products: serializer.fromJson?>(json['products']), activationsPerCode: serializer.fromJson(json['activationsPerCode']), activationsPerUser: serializer.fromJson(json['activationsPerUser']), generationSize: serializer.fromJson(json['generationSize']), start: serializer.fromJson(json['start']), finish: serializer.fromJson(json['finish']), status: serializer.fromJson(json['status']), tags: serializer.fromJson>(json['tags']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'template': serializer.toJson(template), 'name': serializer.toJson(name), 'products': serializer.toJson?>(products), 'activationsPerCode': serializer.toJson(activationsPerCode), 'activationsPerUser': serializer.toJson(activationsPerUser), 'generationSize': serializer.toJson(generationSize), 'start': serializer.toJson(start), 'finish': serializer.toJson(finish), 'status': serializer.toJson(status), 'tags': serializer.toJson>(tags), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } PromoCodesCampaign copyWith( {int? id, String? template, Value name = const Value.absent(), Value?> products = const Value.absent(), int? activationsPerCode, int? activationsPerUser, int? generationSize, DateTime? start, DateTime? finish, String? status, List? tags, DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => PromoCodesCampaign( id: id ?? this.id, template: template ?? this.template, name: name.present ? name.value : this.name, products: products.present ? products.value : this.products, activationsPerCode: activationsPerCode ?? this.activationsPerCode, activationsPerUser: activationsPerUser ?? this.activationsPerUser, generationSize: generationSize ?? this.generationSize, start: start ?? this.start, finish: finish ?? this.finish, status: status ?? this.status, tags: tags ?? this.tags, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('PromoCodesCampaign(') ..write('id: $id, ') ..write('template: $template, ') ..write('name: $name, ') ..write('products: $products, ') ..write('activationsPerCode: $activationsPerCode, ') ..write('activationsPerUser: $activationsPerUser, ') ..write('generationSize: $generationSize, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('status: $status, ') ..write('tags: $tags, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, template, name, products, activationsPerCode, activationsPerUser, generationSize, start, finish, status, tags, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is PromoCodesCampaign && other.id == this.id && other.template == this.template && other.name == this.name && other.products == this.products && other.activationsPerCode == this.activationsPerCode && other.activationsPerUser == this.activationsPerUser && other.generationSize == this.generationSize && other.start == this.start && other.finish == this.finish && other.status == this.status && other.tags == this.tags && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class PromoCodesCampaignsCompanion extends UpdateCompanion { final Value id; final Value template; final Value name; final Value?> products; final Value activationsPerCode; final Value activationsPerUser; final Value generationSize; final Value start; final Value finish; final Value status; final Value> tags; final Value createdAt; final Value updatedAt; final Value isDeleted; const PromoCodesCampaignsCompanion({ this.id = const Value.absent(), this.template = const Value.absent(), this.name = const Value.absent(), this.products = const Value.absent(), this.activationsPerCode = const Value.absent(), this.activationsPerUser = const Value.absent(), this.generationSize = const Value.absent(), this.start = const Value.absent(), this.finish = const Value.absent(), this.status = const Value.absent(), this.tags = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); PromoCodesCampaignsCompanion.insert({ this.id = const Value.absent(), required String template, this.name = const Value.absent(), this.products = const Value.absent(), required int activationsPerCode, required int activationsPerUser, required int generationSize, required DateTime start, required DateTime finish, required String status, this.tags = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : template = Value(template), activationsPerCode = Value(activationsPerCode), activationsPerUser = Value(activationsPerUser), generationSize = Value(generationSize), start = Value(start), finish = Value(finish), status = Value(status); static Insertable custom({ Expression? id, Expression? template, Expression? name, Expression? products, Expression? activationsPerCode, Expression? activationsPerUser, Expression? generationSize, Expression? start, Expression? finish, Expression? status, Expression? tags, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (template != null) 'template': template, if (name != null) 'name': name, if (products != null) 'products': products, if (activationsPerCode != null) 'activations_per_code': activationsPerCode, if (activationsPerUser != null) 'activations_per_user': activationsPerUser, if (generationSize != null) 'generation_size': generationSize, if (start != null) 'start': start, if (finish != null) 'finish': finish, if (status != null) 'status': status, if (tags != null) 'tags': tags, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } PromoCodesCampaignsCompanion copyWith( {Value? id, Value? template, Value? name, Value?>? products, Value? activationsPerCode, Value? activationsPerUser, Value? generationSize, Value? start, Value? finish, Value? status, Value>? tags, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return PromoCodesCampaignsCompanion( id: id ?? this.id, template: template ?? this.template, name: name ?? this.name, products: products ?? this.products, activationsPerCode: activationsPerCode ?? this.activationsPerCode, activationsPerUser: activationsPerUser ?? this.activationsPerUser, generationSize: generationSize ?? this.generationSize, start: start ?? this.start, finish: finish ?? this.finish, status: status ?? this.status, tags: tags ?? this.tags, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (template.present) { map['template'] = Variable(template.value); } if (name.present) { map['name'] = Variable(name.value); } if (products.present) { map['products'] = Variable( $PromoCodesCampaignsTable.$converterproducts.toSql(products.value)); } if (activationsPerCode.present) { map['activations_per_code'] = Variable(activationsPerCode.value); } if (activationsPerUser.present) { map['activations_per_user'] = Variable(activationsPerUser.value); } if (generationSize.present) { map['generation_size'] = Variable(generationSize.value); } if (start.present) { map['start'] = Variable(start.value); } if (finish.present) { map['finish'] = Variable(finish.value); } if (status.present) { map['status'] = Variable(status.value); } if (tags.present) { map['tags'] = Variable( $PromoCodesCampaignsTable.$convertertags.toSql(tags.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('PromoCodesCampaignsCompanion(') ..write('id: $id, ') ..write('template: $template, ') ..write('name: $name, ') ..write('products: $products, ') ..write('activationsPerCode: $activationsPerCode, ') ..write('activationsPerUser: $activationsPerUser, ') ..write('generationSize: $generationSize, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('status: $status, ') ..write('tags: $tags, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $PromoCodesTable extends PromoCodes with TableInfo<$PromoCodesTable, PromoCode> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $PromoCodesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _campaignIdMeta = const VerificationMeta('campaignId'); @override late final GeneratedColumn campaignId = GeneratedColumn( 'campaign_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES promo_codes_campaigns (id) ON DELETE CASCADE')); static const VerificationMeta _codeMeta = const VerificationMeta('code'); @override late final GeneratedColumn code = GeneratedColumn( 'code', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _activationsMeta = const VerificationMeta('activations'); @override late final GeneratedColumn activations = GeneratedColumn( 'activations', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, campaignId, code, activations, userId, createdAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'promo_codes'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('campaign_id')) { context.handle( _campaignIdMeta, campaignId.isAcceptableOrUnknown( data['campaign_id']!, _campaignIdMeta)); } else if (isInserting) { context.missing(_campaignIdMeta); } if (data.containsKey('code')) { context.handle( _codeMeta, code.isAcceptableOrUnknown(data['code']!, _codeMeta)); } else if (isInserting) { context.missing(_codeMeta); } if (data.containsKey('activations')) { context.handle( _activationsMeta, activations.isAcceptableOrUnknown( data['activations']!, _activationsMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override PromoCode map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return PromoCode( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, campaignId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}campaign_id'])!, code: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}code'])!, activations: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}activations'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $PromoCodesTable createAlias(String alias) { return $PromoCodesTable(attachedDatabase, alias); } } class PromoCode extends DataClass implements Insertable { final int id; final int campaignId; final String code; final int activations; final int? userId; final DateTime createdAt; final DateTime updatedAt; const PromoCode( {required this.id, required this.campaignId, required this.code, required this.activations, this.userId, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['campaign_id'] = Variable(campaignId); map['code'] = Variable(code); map['activations'] = Variable(activations); if (!nullToAbsent || userId != null) { map['user_id'] = Variable(userId); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } PromoCodesCompanion toCompanion(bool nullToAbsent) { return PromoCodesCompanion( id: Value(id), campaignId: Value(campaignId), code: Value(code), activations: Value(activations), userId: userId == null && nullToAbsent ? const Value.absent() : Value(userId), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory PromoCode.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return PromoCode( id: serializer.fromJson(json['id']), campaignId: serializer.fromJson(json['campaignId']), code: serializer.fromJson(json['code']), activations: serializer.fromJson(json['activations']), userId: serializer.fromJson(json['userId']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'campaignId': serializer.toJson(campaignId), 'code': serializer.toJson(code), 'activations': serializer.toJson(activations), 'userId': serializer.toJson(userId), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } PromoCode copyWith( {int? id, int? campaignId, String? code, int? activations, Value userId = const Value.absent(), DateTime? createdAt, DateTime? updatedAt}) => PromoCode( id: id ?? this.id, campaignId: campaignId ?? this.campaignId, code: code ?? this.code, activations: activations ?? this.activations, userId: userId.present ? userId.value : this.userId, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('PromoCode(') ..write('id: $id, ') ..write('campaignId: $campaignId, ') ..write('code: $code, ') ..write('activations: $activations, ') ..write('userId: $userId, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, campaignId, code, activations, userId, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is PromoCode && other.id == this.id && other.campaignId == this.campaignId && other.code == this.code && other.activations == this.activations && other.userId == this.userId && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class PromoCodesCompanion extends UpdateCompanion { final Value id; final Value campaignId; final Value code; final Value activations; final Value userId; final Value createdAt; final Value updatedAt; const PromoCodesCompanion({ this.id = const Value.absent(), this.campaignId = const Value.absent(), this.code = const Value.absent(), this.activations = const Value.absent(), this.userId = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); PromoCodesCompanion.insert({ this.id = const Value.absent(), required int campaignId, required String code, this.activations = const Value.absent(), this.userId = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : campaignId = Value(campaignId), code = Value(code); static Insertable custom({ Expression? id, Expression? campaignId, Expression? code, Expression? activations, Expression? userId, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (campaignId != null) 'campaign_id': campaignId, if (code != null) 'code': code, if (activations != null) 'activations': activations, if (userId != null) 'user_id': userId, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } PromoCodesCompanion copyWith( {Value? id, Value? campaignId, Value? code, Value? activations, Value? userId, Value? createdAt, Value? updatedAt}) { return PromoCodesCompanion( id: id ?? this.id, campaignId: campaignId ?? this.campaignId, code: code ?? this.code, activations: activations ?? this.activations, userId: userId ?? this.userId, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (campaignId.present) { map['campaign_id'] = Variable(campaignId.value); } if (code.present) { map['code'] = Variable(code.value); } if (activations.present) { map['activations'] = Variable(activations.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('PromoCodesCompanion(') ..write('id: $id, ') ..write('campaignId: $campaignId, ') ..write('code: $code, ') ..write('activations: $activations, ') ..write('userId: $userId, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $DiscountCampaignsTable extends DiscountCampaigns with TableInfo<$DiscountCampaignsTable, DiscountCampaign> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $DiscountCampaignsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _startMeta = const VerificationMeta('start'); @override late final GeneratedColumn start = GeneratedColumn( 'start', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _finishMeta = const VerificationMeta('finish'); @override late final GeneratedColumn finish = GeneratedColumn( 'finish', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( 'status', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _tagsMeta = const VerificationMeta('tags'); @override late final GeneratedColumnWithTypeConverter, String> tags = GeneratedColumn('tags', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter>($DiscountCampaignsTable.$convertertags); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [id, name, start, finish, status, tags, createdAt, updatedAt, isDeleted]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'discount_campaigns'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } if (data.containsKey('start')) { context.handle( _startMeta, start.isAcceptableOrUnknown(data['start']!, _startMeta)); } else if (isInserting) { context.missing(_startMeta); } if (data.containsKey('finish')) { context.handle(_finishMeta, finish.isAcceptableOrUnknown(data['finish']!, _finishMeta)); } else if (isInserting) { context.missing(_finishMeta); } if (data.containsKey('status')) { context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); } else if (isInserting) { context.missing(_statusMeta); } context.handle(_tagsMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override DiscountCampaign map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return DiscountCampaign( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name']), start: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}start'])!, finish: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}finish'])!, status: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}status'])!, tags: $DiscountCampaignsTable.$convertertags.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}tags'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $DiscountCampaignsTable createAlias(String alias) { return $DiscountCampaignsTable(attachedDatabase, alias); } static TypeConverter, String> $convertertags = const StringListConverter(); } class DiscountCampaign extends DataClass implements Insertable { final int id; final String? name; final DateTime start; final DateTime finish; final String status; final List tags; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const DiscountCampaign( {required this.id, this.name, required this.start, required this.finish, required this.status, required this.tags, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); if (!nullToAbsent || name != null) { map['name'] = Variable(name); } map['start'] = Variable(start); map['finish'] = Variable(finish); map['status'] = Variable(status); { map['tags'] = Variable($DiscountCampaignsTable.$convertertags.toSql(tags)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } DiscountCampaignsCompanion toCompanion(bool nullToAbsent) { return DiscountCampaignsCompanion( id: Value(id), name: name == null && nullToAbsent ? const Value.absent() : Value(name), start: Value(start), finish: Value(finish), status: Value(status), tags: Value(tags), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory DiscountCampaign.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return DiscountCampaign( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), start: serializer.fromJson(json['start']), finish: serializer.fromJson(json['finish']), status: serializer.fromJson(json['status']), tags: serializer.fromJson>(json['tags']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'start': serializer.toJson(start), 'finish': serializer.toJson(finish), 'status': serializer.toJson(status), 'tags': serializer.toJson>(tags), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } DiscountCampaign copyWith( {int? id, Value name = const Value.absent(), DateTime? start, DateTime? finish, String? status, List? tags, DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => DiscountCampaign( id: id ?? this.id, name: name.present ? name.value : this.name, start: start ?? this.start, finish: finish ?? this.finish, status: status ?? this.status, tags: tags ?? this.tags, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('DiscountCampaign(') ..write('id: $id, ') ..write('name: $name, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('status: $status, ') ..write('tags: $tags, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, name, start, finish, status, tags, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is DiscountCampaign && other.id == this.id && other.name == this.name && other.start == this.start && other.finish == this.finish && other.status == this.status && other.tags == this.tags && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class DiscountCampaignsCompanion extends UpdateCompanion { final Value id; final Value name; final Value start; final Value finish; final Value status; final Value> tags; final Value createdAt; final Value updatedAt; final Value isDeleted; const DiscountCampaignsCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.start = const Value.absent(), this.finish = const Value.absent(), this.status = const Value.absent(), this.tags = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); DiscountCampaignsCompanion.insert({ this.id = const Value.absent(), this.name = const Value.absent(), required DateTime start, required DateTime finish, required String status, this.tags = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : start = Value(start), finish = Value(finish), status = Value(status); static Insertable custom({ Expression? id, Expression? name, Expression? start, Expression? finish, Expression? status, Expression? tags, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (start != null) 'start': start, if (finish != null) 'finish': finish, if (status != null) 'status': status, if (tags != null) 'tags': tags, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } DiscountCampaignsCompanion copyWith( {Value? id, Value? name, Value? start, Value? finish, Value? status, Value>? tags, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return DiscountCampaignsCompanion( id: id ?? this.id, name: name ?? this.name, start: start ?? this.start, finish: finish ?? this.finish, status: status ?? this.status, tags: tags ?? this.tags, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (start.present) { map['start'] = Variable(start.value); } if (finish.present) { map['finish'] = Variable(finish.value); } if (status.present) { map['status'] = Variable(status.value); } if (tags.present) { map['tags'] = Variable( $DiscountCampaignsTable.$convertertags.toSql(tags.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('DiscountCampaignsCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('start: $start, ') ..write('finish: $finish, ') ..write('status: $status, ') ..write('tags: $tags, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $DiscountsTable extends Discounts with TableInfo<$DiscountsTable, Discount> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $DiscountsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _campaignIdMeta = const VerificationMeta('campaignId'); @override late final GeneratedColumn campaignId = GeneratedColumn( 'campaign_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES discount_campaigns (id) ON DELETE CASCADE')); static const VerificationMeta _discountPercentMeta = const VerificationMeta('discountPercent'); @override late final GeneratedColumn discountPercent = GeneratedColumn( 'discount_percent', aliasedName, false, type: DriftSqlType.double, requiredDuringInsert: true); static const VerificationMeta _productsMeta = const VerificationMeta('products'); @override late final GeneratedColumnWithTypeConverter?, String> products = GeneratedColumn('products', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('[]')) .withConverter?>($DiscountsTable.$converterproducts); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _isDeletedMeta = const VerificationMeta('isDeleted'); @override late final GeneratedColumn isDeleted = GeneratedColumn( 'is_deleted', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_deleted" IN (0, 1))'), defaultValue: const Constant(false)); @override List get $columns => [ id, campaignId, discountPercent, products, createdAt, updatedAt, isDeleted ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'discounts'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('campaign_id')) { context.handle( _campaignIdMeta, campaignId.isAcceptableOrUnknown( data['campaign_id']!, _campaignIdMeta)); } else if (isInserting) { context.missing(_campaignIdMeta); } if (data.containsKey('discount_percent')) { context.handle( _discountPercentMeta, discountPercent.isAcceptableOrUnknown( data['discount_percent']!, _discountPercentMeta)); } else if (isInserting) { context.missing(_discountPercentMeta); } context.handle(_productsMeta, const VerificationResult.success()); if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } if (data.containsKey('is_deleted')) { context.handle(_isDeletedMeta, isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta)); } return context; } @override Set get $primaryKey => {id}; @override Discount map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Discount( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, campaignId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}campaign_id'])!, discountPercent: attachedDatabase.typeMapping.read( DriftSqlType.double, data['${effectivePrefix}discount_percent'])!, products: $DiscountsTable.$converterproducts.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.string, data['${effectivePrefix}products'])!), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, isDeleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}is_deleted'])!, ); } @override $DiscountsTable createAlias(String alias) { return $DiscountsTable(attachedDatabase, alias); } static TypeConverter?, String> $converterproducts = const JsonListConverter(); } class Discount extends DataClass implements Insertable { final int id; final int campaignId; final double discountPercent; final List? products; final DateTime createdAt; final DateTime updatedAt; final bool isDeleted; const Discount( {required this.id, required this.campaignId, required this.discountPercent, this.products, required this.createdAt, required this.updatedAt, required this.isDeleted}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['campaign_id'] = Variable(campaignId); map['discount_percent'] = Variable(discountPercent); if (!nullToAbsent || products != null) { map['products'] = Variable($DiscountsTable.$converterproducts.toSql(products)); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); map['is_deleted'] = Variable(isDeleted); return map; } DiscountsCompanion toCompanion(bool nullToAbsent) { return DiscountsCompanion( id: Value(id), campaignId: Value(campaignId), discountPercent: Value(discountPercent), products: products == null && nullToAbsent ? const Value.absent() : Value(products), createdAt: Value(createdAt), updatedAt: Value(updatedAt), isDeleted: Value(isDeleted), ); } factory Discount.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Discount( id: serializer.fromJson(json['id']), campaignId: serializer.fromJson(json['campaignId']), discountPercent: serializer.fromJson(json['discountPercent']), products: serializer.fromJson?>(json['products']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), isDeleted: serializer.fromJson(json['isDeleted']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'campaignId': serializer.toJson(campaignId), 'discountPercent': serializer.toJson(discountPercent), 'products': serializer.toJson?>(products), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), 'isDeleted': serializer.toJson(isDeleted), }; } Discount copyWith( {int? id, int? campaignId, double? discountPercent, Value?> products = const Value.absent(), DateTime? createdAt, DateTime? updatedAt, bool? isDeleted}) => Discount( id: id ?? this.id, campaignId: campaignId ?? this.campaignId, discountPercent: discountPercent ?? this.discountPercent, products: products.present ? products.value : this.products, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); @override String toString() { return (StringBuffer('Discount(') ..write('id: $id, ') ..write('campaignId: $campaignId, ') ..write('discountPercent: $discountPercent, ') ..write('products: $products, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, campaignId, discountPercent, products, createdAt, updatedAt, isDeleted); @override bool operator ==(Object other) => identical(this, other) || (other is Discount && other.id == this.id && other.campaignId == this.campaignId && other.discountPercent == this.discountPercent && other.products == this.products && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt && other.isDeleted == this.isDeleted); } class DiscountsCompanion extends UpdateCompanion { final Value id; final Value campaignId; final Value discountPercent; final Value?> products; final Value createdAt; final Value updatedAt; final Value isDeleted; const DiscountsCompanion({ this.id = const Value.absent(), this.campaignId = const Value.absent(), this.discountPercent = const Value.absent(), this.products = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }); DiscountsCompanion.insert({ this.id = const Value.absent(), required int campaignId, required double discountPercent, this.products = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), this.isDeleted = const Value.absent(), }) : campaignId = Value(campaignId), discountPercent = Value(discountPercent); static Insertable custom({ Expression? id, Expression? campaignId, Expression? discountPercent, Expression? products, Expression? createdAt, Expression? updatedAt, Expression? isDeleted, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (campaignId != null) 'campaign_id': campaignId, if (discountPercent != null) 'discount_percent': discountPercent, if (products != null) 'products': products, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, if (isDeleted != null) 'is_deleted': isDeleted, }); } DiscountsCompanion copyWith( {Value? id, Value? campaignId, Value? discountPercent, Value?>? products, Value? createdAt, Value? updatedAt, Value? isDeleted}) { return DiscountsCompanion( id: id ?? this.id, campaignId: campaignId ?? this.campaignId, discountPercent: discountPercent ?? this.discountPercent, products: products ?? this.products, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, isDeleted: isDeleted ?? this.isDeleted, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (campaignId.present) { map['campaign_id'] = Variable(campaignId.value); } if (discountPercent.present) { map['discount_percent'] = Variable(discountPercent.value); } if (products.present) { map['products'] = Variable( $DiscountsTable.$converterproducts.toSql(products.value)); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } if (isDeleted.present) { map['is_deleted'] = Variable(isDeleted.value); } return map; } @override String toString() { return (StringBuffer('DiscountsCompanion(') ..write('id: $id, ') ..write('campaignId: $campaignId, ') ..write('discountPercent: $discountPercent, ') ..write('products: $products, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt, ') ..write('isDeleted: $isDeleted') ..write(')')) .toString(); } } class $DiscountUserDatasTable extends DiscountUserDatas with TableInfo<$DiscountUserDatasTable, DiscountUserData> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $DiscountUserDatasTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _discountIdMeta = const VerificationMeta('discountId'); @override late final GeneratedColumn discountId = GeneratedColumn( 'discount_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES discounts (id) ON DELETE CASCADE')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _grantedAtMeta = const VerificationMeta('grantedAt'); @override late final GeneratedColumn grantedAt = GeneratedColumn( 'granted_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [discountId, userId, grantedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'discount_user_datas'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('discount_id')) { context.handle( _discountIdMeta, discountId.isAcceptableOrUnknown( data['discount_id']!, _discountIdMeta)); } else if (isInserting) { context.missing(_discountIdMeta); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('granted_at')) { context.handle(_grantedAtMeta, grantedAt.isAcceptableOrUnknown(data['granted_at']!, _grantedAtMeta)); } return context; } @override Set get $primaryKey => {discountId, userId}; @override DiscountUserData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return DiscountUserData( discountId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}discount_id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, grantedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}granted_at'])!, ); } @override $DiscountUserDatasTable createAlias(String alias) { return $DiscountUserDatasTable(attachedDatabase, alias); } } class DiscountUserData extends DataClass implements Insertable { final int discountId; final int userId; final DateTime grantedAt; const DiscountUserData( {required this.discountId, required this.userId, required this.grantedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['discount_id'] = Variable(discountId); map['user_id'] = Variable(userId); map['granted_at'] = Variable(grantedAt); return map; } DiscountUserDatasCompanion toCompanion(bool nullToAbsent) { return DiscountUserDatasCompanion( discountId: Value(discountId), userId: Value(userId), grantedAt: Value(grantedAt), ); } factory DiscountUserData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return DiscountUserData( discountId: serializer.fromJson(json['discountId']), userId: serializer.fromJson(json['userId']), grantedAt: serializer.fromJson(json['grantedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'discountId': serializer.toJson(discountId), 'userId': serializer.toJson(userId), 'grantedAt': serializer.toJson(grantedAt), }; } DiscountUserData copyWith( {int? discountId, int? userId, DateTime? grantedAt}) => DiscountUserData( discountId: discountId ?? this.discountId, userId: userId ?? this.userId, grantedAt: grantedAt ?? this.grantedAt, ); @override String toString() { return (StringBuffer('DiscountUserData(') ..write('discountId: $discountId, ') ..write('userId: $userId, ') ..write('grantedAt: $grantedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(discountId, userId, grantedAt); @override bool operator ==(Object other) => identical(this, other) || (other is DiscountUserData && other.discountId == this.discountId && other.userId == this.userId && other.grantedAt == this.grantedAt); } class DiscountUserDatasCompanion extends UpdateCompanion { final Value discountId; final Value userId; final Value grantedAt; final Value rowid; const DiscountUserDatasCompanion({ this.discountId = const Value.absent(), this.userId = const Value.absent(), this.grantedAt = const Value.absent(), this.rowid = const Value.absent(), }); DiscountUserDatasCompanion.insert({ required int discountId, required int userId, this.grantedAt = const Value.absent(), this.rowid = const Value.absent(), }) : discountId = Value(discountId), userId = Value(userId); static Insertable custom({ Expression? discountId, Expression? userId, Expression? grantedAt, Expression? rowid, }) { return RawValuesInsertable({ if (discountId != null) 'discount_id': discountId, if (userId != null) 'user_id': userId, if (grantedAt != null) 'granted_at': grantedAt, if (rowid != null) 'rowid': rowid, }); } DiscountUserDatasCompanion copyWith( {Value? discountId, Value? userId, Value? grantedAt, Value? rowid}) { return DiscountUserDatasCompanion( discountId: discountId ?? this.discountId, userId: userId ?? this.userId, grantedAt: grantedAt ?? this.grantedAt, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (discountId.present) { map['discount_id'] = Variable(discountId.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (grantedAt.present) { map['granted_at'] = Variable(grantedAt.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('DiscountUserDatasCompanion(') ..write('discountId: $discountId, ') ..write('userId: $userId, ') ..write('grantedAt: $grantedAt, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class $StudySessionsTable extends StudySessions with TableInfo<$StudySessionsTable, StudySession> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $StudySessionsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _sessionIdMeta = const VerificationMeta('sessionId'); @override late final GeneratedColumn sessionId = GeneratedColumn( 'session_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); static const VerificationMeta _startTimeMeta = const VerificationMeta('startTime'); @override late final GeneratedColumn startTime = GeneratedColumn( 'start_time', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true); static const VerificationMeta _endTimeMeta = const VerificationMeta('endTime'); @override late final GeneratedColumn endTime = GeneratedColumn( 'end_time', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _wordsLearnedMeta = const VerificationMeta('wordsLearned'); @override late final GeneratedColumn wordsLearned = GeneratedColumn( 'words_learned', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _testsCompletedMeta = const VerificationMeta('testsCompleted'); @override late final GeneratedColumn testsCompleted = GeneratedColumn( 'tests_completed', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, defaultValue: const Constant(0)); static const VerificationMeta _accuracyMeta = const VerificationMeta('accuracy'); @override late final GeneratedColumn accuracy = GeneratedColumn( 'accuracy', aliasedName, false, type: DriftSqlType.double, requiredDuringInsert: false, defaultValue: const Constant(0.0)); static const VerificationMeta _packIdMeta = const VerificationMeta('packId'); @override late final GeneratedColumn packId = GeneratedColumn( 'pack_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _testIdMeta = const VerificationMeta('testId'); @override late final GeneratedColumn testId = GeneratedColumn( 'test_id', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, userId, sessionId, startTime, endTime, wordsLearned, testsCompleted, accuracy, packId, testId, createdAt, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'study_sessions'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('session_id')) { context.handle(_sessionIdMeta, sessionId.isAcceptableOrUnknown(data['session_id']!, _sessionIdMeta)); } if (data.containsKey('start_time')) { context.handle(_startTimeMeta, startTime.isAcceptableOrUnknown(data['start_time']!, _startTimeMeta)); } else if (isInserting) { context.missing(_startTimeMeta); } if (data.containsKey('end_time')) { context.handle(_endTimeMeta, endTime.isAcceptableOrUnknown(data['end_time']!, _endTimeMeta)); } if (data.containsKey('words_learned')) { context.handle( _wordsLearnedMeta, wordsLearned.isAcceptableOrUnknown( data['words_learned']!, _wordsLearnedMeta)); } if (data.containsKey('tests_completed')) { context.handle( _testsCompletedMeta, testsCompleted.isAcceptableOrUnknown( data['tests_completed']!, _testsCompletedMeta)); } if (data.containsKey('accuracy')) { context.handle(_accuracyMeta, accuracy.isAcceptableOrUnknown(data['accuracy']!, _accuracyMeta)); } if (data.containsKey('pack_id')) { context.handle(_packIdMeta, packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta)); } if (data.containsKey('test_id')) { context.handle(_testIdMeta, testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override StudySession map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return StudySession( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, sessionId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}session_id']), startTime: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}start_time'])!, endTime: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}end_time']), wordsLearned: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}words_learned'])!, testsCompleted: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}tests_completed'])!, accuracy: attachedDatabase.typeMapping .read(DriftSqlType.double, data['${effectivePrefix}accuracy'])!, packId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}pack_id']), testId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}test_id']), createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $StudySessionsTable createAlias(String alias) { return $StudySessionsTable(attachedDatabase, alias); } } class StudySession extends DataClass implements Insertable { final int id; final int userId; final String? sessionId; final DateTime startTime; final DateTime? endTime; final int wordsLearned; final int testsCompleted; final double accuracy; final String? packId; final String? testId; final DateTime createdAt; final DateTime updatedAt; const StudySession( {required this.id, required this.userId, this.sessionId, required this.startTime, this.endTime, required this.wordsLearned, required this.testsCompleted, required this.accuracy, this.packId, this.testId, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); if (!nullToAbsent || sessionId != null) { map['session_id'] = Variable(sessionId); } map['start_time'] = Variable(startTime); if (!nullToAbsent || endTime != null) { map['end_time'] = Variable(endTime); } map['words_learned'] = Variable(wordsLearned); map['tests_completed'] = Variable(testsCompleted); map['accuracy'] = Variable(accuracy); if (!nullToAbsent || packId != null) { map['pack_id'] = Variable(packId); } if (!nullToAbsent || testId != null) { map['test_id'] = Variable(testId); } map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } StudySessionsCompanion toCompanion(bool nullToAbsent) { return StudySessionsCompanion( id: Value(id), userId: Value(userId), sessionId: sessionId == null && nullToAbsent ? const Value.absent() : Value(sessionId), startTime: Value(startTime), endTime: endTime == null && nullToAbsent ? const Value.absent() : Value(endTime), wordsLearned: Value(wordsLearned), testsCompleted: Value(testsCompleted), accuracy: Value(accuracy), packId: packId == null && nullToAbsent ? const Value.absent() : Value(packId), testId: testId == null && nullToAbsent ? const Value.absent() : Value(testId), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory StudySession.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return StudySession( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), sessionId: serializer.fromJson(json['sessionId']), startTime: serializer.fromJson(json['startTime']), endTime: serializer.fromJson(json['endTime']), wordsLearned: serializer.fromJson(json['wordsLearned']), testsCompleted: serializer.fromJson(json['testsCompleted']), accuracy: serializer.fromJson(json['accuracy']), packId: serializer.fromJson(json['packId']), testId: serializer.fromJson(json['testId']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'sessionId': serializer.toJson(sessionId), 'startTime': serializer.toJson(startTime), 'endTime': serializer.toJson(endTime), 'wordsLearned': serializer.toJson(wordsLearned), 'testsCompleted': serializer.toJson(testsCompleted), 'accuracy': serializer.toJson(accuracy), 'packId': serializer.toJson(packId), 'testId': serializer.toJson(testId), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } StudySession copyWith( {int? id, int? userId, Value sessionId = const Value.absent(), DateTime? startTime, Value endTime = const Value.absent(), int? wordsLearned, int? testsCompleted, double? accuracy, Value packId = const Value.absent(), Value testId = const Value.absent(), DateTime? createdAt, DateTime? updatedAt}) => StudySession( id: id ?? this.id, userId: userId ?? this.userId, sessionId: sessionId.present ? sessionId.value : this.sessionId, startTime: startTime ?? this.startTime, endTime: endTime.present ? endTime.value : this.endTime, wordsLearned: wordsLearned ?? this.wordsLearned, testsCompleted: testsCompleted ?? this.testsCompleted, accuracy: accuracy ?? this.accuracy, packId: packId.present ? packId.value : this.packId, testId: testId.present ? testId.value : this.testId, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('StudySession(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('sessionId: $sessionId, ') ..write('startTime: $startTime, ') ..write('endTime: $endTime, ') ..write('wordsLearned: $wordsLearned, ') ..write('testsCompleted: $testsCompleted, ') ..write('accuracy: $accuracy, ') ..write('packId: $packId, ') ..write('testId: $testId, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, userId, sessionId, startTime, endTime, wordsLearned, testsCompleted, accuracy, packId, testId, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is StudySession && other.id == this.id && other.userId == this.userId && other.sessionId == this.sessionId && other.startTime == this.startTime && other.endTime == this.endTime && other.wordsLearned == this.wordsLearned && other.testsCompleted == this.testsCompleted && other.accuracy == this.accuracy && other.packId == this.packId && other.testId == this.testId && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class StudySessionsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value sessionId; final Value startTime; final Value endTime; final Value wordsLearned; final Value testsCompleted; final Value accuracy; final Value packId; final Value testId; final Value createdAt; final Value updatedAt; const StudySessionsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.sessionId = const Value.absent(), this.startTime = const Value.absent(), this.endTime = const Value.absent(), this.wordsLearned = const Value.absent(), this.testsCompleted = const Value.absent(), this.accuracy = const Value.absent(), this.packId = const Value.absent(), this.testId = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); StudySessionsCompanion.insert({ this.id = const Value.absent(), required int userId, this.sessionId = const Value.absent(), required DateTime startTime, this.endTime = const Value.absent(), this.wordsLearned = const Value.absent(), this.testsCompleted = const Value.absent(), this.accuracy = const Value.absent(), this.packId = const Value.absent(), this.testId = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), startTime = Value(startTime); static Insertable custom({ Expression? id, Expression? userId, Expression? sessionId, Expression? startTime, Expression? endTime, Expression? wordsLearned, Expression? testsCompleted, Expression? accuracy, Expression? packId, Expression? testId, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (sessionId != null) 'session_id': sessionId, if (startTime != null) 'start_time': startTime, if (endTime != null) 'end_time': endTime, if (wordsLearned != null) 'words_learned': wordsLearned, if (testsCompleted != null) 'tests_completed': testsCompleted, if (accuracy != null) 'accuracy': accuracy, if (packId != null) 'pack_id': packId, if (testId != null) 'test_id': testId, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } StudySessionsCompanion copyWith( {Value? id, Value? userId, Value? sessionId, Value? startTime, Value? endTime, Value? wordsLearned, Value? testsCompleted, Value? accuracy, Value? packId, Value? testId, Value? createdAt, Value? updatedAt}) { return StudySessionsCompanion( id: id ?? this.id, userId: userId ?? this.userId, sessionId: sessionId ?? this.sessionId, startTime: startTime ?? this.startTime, endTime: endTime ?? this.endTime, wordsLearned: wordsLearned ?? this.wordsLearned, testsCompleted: testsCompleted ?? this.testsCompleted, accuracy: accuracy ?? this.accuracy, packId: packId ?? this.packId, testId: testId ?? this.testId, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (sessionId.present) { map['session_id'] = Variable(sessionId.value); } if (startTime.present) { map['start_time'] = Variable(startTime.value); } if (endTime.present) { map['end_time'] = Variable(endTime.value); } if (wordsLearned.present) { map['words_learned'] = Variable(wordsLearned.value); } if (testsCompleted.present) { map['tests_completed'] = Variable(testsCompleted.value); } if (accuracy.present) { map['accuracy'] = Variable(accuracy.value); } if (packId.present) { map['pack_id'] = Variable(packId.value); } if (testId.present) { map['test_id'] = Variable(testId.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('StudySessionsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('sessionId: $sessionId, ') ..write('startTime: $startTime, ') ..write('endTime: $endTime, ') ..write('wordsLearned: $wordsLearned, ') ..write('testsCompleted: $testsCompleted, ') ..write('accuracy: $accuracy, ') ..write('packId: $packId, ') ..write('testId: $testId, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $UserAchievementsTable extends UserAchievements with TableInfo<$UserAchievementsTable, UserAchievement> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UserAchievementsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _userIdMeta = const VerificationMeta('userId'); @override late final GeneratedColumn userId = GeneratedColumn( 'user_id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES users (id) ON DELETE CASCADE')); static const VerificationMeta _achievementIdMeta = const VerificationMeta('achievementId'); @override late final GeneratedColumn achievementId = GeneratedColumn( 'achievement_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _unlockedAtMeta = const VerificationMeta('unlockedAt'); @override late final GeneratedColumn unlockedAt = GeneratedColumn( 'unlocked_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _progressMeta = const VerificationMeta('progress'); @override late final GeneratedColumn progress = GeneratedColumn( 'progress', aliasedName, false, type: DriftSqlType.double, requiredDuringInsert: false, defaultValue: const Constant(1.0)); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [id, userId, achievementId, unlockedAt, progress, createdAt, updatedAt]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'user_achievements'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('user_id')) { context.handle(_userIdMeta, userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta)); } else if (isInserting) { context.missing(_userIdMeta); } if (data.containsKey('achievement_id')) { context.handle( _achievementIdMeta, achievementId.isAcceptableOrUnknown( data['achievement_id']!, _achievementIdMeta)); } else if (isInserting) { context.missing(_achievementIdMeta); } if (data.containsKey('unlocked_at')) { context.handle( _unlockedAtMeta, unlockedAt.isAcceptableOrUnknown( data['unlocked_at']!, _unlockedAtMeta)); } if (data.containsKey('progress')) { context.handle(_progressMeta, progress.isAcceptableOrUnknown(data['progress']!, _progressMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override UserAchievement map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UserAchievement( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, userId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}user_id'])!, achievementId: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}achievement_id'])!, unlockedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}unlocked_at'])!, progress: attachedDatabase.typeMapping .read(DriftSqlType.double, data['${effectivePrefix}progress'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $UserAchievementsTable createAlias(String alias) { return $UserAchievementsTable(attachedDatabase, alias); } } class UserAchievement extends DataClass implements Insertable { final int id; final int userId; final String achievementId; final DateTime unlockedAt; final double progress; final DateTime createdAt; final DateTime updatedAt; const UserAchievement( {required this.id, required this.userId, required this.achievementId, required this.unlockedAt, required this.progress, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['user_id'] = Variable(userId); map['achievement_id'] = Variable(achievementId); map['unlocked_at'] = Variable(unlockedAt); map['progress'] = Variable(progress); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } UserAchievementsCompanion toCompanion(bool nullToAbsent) { return UserAchievementsCompanion( id: Value(id), userId: Value(userId), achievementId: Value(achievementId), unlockedAt: Value(unlockedAt), progress: Value(progress), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory UserAchievement.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UserAchievement( id: serializer.fromJson(json['id']), userId: serializer.fromJson(json['userId']), achievementId: serializer.fromJson(json['achievementId']), unlockedAt: serializer.fromJson(json['unlockedAt']), progress: serializer.fromJson(json['progress']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'userId': serializer.toJson(userId), 'achievementId': serializer.toJson(achievementId), 'unlockedAt': serializer.toJson(unlockedAt), 'progress': serializer.toJson(progress), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } UserAchievement copyWith( {int? id, int? userId, String? achievementId, DateTime? unlockedAt, double? progress, DateTime? createdAt, DateTime? updatedAt}) => UserAchievement( id: id ?? this.id, userId: userId ?? this.userId, achievementId: achievementId ?? this.achievementId, unlockedAt: unlockedAt ?? this.unlockedAt, progress: progress ?? this.progress, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('UserAchievement(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('achievementId: $achievementId, ') ..write('unlockedAt: $unlockedAt, ') ..write('progress: $progress, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash( id, userId, achievementId, unlockedAt, progress, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is UserAchievement && other.id == this.id && other.userId == this.userId && other.achievementId == this.achievementId && other.unlockedAt == this.unlockedAt && other.progress == this.progress && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class UserAchievementsCompanion extends UpdateCompanion { final Value id; final Value userId; final Value achievementId; final Value unlockedAt; final Value progress; final Value createdAt; final Value updatedAt; const UserAchievementsCompanion({ this.id = const Value.absent(), this.userId = const Value.absent(), this.achievementId = const Value.absent(), this.unlockedAt = const Value.absent(), this.progress = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); UserAchievementsCompanion.insert({ this.id = const Value.absent(), required int userId, required String achievementId, this.unlockedAt = const Value.absent(), this.progress = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : userId = Value(userId), achievementId = Value(achievementId); static Insertable custom({ Expression? id, Expression? userId, Expression? achievementId, Expression? unlockedAt, Expression? progress, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (userId != null) 'user_id': userId, if (achievementId != null) 'achievement_id': achievementId, if (unlockedAt != null) 'unlocked_at': unlockedAt, if (progress != null) 'progress': progress, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } UserAchievementsCompanion copyWith( {Value? id, Value? userId, Value? achievementId, Value? unlockedAt, Value? progress, Value? createdAt, Value? updatedAt}) { return UserAchievementsCompanion( id: id ?? this.id, userId: userId ?? this.userId, achievementId: achievementId ?? this.achievementId, unlockedAt: unlockedAt ?? this.unlockedAt, progress: progress ?? this.progress, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (userId.present) { map['user_id'] = Variable(userId.value); } if (achievementId.present) { map['achievement_id'] = Variable(achievementId.value); } if (unlockedAt.present) { map['unlocked_at'] = Variable(unlockedAt.value); } if (progress.present) { map['progress'] = Variable(progress.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('UserAchievementsCompanion(') ..write('id: $id, ') ..write('userId: $userId, ') ..write('achievementId: $achievementId, ') ..write('unlockedAt: $unlockedAt, ') ..write('progress: $progress, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } class $ShareRequestsTable extends ShareRequests with TableInfo<$ShareRequestsTable, ShareRequest> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $ShareRequestsTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _telegramUserIdMeta = const VerificationMeta('telegramUserId'); @override late final GeneratedColumn telegramUserId = GeneratedColumn( 'telegram_user_id', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _telegramUsernameMeta = const VerificationMeta('telegramUsername'); @override late final GeneratedColumn telegramUsername = GeneratedColumn( 'telegram_username', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false); static const VerificationMeta _sharedCardIdMeta = const VerificationMeta('sharedCardId'); @override late final GeneratedColumn sharedCardId = GeneratedColumn( 'shared_card_id', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); static const VerificationMeta _requestedAtMeta = const VerificationMeta('requestedAt'); @override late final GeneratedColumn requestedAt = GeneratedColumn( 'requested_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List get $columns => [ id, telegramUserId, telegramUsername, sharedCardId, requestedAt, createdAt, updatedAt ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'share_requests'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('telegram_user_id')) { context.handle( _telegramUserIdMeta, telegramUserId.isAcceptableOrUnknown( data['telegram_user_id']!, _telegramUserIdMeta)); } else if (isInserting) { context.missing(_telegramUserIdMeta); } if (data.containsKey('telegram_username')) { context.handle( _telegramUsernameMeta, telegramUsername.isAcceptableOrUnknown( data['telegram_username']!, _telegramUsernameMeta)); } if (data.containsKey('shared_card_id')) { context.handle( _sharedCardIdMeta, sharedCardId.isAcceptableOrUnknown( data['shared_card_id']!, _sharedCardIdMeta)); } if (data.containsKey('requested_at')) { context.handle( _requestedAtMeta, requestedAt.isAcceptableOrUnknown( data['requested_at']!, _requestedAtMeta)); } if (data.containsKey('created_at')) { context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); } if (data.containsKey('updated_at')) { context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); } return context; } @override Set get $primaryKey => {id}; @override ShareRequest map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ShareRequest( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, telegramUserId: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}telegram_user_id'])!, telegramUsername: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}telegram_username']), sharedCardId: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}shared_card_id']), requestedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}requested_at'])!, createdAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}created_at'])!, updatedAt: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!, ); } @override $ShareRequestsTable createAlias(String alias) { return $ShareRequestsTable(attachedDatabase, alias); } } class ShareRequest extends DataClass implements Insertable { final int id; final String telegramUserId; final String? telegramUsername; final int? sharedCardId; final DateTime requestedAt; final DateTime createdAt; final DateTime updatedAt; const ShareRequest( {required this.id, required this.telegramUserId, this.telegramUsername, this.sharedCardId, required this.requestedAt, required this.createdAt, required this.updatedAt}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['telegram_user_id'] = Variable(telegramUserId); if (!nullToAbsent || telegramUsername != null) { map['telegram_username'] = Variable(telegramUsername); } if (!nullToAbsent || sharedCardId != null) { map['shared_card_id'] = Variable(sharedCardId); } map['requested_at'] = Variable(requestedAt); map['created_at'] = Variable(createdAt); map['updated_at'] = Variable(updatedAt); return map; } ShareRequestsCompanion toCompanion(bool nullToAbsent) { return ShareRequestsCompanion( id: Value(id), telegramUserId: Value(telegramUserId), telegramUsername: telegramUsername == null && nullToAbsent ? const Value.absent() : Value(telegramUsername), sharedCardId: sharedCardId == null && nullToAbsent ? const Value.absent() : Value(sharedCardId), requestedAt: Value(requestedAt), createdAt: Value(createdAt), updatedAt: Value(updatedAt), ); } factory ShareRequest.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ShareRequest( id: serializer.fromJson(json['id']), telegramUserId: serializer.fromJson(json['telegramUserId']), telegramUsername: serializer.fromJson(json['telegramUsername']), sharedCardId: serializer.fromJson(json['sharedCardId']), requestedAt: serializer.fromJson(json['requestedAt']), createdAt: serializer.fromJson(json['createdAt']), updatedAt: serializer.fromJson(json['updatedAt']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'telegramUserId': serializer.toJson(telegramUserId), 'telegramUsername': serializer.toJson(telegramUsername), 'sharedCardId': serializer.toJson(sharedCardId), 'requestedAt': serializer.toJson(requestedAt), 'createdAt': serializer.toJson(createdAt), 'updatedAt': serializer.toJson(updatedAt), }; } ShareRequest copyWith( {int? id, String? telegramUserId, Value telegramUsername = const Value.absent(), Value sharedCardId = const Value.absent(), DateTime? requestedAt, DateTime? createdAt, DateTime? updatedAt}) => ShareRequest( id: id ?? this.id, telegramUserId: telegramUserId ?? this.telegramUserId, telegramUsername: telegramUsername.present ? telegramUsername.value : this.telegramUsername, sharedCardId: sharedCardId.present ? sharedCardId.value : this.sharedCardId, requestedAt: requestedAt ?? this.requestedAt, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); @override String toString() { return (StringBuffer('ShareRequest(') ..write('id: $id, ') ..write('telegramUserId: $telegramUserId, ') ..write('telegramUsername: $telegramUsername, ') ..write('sharedCardId: $sharedCardId, ') ..write('requestedAt: $requestedAt, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, telegramUserId, telegramUsername, sharedCardId, requestedAt, createdAt, updatedAt); @override bool operator ==(Object other) => identical(this, other) || (other is ShareRequest && other.id == this.id && other.telegramUserId == this.telegramUserId && other.telegramUsername == this.telegramUsername && other.sharedCardId == this.sharedCardId && other.requestedAt == this.requestedAt && other.createdAt == this.createdAt && other.updatedAt == this.updatedAt); } class ShareRequestsCompanion extends UpdateCompanion { final Value id; final Value telegramUserId; final Value telegramUsername; final Value sharedCardId; final Value requestedAt; final Value createdAt; final Value updatedAt; const ShareRequestsCompanion({ this.id = const Value.absent(), this.telegramUserId = const Value.absent(), this.telegramUsername = const Value.absent(), this.sharedCardId = const Value.absent(), this.requestedAt = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }); ShareRequestsCompanion.insert({ this.id = const Value.absent(), required String telegramUserId, this.telegramUsername = const Value.absent(), this.sharedCardId = const Value.absent(), this.requestedAt = const Value.absent(), this.createdAt = const Value.absent(), this.updatedAt = const Value.absent(), }) : telegramUserId = Value(telegramUserId); static Insertable custom({ Expression? id, Expression? telegramUserId, Expression? telegramUsername, Expression? sharedCardId, Expression? requestedAt, Expression? createdAt, Expression? updatedAt, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (telegramUserId != null) 'telegram_user_id': telegramUserId, if (telegramUsername != null) 'telegram_username': telegramUsername, if (sharedCardId != null) 'shared_card_id': sharedCardId, if (requestedAt != null) 'requested_at': requestedAt, if (createdAt != null) 'created_at': createdAt, if (updatedAt != null) 'updated_at': updatedAt, }); } ShareRequestsCompanion copyWith( {Value? id, Value? telegramUserId, Value? telegramUsername, Value? sharedCardId, Value? requestedAt, Value? createdAt, Value? updatedAt}) { return ShareRequestsCompanion( id: id ?? this.id, telegramUserId: telegramUserId ?? this.telegramUserId, telegramUsername: telegramUsername ?? this.telegramUsername, sharedCardId: sharedCardId ?? this.sharedCardId, requestedAt: requestedAt ?? this.requestedAt, createdAt: createdAt ?? this.createdAt, updatedAt: updatedAt ?? this.updatedAt, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (telegramUserId.present) { map['telegram_user_id'] = Variable(telegramUserId.value); } if (telegramUsername.present) { map['telegram_username'] = Variable(telegramUsername.value); } if (sharedCardId.present) { map['shared_card_id'] = Variable(sharedCardId.value); } if (requestedAt.present) { map['requested_at'] = Variable(requestedAt.value); } if (createdAt.present) { map['created_at'] = Variable(createdAt.value); } if (updatedAt.present) { map['updated_at'] = Variable(updatedAt.value); } return map; } @override String toString() { return (StringBuffer('ShareRequestsCompanion(') ..write('id: $id, ') ..write('telegramUserId: $telegramUserId, ') ..write('telegramUsername: $telegramUsername, ') ..write('sharedCardId: $sharedCardId, ') ..write('requestedAt: $requestedAt, ') ..write('createdAt: $createdAt, ') ..write('updatedAt: $updatedAt') ..write(')')) .toString(); } } abstract class _$AppDatabase extends GeneratedDatabase { _$AppDatabase(QueryExecutor e) : super(e); late final $UsersTable users = $UsersTable(this); late final $UserDatasTable userDatas = $UserDatasTable(this); late final $TokensTable tokens = $TokensTable(this); late final $RefreshTokensTable refreshTokens = $RefreshTokensTable(this); late final $TelegramAuthCodesTable telegramAuthCodes = $TelegramAuthCodesTable(this); late final $CardPacksTable cardPacks = $CardPacksTable(this); late final $GameCardsTable gameCards = $GameCardsTable(this); late final $VoiceModelsTable voiceModels = $VoiceModelsTable(this); late final $UserPacksTable userPacks = $UserPacksTable(this); late final $PreviewCardsTable previewCards = $PreviewCardsTable(this); late final $CardPackCardsTable cardPackCards = $CardPackCardsTable(this); late final $CardVoicesTable cardVoices = $CardVoicesTable(this); late final $SubscriptionPlansTable subscriptionPlans = $SubscriptionPlansTable(this); late final $UserSubscriptionsTable userSubscriptions = $UserSubscriptionsTable(this); late final $PaymentsTable payments = $PaymentsTable(this); late final $TestsTable tests = $TestsTable(this); late final $TestQuestionsTable testQuestions = $TestQuestionsTable(this); late final $TestPackRelationsTable testPackRelations = $TestPackRelationsTable(this); late final $TestStatisticsTable testStatistics = $TestStatisticsTable(this); late final $TasksTable tasks = $TasksTable(this); late final $UserTasksTable userTasks = $UserTasksTable(this); late final $UserTaskProgressesTable userTaskProgresses = $UserTaskProgressesTable(this); late final $UserTaskResultsTable userTaskResults = $UserTaskResultsTable(this); late final $PromoCodesCampaignsTable promoCodesCampaigns = $PromoCodesCampaignsTable(this); late final $PromoCodesTable promoCodes = $PromoCodesTable(this); late final $DiscountCampaignsTable discountCampaigns = $DiscountCampaignsTable(this); late final $DiscountsTable discounts = $DiscountsTable(this); late final $DiscountUserDatasTable discountUserDatas = $DiscountUserDatasTable(this); late final $StudySessionsTable studySessions = $StudySessionsTable(this); late final $UserAchievementsTable userAchievements = $UserAchievementsTable(this); late final $ShareRequestsTable shareRequests = $ShareRequestsTable(this); late final UserDao userDao = UserDao(this as AppDatabase); late final PackDao packDao = PackDao(this as AppDatabase); late final TestDao testDao = TestDao(this as AppDatabase); late final PaymentDao paymentDao = PaymentDao(this as AppDatabase); late final SubscriptionDao subscriptionDao = SubscriptionDao(this as AppDatabase); late final TaskDao taskDao = TaskDao(this as AppDatabase); late final PromoCodeDao promoCodeDao = PromoCodeDao(this as AppDatabase); late final DiscountDao discountDao = DiscountDao(this as AppDatabase); late final StatisticsDao statisticsDao = StatisticsDao(this as AppDatabase); late final AchievementDao achievementDao = AchievementDao(this as AppDatabase); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [ users, userDatas, tokens, refreshTokens, telegramAuthCodes, cardPacks, gameCards, voiceModels, userPacks, previewCards, cardPackCards, cardVoices, subscriptionPlans, userSubscriptions, payments, tests, testQuestions, testPackRelations, testStatistics, tasks, userTasks, userTaskProgresses, userTaskResults, promoCodesCampaigns, promoCodes, discountCampaigns, discounts, discountUserDatas, studySessions, userAchievements, shareRequests ]; @override StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules( [ WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_datas', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('tokens', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('refresh_tokens', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('card_packs', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('game_cards', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('game_cards', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('voice_models', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_packs', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('card_packs', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_packs', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('card_packs', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('preview_cards', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('game_cards', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('preview_cards', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('card_packs', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('card_pack_cards', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('game_cards', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('card_pack_cards', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('game_cards', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('card_voices', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('voice_models', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('card_voices', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_subscriptions', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('payments', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('tests', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('test_questions', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('tests', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('test_pack_relations', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('card_packs', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('test_pack_relations', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('tests', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('test_statistics', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_task_progresses', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_task_results', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('promo_codes_campaigns', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('promo_codes', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('promo_codes', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('discount_campaigns', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('discounts', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('discounts', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('discount_user_datas', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('discount_user_datas', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('study_sessions', kind: UpdateKind.delete), ], ), WritePropagation( on: TableUpdateQuery.onTableName('users', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('user_achievements', kind: UpdateKind.delete), ], ), ], ); }