From f9615491b36f6ea7acaea8da1c003a914b094ddb Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Mon, 11 May 2026 07:01:46 +0200 Subject: [PATCH] refactor(media): migrate media item to freezed --- lib/database/app_database.g.dart | 3371 ++++++++++++----- lib/media/media_filter.g.dart | 37 +- lib/media/media_item.dart | 500 ++- lib/media/media_item.freezed.dart | 603 +++ lib/media/media_item.g.dart | 259 ++ lib/media/media_item/base.dart | 682 ---- lib/media/media_item/jellyfin.dart | 258 -- lib/media/media_item/json.dart | 200 - lib/media/media_item/plex.dart | 351 -- lib/media/media_part.dart | 16 + lib/media/media_part.g.dart | 27 + lib/media/media_role.dart | 12 + lib/media/media_role.g.dart | 21 + lib/media/media_version.dart | 28 + lib/media/media_version.g.dart | 32 + .../companion_remote/remote_session.g.dart | 84 +- lib/models/livetv_channel.g.dart | 42 +- lib/models/livetv_dvr.g.dart | 21 +- lib/models/livetv_lineup.g.dart | 30 +- lib/models/livetv_server_status.g.dart | 11 +- lib/models/livetv_session.g.dart | 33 +- lib/models/media_grab_operation.g.dart | 33 +- lib/models/media_grabber_device.g.dart | 45 +- lib/models/media_provider_info.g.dart | 35 +- lib/models/media_subscription.g.dart | 82 +- lib/models/plex/plex_home.g.dart | 6 +- lib/models/plex/plex_home_user.g.dart | 31 +- lib/models/plex/plex_match_result.g.dart | 42 +- .../plex/plex_subtitle_search_result.g.dart | 20 +- lib/models/plex/plex_user_profile.g.dart | 54 +- lib/providers/download_provider.dart | 5 +- .../watch_state_overlay_provider.dart | 13 +- lib/screens/media_detail_screen.dart | 59 +- .../jellyfin_sequential_launcher.dart | 4 +- lib/services/play_queue_launcher.dart | 2 +- lib/services/plex_mappers.g.dart | 336 +- .../trackers/anilist/anilist_session.g.dart | 26 +- lib/services/trackers/mal/mal_session.g.dart | 15 +- .../trackers/simkl/simkl_session.g.dart | 11 +- lib/services/trakt/trakt_session.g.dart | 17 +- .../services/recent_rooms_service.g.dart | 13 +- pubspec.lock | 16 + pubspec.yaml | 2 + test/media/media_item_test.dart | 134 + 44 files changed, 4753 insertions(+), 2866 deletions(-) create mode 100644 lib/media/media_item.freezed.dart create mode 100644 lib/media/media_item.g.dart delete mode 100644 lib/media/media_item/base.dart delete mode 100644 lib/media/media_item/jellyfin.dart delete mode 100644 lib/media/media_item/json.dart delete mode 100644 lib/media/media_item/plex.dart create mode 100644 lib/media/media_part.g.dart create mode 100644 lib/media/media_role.g.dart create mode 100644 lib/media/media_version.g.dart diff --git a/lib/database/app_database.g.dart b/lib/database/app_database.g.dart index 2ba7538a..28f57d4b 100644 --- a/lib/database/app_database.g.dart +++ b/lib/database/app_database.g.dart @@ -3,7 +3,8 @@ part of 'app_database.dart'; // ignore_for_file: type=lint -class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMediaTable, DownloadedMediaItem> { +class $DownloadedMediaTable extends DownloadedMedia + with TableInfo<$DownloadedMediaTable, DownloadedMediaItem> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -17,9 +18,13 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + static const VerificationMeta _serverIdMeta = const VerificationMeta( + 'serverId', ); - static const VerificationMeta _serverIdMeta = const VerificationMeta('serverId'); @override late final GeneratedColumn serverId = GeneratedColumn( 'server_id', @@ -28,7 +33,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _clientScopeIdMeta = const VerificationMeta('clientScopeId'); + static const VerificationMeta _clientScopeIdMeta = const VerificationMeta( + 'clientScopeId', + ); @override late final GeneratedColumn clientScopeId = GeneratedColumn( 'client_scope_id', @@ -37,7 +44,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _ratingKeyMeta = const VerificationMeta('ratingKey'); + static const VerificationMeta _ratingKeyMeta = const VerificationMeta( + 'ratingKey', + ); @override late final GeneratedColumn ratingKey = GeneratedColumn( 'rating_key', @@ -46,7 +55,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _globalKeyMeta = const VerificationMeta('globalKey'); + static const VerificationMeta _globalKeyMeta = const VerificationMeta( + 'globalKey', + ); @override late final GeneratedColumn globalKey = GeneratedColumn( 'global_key', @@ -65,7 +76,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _parentRatingKeyMeta = const VerificationMeta('parentRatingKey'); + static const VerificationMeta _parentRatingKeyMeta = const VerificationMeta( + 'parentRatingKey', + ); @override late final GeneratedColumn parentRatingKey = GeneratedColumn( 'parent_rating_key', @@ -74,15 +87,17 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _grandparentRatingKeyMeta = const VerificationMeta('grandparentRatingKey'); + static const VerificationMeta _grandparentRatingKeyMeta = + const VerificationMeta('grandparentRatingKey'); @override - late final GeneratedColumn grandparentRatingKey = GeneratedColumn( - 'grandparent_rating_key', - aliasedName, - true, - type: DriftSqlType.string, - requiredDuringInsert: false, - ); + late final GeneratedColumn grandparentRatingKey = + GeneratedColumn( + 'grandparent_rating_key', + aliasedName, + true, + type: DriftSqlType.string, + requiredDuringInsert: false, + ); static const VerificationMeta _statusMeta = const VerificationMeta('status'); @override late final GeneratedColumn status = GeneratedColumn( @@ -92,7 +107,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _progressMeta = const VerificationMeta('progress'); + static const VerificationMeta _progressMeta = const VerificationMeta( + 'progress', + ); @override late final GeneratedColumn progress = GeneratedColumn( 'progress', @@ -102,7 +119,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _totalBytesMeta = const VerificationMeta('totalBytes'); + static const VerificationMeta _totalBytesMeta = const VerificationMeta( + 'totalBytes', + ); @override late final GeneratedColumn totalBytes = GeneratedColumn( 'total_bytes', @@ -111,7 +130,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _downloadedBytesMeta = const VerificationMeta('downloadedBytes'); + static const VerificationMeta _downloadedBytesMeta = const VerificationMeta( + 'downloadedBytes', + ); @override late final GeneratedColumn downloadedBytes = GeneratedColumn( 'downloaded_bytes', @@ -121,7 +142,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _videoFilePathMeta = const VerificationMeta('videoFilePath'); + static const VerificationMeta _videoFilePathMeta = const VerificationMeta( + 'videoFilePath', + ); @override late final GeneratedColumn videoFilePath = GeneratedColumn( 'video_file_path', @@ -130,7 +153,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _thumbPathMeta = const VerificationMeta('thumbPath'); + static const VerificationMeta _thumbPathMeta = const VerificationMeta( + 'thumbPath', + ); @override late final GeneratedColumn thumbPath = GeneratedColumn( 'thumb_path', @@ -139,7 +164,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _downloadedAtMeta = const VerificationMeta('downloadedAt'); + static const VerificationMeta _downloadedAtMeta = const VerificationMeta( + 'downloadedAt', + ); @override late final GeneratedColumn downloadedAt = GeneratedColumn( 'downloaded_at', @@ -148,7 +175,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _errorMessageMeta = const VerificationMeta('errorMessage'); + static const VerificationMeta _errorMessageMeta = const VerificationMeta( + 'errorMessage', + ); @override late final GeneratedColumn errorMessage = GeneratedColumn( 'error_message', @@ -157,7 +186,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _retryCountMeta = const VerificationMeta('retryCount'); + static const VerificationMeta _retryCountMeta = const VerificationMeta( + 'retryCount', + ); @override late final GeneratedColumn retryCount = GeneratedColumn( 'retry_count', @@ -167,7 +198,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _bgTaskIdMeta = const VerificationMeta('bgTaskId'); + static const VerificationMeta _bgTaskIdMeta = const VerificationMeta( + 'bgTaskId', + ); @override late final GeneratedColumn bgTaskId = GeneratedColumn( 'bg_task_id', @@ -176,7 +209,9 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _mediaIndexMeta = const VerificationMeta('mediaIndex'); + static const VerificationMeta _mediaIndexMeta = const VerificationMeta( + 'mediaIndex', + ); @override late final GeneratedColumn mediaIndex = GeneratedColumn( 'media_index', @@ -214,90 +249,153 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe String get actualTableName => $name; static const String $name = 'downloaded_media'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + 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('server_id')) { - context.handle(_serverIdMeta, serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta)); + context.handle( + _serverIdMeta, + serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta), + ); } else if (isInserting) { context.missing(_serverIdMeta); } if (data.containsKey('client_scope_id')) { context.handle( _clientScopeIdMeta, - clientScopeId.isAcceptableOrUnknown(data['client_scope_id']!, _clientScopeIdMeta), + clientScopeId.isAcceptableOrUnknown( + data['client_scope_id']!, + _clientScopeIdMeta, + ), ); } if (data.containsKey('rating_key')) { - context.handle(_ratingKeyMeta, ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta)); + context.handle( + _ratingKeyMeta, + ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta), + ); } else if (isInserting) { context.missing(_ratingKeyMeta); } if (data.containsKey('global_key')) { - context.handle(_globalKeyMeta, globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta)); + context.handle( + _globalKeyMeta, + globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta), + ); } else if (isInserting) { context.missing(_globalKeyMeta); } if (data.containsKey('type')) { - context.handle(_typeMeta, type.isAcceptableOrUnknown(data['type']!, _typeMeta)); + context.handle( + _typeMeta, + type.isAcceptableOrUnknown(data['type']!, _typeMeta), + ); } else if (isInserting) { context.missing(_typeMeta); } if (data.containsKey('parent_rating_key')) { context.handle( _parentRatingKeyMeta, - parentRatingKey.isAcceptableOrUnknown(data['parent_rating_key']!, _parentRatingKeyMeta), + parentRatingKey.isAcceptableOrUnknown( + data['parent_rating_key']!, + _parentRatingKeyMeta, + ), ); } if (data.containsKey('grandparent_rating_key')) { context.handle( _grandparentRatingKeyMeta, - grandparentRatingKey.isAcceptableOrUnknown(data['grandparent_rating_key']!, _grandparentRatingKeyMeta), + grandparentRatingKey.isAcceptableOrUnknown( + data['grandparent_rating_key']!, + _grandparentRatingKeyMeta, + ), ); } if (data.containsKey('status')) { - context.handle(_statusMeta, status.isAcceptableOrUnknown(data['status']!, _statusMeta)); + context.handle( + _statusMeta, + status.isAcceptableOrUnknown(data['status']!, _statusMeta), + ); } else if (isInserting) { context.missing(_statusMeta); } if (data.containsKey('progress')) { - context.handle(_progressMeta, progress.isAcceptableOrUnknown(data['progress']!, _progressMeta)); + context.handle( + _progressMeta, + progress.isAcceptableOrUnknown(data['progress']!, _progressMeta), + ); } if (data.containsKey('total_bytes')) { - context.handle(_totalBytesMeta, totalBytes.isAcceptableOrUnknown(data['total_bytes']!, _totalBytesMeta)); + context.handle( + _totalBytesMeta, + totalBytes.isAcceptableOrUnknown(data['total_bytes']!, _totalBytesMeta), + ); } if (data.containsKey('downloaded_bytes')) { context.handle( _downloadedBytesMeta, - downloadedBytes.isAcceptableOrUnknown(data['downloaded_bytes']!, _downloadedBytesMeta), + downloadedBytes.isAcceptableOrUnknown( + data['downloaded_bytes']!, + _downloadedBytesMeta, + ), ); } if (data.containsKey('video_file_path')) { context.handle( _videoFilePathMeta, - videoFilePath.isAcceptableOrUnknown(data['video_file_path']!, _videoFilePathMeta), + videoFilePath.isAcceptableOrUnknown( + data['video_file_path']!, + _videoFilePathMeta, + ), ); } if (data.containsKey('thumb_path')) { - context.handle(_thumbPathMeta, thumbPath.isAcceptableOrUnknown(data['thumb_path']!, _thumbPathMeta)); + context.handle( + _thumbPathMeta, + thumbPath.isAcceptableOrUnknown(data['thumb_path']!, _thumbPathMeta), + ); } if (data.containsKey('downloaded_at')) { - context.handle(_downloadedAtMeta, downloadedAt.isAcceptableOrUnknown(data['downloaded_at']!, _downloadedAtMeta)); + context.handle( + _downloadedAtMeta, + downloadedAt.isAcceptableOrUnknown( + data['downloaded_at']!, + _downloadedAtMeta, + ), + ); } if (data.containsKey('error_message')) { - context.handle(_errorMessageMeta, errorMessage.isAcceptableOrUnknown(data['error_message']!, _errorMessageMeta)); + context.handle( + _errorMessageMeta, + errorMessage.isAcceptableOrUnknown( + data['error_message']!, + _errorMessageMeta, + ), + ); } if (data.containsKey('retry_count')) { - context.handle(_retryCountMeta, retryCount.isAcceptableOrUnknown(data['retry_count']!, _retryCountMeta)); + context.handle( + _retryCountMeta, + retryCount.isAcceptableOrUnknown(data['retry_count']!, _retryCountMeta), + ); } if (data.containsKey('bg_task_id')) { - context.handle(_bgTaskIdMeta, bgTaskId.isAcceptableOrUnknown(data['bg_task_id']!, _bgTaskIdMeta)); + context.handle( + _bgTaskIdMeta, + bgTaskId.isAcceptableOrUnknown(data['bg_task_id']!, _bgTaskIdMeta), + ); } if (data.containsKey('media_index')) { - context.handle(_mediaIndexMeta, mediaIndex.isAcceptableOrUnknown(data['media_index']!, _mediaIndexMeta)); + context.handle( + _mediaIndexMeta, + mediaIndex.isAcceptableOrUnknown(data['media_index']!, _mediaIndexMeta), + ); } return context; } @@ -308,12 +406,30 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe DownloadedMediaItem map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return DownloadedMediaItem( - id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!, - serverId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}server_id'])!, - clientScopeId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}client_scope_id']), - ratingKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}rating_key'])!, - globalKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}global_key'])!, - type: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}type'])!, + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + serverId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}server_id'], + )!, + clientScopeId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}client_scope_id'], + ), + ratingKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}rating_key'], + )!, + globalKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}global_key'], + )!, + type: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}type'], + )!, parentRatingKey: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}parent_rating_key'], @@ -322,17 +438,50 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe DriftSqlType.string, data['${effectivePrefix}grandparent_rating_key'], ), - status: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}status'])!, - progress: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}progress'])!, - totalBytes: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}total_bytes']), - downloadedBytes: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}downloaded_bytes'])!, - videoFilePath: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}video_file_path']), - thumbPath: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}thumb_path']), - downloadedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}downloaded_at']), - errorMessage: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}error_message']), - retryCount: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}retry_count'])!, - bgTaskId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}bg_task_id']), - mediaIndex: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}media_index'])!, + status: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}status'], + )!, + progress: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}progress'], + )!, + totalBytes: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}total_bytes'], + ), + downloadedBytes: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}downloaded_bytes'], + )!, + videoFilePath: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}video_file_path'], + ), + thumbPath: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}thumb_path'], + ), + downloadedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}downloaded_at'], + ), + errorMessage: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}error_message'], + ), + retryCount: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}retry_count'], + )!, + bgTaskId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}bg_task_id'], + ), + mediaIndex: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_index'], + )!, ); } @@ -342,7 +491,8 @@ class $DownloadedMediaTable extends DownloadedMedia with TableInfo<$DownloadedMe } } -class DownloadedMediaItem extends DataClass implements Insertable { +class DownloadedMediaItem extends DataClass + implements Insertable { final int id; final String serverId; final String? clientScopeId; @@ -430,29 +580,48 @@ class DownloadedMediaItem extends DataClass implements Insertable json, {ValueSerializer? serializer}) { + factory DownloadedMediaItem.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return DownloadedMediaItem( id: serializer.fromJson(json['id']), @@ -462,7 +631,9 @@ class DownloadedMediaItem extends DataClass implements Insertable(json['globalKey']), type: serializer.fromJson(json['type']), parentRatingKey: serializer.fromJson(json['parentRatingKey']), - grandparentRatingKey: serializer.fromJson(json['grandparentRatingKey']), + grandparentRatingKey: serializer.fromJson( + json['grandparentRatingKey'], + ), status: serializer.fromJson(json['status']), progress: serializer.fromJson(json['progress']), totalBytes: serializer.fromJson(json['totalBytes']), @@ -525,17 +696,25 @@ class DownloadedMediaItem extends DataClass implements Insertable DownloadedMediaItem( id: id ?? this.id, serverId: serverId ?? this.serverId, - clientScopeId: clientScopeId.present ? clientScopeId.value : this.clientScopeId, + clientScopeId: clientScopeId.present + ? clientScopeId.value + : this.clientScopeId, ratingKey: ratingKey ?? this.ratingKey, globalKey: globalKey ?? this.globalKey, type: type ?? this.type, - parentRatingKey: parentRatingKey.present ? parentRatingKey.value : this.parentRatingKey, - grandparentRatingKey: grandparentRatingKey.present ? grandparentRatingKey.value : this.grandparentRatingKey, + parentRatingKey: parentRatingKey.present + ? parentRatingKey.value + : this.parentRatingKey, + grandparentRatingKey: grandparentRatingKey.present + ? grandparentRatingKey.value + : this.grandparentRatingKey, status: status ?? this.status, progress: progress ?? this.progress, totalBytes: totalBytes.present ? totalBytes.value : this.totalBytes, downloadedBytes: downloadedBytes ?? this.downloadedBytes, - videoFilePath: videoFilePath.present ? videoFilePath.value : this.videoFilePath, + videoFilePath: videoFilePath.present + ? videoFilePath.value + : this.videoFilePath, thumbPath: thumbPath.present ? thumbPath.value : this.thumbPath, downloadedAt: downloadedAt.present ? downloadedAt.value : this.downloadedAt, errorMessage: errorMessage.present ? errorMessage.value : this.errorMessage, @@ -547,25 +726,43 @@ class DownloadedMediaItem extends DataClass implements Insertable { if (globalKey != null) 'global_key': globalKey, if (type != null) 'type': type, if (parentRatingKey != null) 'parent_rating_key': parentRatingKey, - if (grandparentRatingKey != null) 'grandparent_rating_key': grandparentRatingKey, + if (grandparentRatingKey != null) + 'grandparent_rating_key': grandparentRatingKey, if (status != null) 'status': status, if (progress != null) 'progress': progress, if (totalBytes != null) 'total_bytes': totalBytes, @@ -821,7 +1019,9 @@ class DownloadedMediaCompanion extends UpdateCompanion { map['parent_rating_key'] = Variable(parentRatingKey.value); } if (grandparentRatingKey.present) { - map['grandparent_rating_key'] = Variable(grandparentRatingKey.value); + map['grandparent_rating_key'] = Variable( + grandparentRatingKey.value, + ); } if (status.present) { map['status'] = Variable(status.value); @@ -886,12 +1086,15 @@ class DownloadedMediaCompanion extends UpdateCompanion { } } -class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwnersTable, DownloadOwnerItem> { +class $DownloadOwnersTable extends DownloadOwners + with TableInfo<$DownloadOwnersTable, DownloadOwnerItem> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $DownloadOwnersTable(this.attachedDatabase, [this._alias]); - static const VerificationMeta _profileIdMeta = const VerificationMeta('profileId'); + static const VerificationMeta _profileIdMeta = const VerificationMeta( + 'profileId', + ); @override late final GeneratedColumn profileId = GeneratedColumn( 'profile_id', @@ -900,7 +1103,9 @@ class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwners type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _globalKeyMeta = const VerificationMeta('globalKey'); + static const VerificationMeta _globalKeyMeta = const VerificationMeta( + 'globalKey', + ); @override late final GeneratedColumn globalKey = GeneratedColumn( 'global_key', @@ -909,7 +1114,9 @@ class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwners type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', @@ -926,21 +1133,33 @@ class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwners String get actualTableName => $name; static const String $name = 'download_owners'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('profile_id')) { - context.handle(_profileIdMeta, profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta)); + context.handle( + _profileIdMeta, + profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta), + ); } else if (isInserting) { context.missing(_profileIdMeta); } if (data.containsKey('global_key')) { - context.handle(_globalKeyMeta, globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta)); + context.handle( + _globalKeyMeta, + globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta), + ); } else if (isInserting) { context.missing(_globalKeyMeta); } if (data.containsKey('created_at')) { - context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); } else if (isInserting) { context.missing(_createdAtMeta); } @@ -953,9 +1172,18 @@ class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwners DownloadOwnerItem map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return DownloadOwnerItem( - profileId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}profile_id'])!, - globalKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}global_key'])!, - createdAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}created_at'])!, + profileId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}profile_id'], + )!, + globalKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}global_key'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}created_at'], + )!, ); } @@ -965,11 +1193,16 @@ class $DownloadOwnersTable extends DownloadOwners with TableInfo<$DownloadOwners } } -class DownloadOwnerItem extends DataClass implements Insertable { +class DownloadOwnerItem extends DataClass + implements Insertable { final String profileId; final String globalKey; final int createdAt; - const DownloadOwnerItem({required this.profileId, required this.globalKey, required this.createdAt}); + const DownloadOwnerItem({ + required this.profileId, + required this.globalKey, + required this.createdAt, + }); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -987,7 +1220,10 @@ class DownloadOwnerItem extends DataClass implements Insertable json, {ValueSerializer? serializer}) { + factory DownloadOwnerItem.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return DownloadOwnerItem( profileId: serializer.fromJson(json['profileId']), @@ -1005,7 +1241,11 @@ class DownloadOwnerItem extends DataClass implements Insertable DownloadOwnerItem( + DownloadOwnerItem copyWith({ + String? profileId, + String? globalKey, + int? createdAt, + }) => DownloadOwnerItem( profileId: profileId ?? this.profileId, globalKey: globalKey ?? this.globalKey, createdAt: createdAt ?? this.createdAt, @@ -1116,7 +1356,8 @@ class DownloadOwnersCompanion extends UpdateCompanion { } } -class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTable, DownloadQueueItem> { +class $DownloadQueueTable extends DownloadQueue + with TableInfo<$DownloadQueueTable, DownloadQueueItem> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -1130,9 +1371,13 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + static const VerificationMeta _mediaGlobalKeyMeta = const VerificationMeta( + 'mediaGlobalKey', ); - static const VerificationMeta _mediaGlobalKeyMeta = const VerificationMeta('mediaGlobalKey'); @override late final GeneratedColumn mediaGlobalKey = GeneratedColumn( 'media_global_key', @@ -1142,7 +1387,9 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'), ); - static const VerificationMeta _priorityMeta = const VerificationMeta('priority'); + static const VerificationMeta _priorityMeta = const VerificationMeta( + 'priority', + ); @override late final GeneratedColumn priority = GeneratedColumn( 'priority', @@ -1152,7 +1399,9 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _addedAtMeta = const VerificationMeta('addedAt'); + static const VerificationMeta _addedAtMeta = const VerificationMeta( + 'addedAt', + ); @override late final GeneratedColumn addedAt = GeneratedColumn( 'added_at', @@ -1161,7 +1410,9 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _downloadSubtitlesMeta = const VerificationMeta('downloadSubtitles'); + static const VerificationMeta _downloadSubtitlesMeta = const VerificationMeta( + 'downloadSubtitles', + ); @override late final GeneratedColumn downloadSubtitles = GeneratedColumn( 'download_subtitles', @@ -1169,10 +1420,14 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("download_subtitles" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("download_subtitles" IN (0, 1))', + ), defaultValue: const Constant(true), ); - static const VerificationMeta _downloadArtworkMeta = const VerificationMeta('downloadArtwork'); + static const VerificationMeta _downloadArtworkMeta = const VerificationMeta( + 'downloadArtwork', + ); @override late final GeneratedColumn downloadArtwork = GeneratedColumn( 'download_artwork', @@ -1180,18 +1435,30 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("download_artwork" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("download_artwork" IN (0, 1))', + ), defaultValue: const Constant(true), ); @override - List get $columns => [id, mediaGlobalKey, priority, addedAt, downloadSubtitles, downloadArtwork]; + List get $columns => [ + id, + mediaGlobalKey, + priority, + addedAt, + downloadSubtitles, + downloadArtwork, + ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'download_queue'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -1200,29 +1467,44 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab if (data.containsKey('media_global_key')) { context.handle( _mediaGlobalKeyMeta, - mediaGlobalKey.isAcceptableOrUnknown(data['media_global_key']!, _mediaGlobalKeyMeta), + mediaGlobalKey.isAcceptableOrUnknown( + data['media_global_key']!, + _mediaGlobalKeyMeta, + ), ); } else if (isInserting) { context.missing(_mediaGlobalKeyMeta); } if (data.containsKey('priority')) { - context.handle(_priorityMeta, priority.isAcceptableOrUnknown(data['priority']!, _priorityMeta)); + context.handle( + _priorityMeta, + priority.isAcceptableOrUnknown(data['priority']!, _priorityMeta), + ); } if (data.containsKey('added_at')) { - context.handle(_addedAtMeta, addedAt.isAcceptableOrUnknown(data['added_at']!, _addedAtMeta)); + context.handle( + _addedAtMeta, + addedAt.isAcceptableOrUnknown(data['added_at']!, _addedAtMeta), + ); } else if (isInserting) { context.missing(_addedAtMeta); } if (data.containsKey('download_subtitles')) { context.handle( _downloadSubtitlesMeta, - downloadSubtitles.isAcceptableOrUnknown(data['download_subtitles']!, _downloadSubtitlesMeta), + downloadSubtitles.isAcceptableOrUnknown( + data['download_subtitles']!, + _downloadSubtitlesMeta, + ), ); } if (data.containsKey('download_artwork')) { context.handle( _downloadArtworkMeta, - downloadArtwork.isAcceptableOrUnknown(data['download_artwork']!, _downloadArtworkMeta), + downloadArtwork.isAcceptableOrUnknown( + data['download_artwork']!, + _downloadArtworkMeta, + ), ); } return context; @@ -1234,13 +1516,22 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab DownloadQueueItem map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return DownloadQueueItem( - id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!, + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, mediaGlobalKey: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}media_global_key'], )!, - priority: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}priority'])!, - addedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}added_at'])!, + priority: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}priority'], + )!, + addedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}added_at'], + )!, downloadSubtitles: attachedDatabase.typeMapping.read( DriftSqlType.bool, data['${effectivePrefix}download_subtitles'], @@ -1258,7 +1549,8 @@ class $DownloadQueueTable extends DownloadQueue with TableInfo<$DownloadQueueTab } } -class DownloadQueueItem extends DataClass implements Insertable { +class DownloadQueueItem extends DataClass + implements Insertable { final int id; final String mediaGlobalKey; final int priority; @@ -1296,7 +1588,10 @@ class DownloadQueueItem extends DataClass implements Insertable json, {ValueSerializer? serializer}) { + factory DownloadQueueItem.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return DownloadQueueItem( id: serializer.fromJson(json['id']), @@ -1338,11 +1633,17 @@ class DownloadQueueItem extends DataClass implements Insertable Object.hash(id, mediaGlobalKey, priority, addedAt, downloadSubtitles, downloadArtwork); + int get hashCode => Object.hash( + id, + mediaGlobalKey, + priority, + addedAt, + downloadSubtitles, + downloadArtwork, + ); @override bool operator ==(Object other) => identical(this, other) || @@ -1471,12 +1779,15 @@ class DownloadQueueCompanion extends UpdateCompanion { } } -class $ApiCacheTable extends ApiCache with TableInfo<$ApiCacheTable, ApiCacheData> { +class $ApiCacheTable extends ApiCache + with TableInfo<$ApiCacheTable, ApiCacheData> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $ApiCacheTable(this.attachedDatabase, [this._alias]); - static const VerificationMeta _cacheKeyMeta = const VerificationMeta('cacheKey'); + static const VerificationMeta _cacheKeyMeta = const VerificationMeta( + 'cacheKey', + ); @override late final GeneratedColumn cacheKey = GeneratedColumn( 'cache_key', @@ -1502,10 +1813,14 @@ class $ApiCacheTable extends ApiCache with TableInfo<$ApiCacheTable, ApiCacheDat false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("pinned" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("pinned" IN (0, 1))', + ), defaultValue: const Constant(false), ); - static const VerificationMeta _cachedAtMeta = const VerificationMeta('cachedAt'); + static const VerificationMeta _cachedAtMeta = const VerificationMeta( + 'cachedAt', + ); @override late final GeneratedColumn cachedAt = GeneratedColumn( 'cached_at', @@ -1523,24 +1838,39 @@ class $ApiCacheTable extends ApiCache with TableInfo<$ApiCacheTable, ApiCacheDat String get actualTableName => $name; static const String $name = 'api_cache'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('cache_key')) { - context.handle(_cacheKeyMeta, cacheKey.isAcceptableOrUnknown(data['cache_key']!, _cacheKeyMeta)); + context.handle( + _cacheKeyMeta, + cacheKey.isAcceptableOrUnknown(data['cache_key']!, _cacheKeyMeta), + ); } else if (isInserting) { context.missing(_cacheKeyMeta); } if (data.containsKey('data')) { - context.handle(_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta)); + context.handle( + _dataMeta, + this.data.isAcceptableOrUnknown(data['data']!, _dataMeta), + ); } else if (isInserting) { context.missing(_dataMeta); } if (data.containsKey('pinned')) { - context.handle(_pinnedMeta, pinned.isAcceptableOrUnknown(data['pinned']!, _pinnedMeta)); + context.handle( + _pinnedMeta, + pinned.isAcceptableOrUnknown(data['pinned']!, _pinnedMeta), + ); } if (data.containsKey('cached_at')) { - context.handle(_cachedAtMeta, cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta)); + context.handle( + _cachedAtMeta, + cachedAt.isAcceptableOrUnknown(data['cached_at']!, _cachedAtMeta), + ); } return context; } @@ -1551,10 +1881,22 @@ class $ApiCacheTable extends ApiCache with TableInfo<$ApiCacheTable, ApiCacheDat ApiCacheData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ApiCacheData( - cacheKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}cache_key'])!, - data: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}data'])!, - pinned: attachedDatabase.typeMapping.read(DriftSqlType.bool, data['${effectivePrefix}pinned'])!, - cachedAt: attachedDatabase.typeMapping.read(DriftSqlType.dateTime, data['${effectivePrefix}cached_at'])!, + cacheKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}cache_key'], + )!, + data: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}data'], + )!, + pinned: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}pinned'], + )!, + cachedAt: attachedDatabase.typeMapping.read( + DriftSqlType.dateTime, + data['${effectivePrefix}cached_at'], + )!, ); } @@ -1568,8 +1910,6 @@ class ApiCacheData extends DataClass implements Insertable { /// Composite key: serverId:endpoint (e.g., "abc123:/library/metadata/12345" /// for Plex, "abc123:/Users/.../Items/..." for Jellyfin) final String cacheKey; - - /// JSON response data final String data; /// Whether this item is pinned for offline access @@ -1577,7 +1917,12 @@ class ApiCacheData extends DataClass implements Insertable { /// Timestamp for cache invalidation (optional future use) final DateTime cachedAt; - const ApiCacheData({required this.cacheKey, required this.data, required this.pinned, required this.cachedAt}); + const ApiCacheData({ + required this.cacheKey, + required this.data, + required this.pinned, + required this.cachedAt, + }); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -1597,7 +1942,10 @@ class ApiCacheData extends DataClass implements Insertable { ); } - factory ApiCacheData.fromJson(Map json, {ValueSerializer? serializer}) { + factory ApiCacheData.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return ApiCacheData( cacheKey: serializer.fromJson(json['cacheKey']), @@ -1617,7 +1965,12 @@ class ApiCacheData extends DataClass implements Insertable { }; } - ApiCacheData copyWith({String? cacheKey, String? data, bool? pinned, DateTime? cachedAt}) => ApiCacheData( + ApiCacheData copyWith({ + String? cacheKey, + String? data, + bool? pinned, + DateTime? cachedAt, + }) => ApiCacheData( cacheKey: cacheKey ?? this.cacheKey, data: data ?? this.data, pinned: pinned ?? this.pinned, @@ -1757,9 +2110,13 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + static const VerificationMeta _profileIdMeta = const VerificationMeta( + 'profileId', ); - static const VerificationMeta _profileIdMeta = const VerificationMeta('profileId'); @override late final GeneratedColumn profileId = GeneratedColumn( 'profile_id', @@ -1768,7 +2125,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _serverIdMeta = const VerificationMeta('serverId'); + static const VerificationMeta _serverIdMeta = const VerificationMeta( + 'serverId', + ); @override late final GeneratedColumn serverId = GeneratedColumn( 'server_id', @@ -1777,7 +2136,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _clientScopeIdMeta = const VerificationMeta('clientScopeId'); + static const VerificationMeta _clientScopeIdMeta = const VerificationMeta( + 'clientScopeId', + ); @override late final GeneratedColumn clientScopeId = GeneratedColumn( 'client_scope_id', @@ -1786,7 +2147,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _ratingKeyMeta = const VerificationMeta('ratingKey'); + static const VerificationMeta _ratingKeyMeta = const VerificationMeta( + 'ratingKey', + ); @override late final GeneratedColumn ratingKey = GeneratedColumn( 'rating_key', @@ -1795,7 +2158,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _globalKeyMeta = const VerificationMeta('globalKey'); + static const VerificationMeta _globalKeyMeta = const VerificationMeta( + 'globalKey', + ); @override late final GeneratedColumn globalKey = GeneratedColumn( 'global_key', @@ -1804,7 +2169,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _actionTypeMeta = const VerificationMeta('actionType'); + static const VerificationMeta _actionTypeMeta = const VerificationMeta( + 'actionType', + ); @override late final GeneratedColumn actionType = GeneratedColumn( 'action_type', @@ -1813,7 +2180,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _viewOffsetMeta = const VerificationMeta('viewOffset'); + static const VerificationMeta _viewOffsetMeta = const VerificationMeta( + 'viewOffset', + ); @override late final GeneratedColumn viewOffset = GeneratedColumn( 'view_offset', @@ -1822,7 +2191,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _durationMeta = const VerificationMeta('duration'); + static const VerificationMeta _durationMeta = const VerificationMeta( + 'duration', + ); @override late final GeneratedColumn duration = GeneratedColumn( 'duration', @@ -1831,7 +2202,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _shouldMarkWatchedMeta = const VerificationMeta('shouldMarkWatched'); + static const VerificationMeta _shouldMarkWatchedMeta = const VerificationMeta( + 'shouldMarkWatched', + ); @override late final GeneratedColumn shouldMarkWatched = GeneratedColumn( 'should_mark_watched', @@ -1839,10 +2212,14 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("should_mark_watched" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("should_mark_watched" IN (0, 1))', + ), defaultValue: const Constant(false), ); - static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', @@ -1851,7 +2228,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _updatedAtMeta = const VerificationMeta('updatedAt'); + static const VerificationMeta _updatedAtMeta = const VerificationMeta( + 'updatedAt', + ); @override late final GeneratedColumn updatedAt = GeneratedColumn( 'updated_at', @@ -1860,7 +2239,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _syncAttemptsMeta = const VerificationMeta('syncAttempts'); + static const VerificationMeta _syncAttemptsMeta = const VerificationMeta( + 'syncAttempts', + ); @override late final GeneratedColumn syncAttempts = GeneratedColumn( 'sync_attempts', @@ -1870,7 +2251,9 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _lastErrorMeta = const VerificationMeta('lastError'); + static const VerificationMeta _lastErrorMeta = const VerificationMeta( + 'lastError', + ); @override late final GeneratedColumn lastError = GeneratedColumn( 'last_error', @@ -1902,68 +2285,113 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress String get actualTableName => $name; static const String $name = 'offline_watch_progress'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + 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('profile_id')) { - context.handle(_profileIdMeta, profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta)); + context.handle( + _profileIdMeta, + profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta), + ); } if (data.containsKey('server_id')) { - context.handle(_serverIdMeta, serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta)); + context.handle( + _serverIdMeta, + serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta), + ); } else if (isInserting) { context.missing(_serverIdMeta); } if (data.containsKey('client_scope_id')) { context.handle( _clientScopeIdMeta, - clientScopeId.isAcceptableOrUnknown(data['client_scope_id']!, _clientScopeIdMeta), + clientScopeId.isAcceptableOrUnknown( + data['client_scope_id']!, + _clientScopeIdMeta, + ), ); } if (data.containsKey('rating_key')) { - context.handle(_ratingKeyMeta, ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta)); + context.handle( + _ratingKeyMeta, + ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta), + ); } else if (isInserting) { context.missing(_ratingKeyMeta); } if (data.containsKey('global_key')) { - context.handle(_globalKeyMeta, globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta)); + context.handle( + _globalKeyMeta, + globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta), + ); } else if (isInserting) { context.missing(_globalKeyMeta); } if (data.containsKey('action_type')) { - context.handle(_actionTypeMeta, actionType.isAcceptableOrUnknown(data['action_type']!, _actionTypeMeta)); + context.handle( + _actionTypeMeta, + actionType.isAcceptableOrUnknown(data['action_type']!, _actionTypeMeta), + ); } else if (isInserting) { context.missing(_actionTypeMeta); } if (data.containsKey('view_offset')) { - context.handle(_viewOffsetMeta, viewOffset.isAcceptableOrUnknown(data['view_offset']!, _viewOffsetMeta)); + context.handle( + _viewOffsetMeta, + viewOffset.isAcceptableOrUnknown(data['view_offset']!, _viewOffsetMeta), + ); } if (data.containsKey('duration')) { - context.handle(_durationMeta, duration.isAcceptableOrUnknown(data['duration']!, _durationMeta)); + context.handle( + _durationMeta, + duration.isAcceptableOrUnknown(data['duration']!, _durationMeta), + ); } if (data.containsKey('should_mark_watched')) { context.handle( _shouldMarkWatchedMeta, - shouldMarkWatched.isAcceptableOrUnknown(data['should_mark_watched']!, _shouldMarkWatchedMeta), + shouldMarkWatched.isAcceptableOrUnknown( + data['should_mark_watched']!, + _shouldMarkWatchedMeta, + ), ); } if (data.containsKey('created_at')) { - context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); } else if (isInserting) { context.missing(_createdAtMeta); } if (data.containsKey('updated_at')) { - context.handle(_updatedAtMeta, updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta)); + context.handle( + _updatedAtMeta, + updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta), + ); } else if (isInserting) { context.missing(_updatedAtMeta); } if (data.containsKey('sync_attempts')) { - context.handle(_syncAttemptsMeta, syncAttempts.isAcceptableOrUnknown(data['sync_attempts']!, _syncAttemptsMeta)); + context.handle( + _syncAttemptsMeta, + syncAttempts.isAcceptableOrUnknown( + data['sync_attempts']!, + _syncAttemptsMeta, + ), + ); } if (data.containsKey('last_error')) { - context.handle(_lastErrorMeta, lastError.isAcceptableOrUnknown(data['last_error']!, _lastErrorMeta)); + context.handle( + _lastErrorMeta, + lastError.isAcceptableOrUnknown(data['last_error']!, _lastErrorMeta), + ); } return context; } @@ -1971,26 +2399,68 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress @override Set get $primaryKey => {id}; @override - OfflineWatchProgressItem map(Map data, {String? tablePrefix}) { + OfflineWatchProgressItem map( + Map data, { + String? tablePrefix, + }) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return OfflineWatchProgressItem( - id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!, - profileId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}profile_id']), - serverId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}server_id'])!, - clientScopeId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}client_scope_id']), - ratingKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}rating_key'])!, - globalKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}global_key'])!, - actionType: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}action_type'])!, - viewOffset: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}view_offset']), - duration: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}duration']), + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + profileId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}profile_id'], + ), + serverId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}server_id'], + )!, + clientScopeId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}client_scope_id'], + ), + ratingKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}rating_key'], + )!, + globalKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}global_key'], + )!, + actionType: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}action_type'], + )!, + viewOffset: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}view_offset'], + ), + duration: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}duration'], + ), shouldMarkWatched: attachedDatabase.typeMapping.read( DriftSqlType.bool, data['${effectivePrefix}should_mark_watched'], )!, - createdAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}created_at'])!, - updatedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}updated_at'])!, - syncAttempts: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}sync_attempts'])!, - lastError: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}last_error']), + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}created_at'], + )!, + updatedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}updated_at'], + )!, + syncAttempts: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}sync_attempts'], + )!, + lastError: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}last_error'], + ), ); } @@ -2000,7 +2470,8 @@ class $OfflineWatchProgressTable extends OfflineWatchProgress } } -class OfflineWatchProgressItem extends DataClass implements Insertable { +class OfflineWatchProgressItem extends DataClass + implements Insertable { /// Auto-incrementing primary key final int id; @@ -2093,23 +2564,36 @@ class OfflineWatchProgressItem extends DataClass implements Insertable json, {ValueSerializer? serializer}) { + factory OfflineWatchProgressItem.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return OfflineWatchProgressItem( id: serializer.fromJson(json['id']), @@ -2168,7 +2652,9 @@ class OfflineWatchProgressItem extends DataClass implements Insertable { +class OfflineWatchProgressCompanion + extends UpdateCompanion { final Value id; final Value profileId; final Value serverId; @@ -2447,7 +2946,8 @@ class OfflineWatchProgressCompanion extends UpdateCompanion { +class $SyncRulesTable extends SyncRules + with TableInfo<$SyncRulesTable, SyncRuleItem> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -2461,9 +2961,13 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'PRIMARY KEY AUTOINCREMENT', + ), + ); + static const VerificationMeta _profileIdMeta = const VerificationMeta( + 'profileId', ); - static const VerificationMeta _profileIdMeta = const VerificationMeta('profileId'); @override late final GeneratedColumn profileId = GeneratedColumn( 'profile_id', @@ -2473,7 +2977,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule requiredDuringInsert: false, defaultValue: const Constant(''), ); - static const VerificationMeta _serverIdMeta = const VerificationMeta('serverId'); + static const VerificationMeta _serverIdMeta = const VerificationMeta( + 'serverId', + ); @override late final GeneratedColumn serverId = GeneratedColumn( 'server_id', @@ -2482,7 +2988,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _ratingKeyMeta = const VerificationMeta('ratingKey'); + static const VerificationMeta _ratingKeyMeta = const VerificationMeta( + 'ratingKey', + ); @override late final GeneratedColumn ratingKey = GeneratedColumn( 'rating_key', @@ -2491,7 +2999,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _globalKeyMeta = const VerificationMeta('globalKey'); + static const VerificationMeta _globalKeyMeta = const VerificationMeta( + 'globalKey', + ); @override late final GeneratedColumn globalKey = GeneratedColumn( 'global_key', @@ -2501,7 +3011,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'), ); - static const VerificationMeta _targetTypeMeta = const VerificationMeta('targetType'); + static const VerificationMeta _targetTypeMeta = const VerificationMeta( + 'targetType', + ); @override late final GeneratedColumn targetType = GeneratedColumn( 'target_type', @@ -2510,7 +3022,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _episodeCountMeta = const VerificationMeta('episodeCount'); + static const VerificationMeta _episodeCountMeta = const VerificationMeta( + 'episodeCount', + ); @override late final GeneratedColumn episodeCount = GeneratedColumn( 'episode_count', @@ -2519,7 +3033,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _enabledMeta = const VerificationMeta('enabled'); + static const VerificationMeta _enabledMeta = const VerificationMeta( + 'enabled', + ); @override late final GeneratedColumn enabled = GeneratedColumn( 'enabled', @@ -2527,10 +3043,14 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("enabled" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("enabled" IN (0, 1))', + ), defaultValue: const Constant(true), ); - static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', @@ -2539,7 +3059,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _lastExecutedAtMeta = const VerificationMeta('lastExecutedAt'); + static const VerificationMeta _lastExecutedAtMeta = const VerificationMeta( + 'lastExecutedAt', + ); @override late final GeneratedColumn lastExecutedAt = GeneratedColumn( 'last_executed_at', @@ -2548,7 +3070,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _mediaIndexMeta = const VerificationMeta('mediaIndex'); + static const VerificationMeta _mediaIndexMeta = const VerificationMeta( + 'mediaIndex', + ); @override late final GeneratedColumn mediaIndex = GeneratedColumn( 'media_index', @@ -2558,7 +3082,9 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _downloadFilterMeta = const VerificationMeta('downloadFilter'); + static const VerificationMeta _downloadFilterMeta = const VerificationMeta( + 'downloadFilter', + ); @override late final GeneratedColumn downloadFilter = GeneratedColumn( 'download_filter', @@ -2589,61 +3115,100 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule String get actualTableName => $name; static const String $name = 'sync_rules'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + 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('profile_id')) { - context.handle(_profileIdMeta, profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta)); + context.handle( + _profileIdMeta, + profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta), + ); } if (data.containsKey('server_id')) { - context.handle(_serverIdMeta, serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta)); + context.handle( + _serverIdMeta, + serverId.isAcceptableOrUnknown(data['server_id']!, _serverIdMeta), + ); } else if (isInserting) { context.missing(_serverIdMeta); } if (data.containsKey('rating_key')) { - context.handle(_ratingKeyMeta, ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta)); + context.handle( + _ratingKeyMeta, + ratingKey.isAcceptableOrUnknown(data['rating_key']!, _ratingKeyMeta), + ); } else if (isInserting) { context.missing(_ratingKeyMeta); } if (data.containsKey('global_key')) { - context.handle(_globalKeyMeta, globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta)); + context.handle( + _globalKeyMeta, + globalKey.isAcceptableOrUnknown(data['global_key']!, _globalKeyMeta), + ); } else if (isInserting) { context.missing(_globalKeyMeta); } if (data.containsKey('target_type')) { - context.handle(_targetTypeMeta, targetType.isAcceptableOrUnknown(data['target_type']!, _targetTypeMeta)); + context.handle( + _targetTypeMeta, + targetType.isAcceptableOrUnknown(data['target_type']!, _targetTypeMeta), + ); } else if (isInserting) { context.missing(_targetTypeMeta); } if (data.containsKey('episode_count')) { - context.handle(_episodeCountMeta, episodeCount.isAcceptableOrUnknown(data['episode_count']!, _episodeCountMeta)); + context.handle( + _episodeCountMeta, + episodeCount.isAcceptableOrUnknown( + data['episode_count']!, + _episodeCountMeta, + ), + ); } else if (isInserting) { context.missing(_episodeCountMeta); } if (data.containsKey('enabled')) { - context.handle(_enabledMeta, enabled.isAcceptableOrUnknown(data['enabled']!, _enabledMeta)); + context.handle( + _enabledMeta, + enabled.isAcceptableOrUnknown(data['enabled']!, _enabledMeta), + ); } if (data.containsKey('created_at')) { - context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); } else if (isInserting) { context.missing(_createdAtMeta); } if (data.containsKey('last_executed_at')) { context.handle( _lastExecutedAtMeta, - lastExecutedAt.isAcceptableOrUnknown(data['last_executed_at']!, _lastExecutedAtMeta), + lastExecutedAt.isAcceptableOrUnknown( + data['last_executed_at']!, + _lastExecutedAtMeta, + ), ); } if (data.containsKey('media_index')) { - context.handle(_mediaIndexMeta, mediaIndex.isAcceptableOrUnknown(data['media_index']!, _mediaIndexMeta)); + context.handle( + _mediaIndexMeta, + mediaIndex.isAcceptableOrUnknown(data['media_index']!, _mediaIndexMeta), + ); } if (data.containsKey('download_filter')) { context.handle( _downloadFilterMeta, - downloadFilter.isAcceptableOrUnknown(data['download_filter']!, _downloadFilterMeta), + downloadFilter.isAcceptableOrUnknown( + data['download_filter']!, + _downloadFilterMeta, + ), ); } return context; @@ -2655,17 +3220,50 @@ class $SyncRulesTable extends SyncRules with TableInfo<$SyncRulesTable, SyncRule SyncRuleItem map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return SyncRuleItem( - id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!, - profileId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}profile_id'])!, - serverId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}server_id'])!, - ratingKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}rating_key'])!, - globalKey: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}global_key'])!, - targetType: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}target_type'])!, - episodeCount: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}episode_count'])!, - enabled: attachedDatabase.typeMapping.read(DriftSqlType.bool, data['${effectivePrefix}enabled'])!, - createdAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}created_at'])!, - lastExecutedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}last_executed_at']), - mediaIndex: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}media_index'])!, + id: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}id'], + )!, + profileId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}profile_id'], + )!, + serverId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}server_id'], + )!, + ratingKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}rating_key'], + )!, + globalKey: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}global_key'], + )!, + targetType: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}target_type'], + )!, + episodeCount: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}episode_count'], + )!, + enabled: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}enabled'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}created_at'], + )!, + lastExecutedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}last_executed_at'], + ), + mediaIndex: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}media_index'], + )!, downloadFilter: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}download_filter'], @@ -2737,13 +3335,18 @@ class SyncRuleItem extends DataClass implements Insertable { episodeCount: Value(episodeCount), enabled: Value(enabled), createdAt: Value(createdAt), - lastExecutedAt: lastExecutedAt == null && nullToAbsent ? const Value.absent() : Value(lastExecutedAt), + lastExecutedAt: lastExecutedAt == null && nullToAbsent + ? const Value.absent() + : Value(lastExecutedAt), mediaIndex: Value(mediaIndex), downloadFilter: Value(downloadFilter), ); } - factory SyncRuleItem.fromJson(Map json, {ValueSerializer? serializer}) { + factory SyncRuleItem.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return SyncRuleItem( id: serializer.fromJson(json['id']), @@ -2802,7 +3405,9 @@ class SyncRuleItem extends DataClass implements Insertable { episodeCount: episodeCount ?? this.episodeCount, enabled: enabled ?? this.enabled, createdAt: createdAt ?? this.createdAt, - lastExecutedAt: lastExecutedAt.present ? lastExecutedAt.value : this.lastExecutedAt, + lastExecutedAt: lastExecutedAt.present + ? lastExecutedAt.value + : this.lastExecutedAt, mediaIndex: mediaIndex ?? this.mediaIndex, downloadFilter: downloadFilter ?? this.downloadFilter, ); @@ -2813,13 +3418,23 @@ class SyncRuleItem extends DataClass implements Insertable { serverId: data.serverId.present ? data.serverId.value : this.serverId, ratingKey: data.ratingKey.present ? data.ratingKey.value : this.ratingKey, globalKey: data.globalKey.present ? data.globalKey.value : this.globalKey, - targetType: data.targetType.present ? data.targetType.value : this.targetType, - episodeCount: data.episodeCount.present ? data.episodeCount.value : this.episodeCount, + targetType: data.targetType.present + ? data.targetType.value + : this.targetType, + episodeCount: data.episodeCount.present + ? data.episodeCount.value + : this.episodeCount, enabled: data.enabled.present ? data.enabled.value : this.enabled, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, - lastExecutedAt: data.lastExecutedAt.present ? data.lastExecutedAt.value : this.lastExecutedAt, - mediaIndex: data.mediaIndex.present ? data.mediaIndex.value : this.mediaIndex, - downloadFilter: data.downloadFilter.present ? data.downloadFilter.value : this.downloadFilter, + lastExecutedAt: data.lastExecutedAt.present + ? data.lastExecutedAt.value + : this.lastExecutedAt, + mediaIndex: data.mediaIndex.present + ? data.mediaIndex.value + : this.mediaIndex, + downloadFilter: data.downloadFilter.present + ? data.downloadFilter.value + : this.downloadFilter, ); } @@ -3043,7 +3658,8 @@ class SyncRulesCompanion extends UpdateCompanion { } } -class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, ConnectionRow> { +class $ConnectionsTable extends Connections + with TableInfo<$ConnectionsTable, ConnectionRow> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -3066,7 +3682,9 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _displayNameMeta = const VerificationMeta('displayName'); + static const VerificationMeta _displayNameMeta = const VerificationMeta( + 'displayName', + ); @override late final GeneratedColumn displayName = GeneratedColumn( 'display_name', @@ -3075,7 +3693,9 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _configJsonMeta = const VerificationMeta('configJson'); + static const VerificationMeta _configJsonMeta = const VerificationMeta( + 'configJson', + ); @override late final GeneratedColumn configJson = GeneratedColumn( 'config_json', @@ -3084,7 +3704,9 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _isDefaultMeta = const VerificationMeta('isDefault'); + static const VerificationMeta _isDefaultMeta = const VerificationMeta( + 'isDefault', + ); @override late final GeneratedColumn isDefault = GeneratedColumn( 'is_default', @@ -3092,10 +3714,14 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_default" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_default" IN (0, 1))', + ), defaultValue: const Constant(false), ); - static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', @@ -3104,7 +3730,8 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _lastAuthenticatedAtMeta = const VerificationMeta('lastAuthenticatedAt'); + static const VerificationMeta _lastAuthenticatedAtMeta = + const VerificationMeta('lastAuthenticatedAt'); @override late final GeneratedColumn lastAuthenticatedAt = GeneratedColumn( 'last_authenticated_at', @@ -3114,14 +3741,25 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co requiredDuringInsert: false, ); @override - List get $columns => [id, kind, displayName, configJson, isDefault, createdAt, lastAuthenticatedAt]; + List get $columns => [ + id, + kind, + displayName, + configJson, + isDefault, + createdAt, + lastAuthenticatedAt, + ]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'connections'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -3130,32 +3768,53 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co context.missing(_idMeta); } if (data.containsKey('kind')) { - context.handle(_kindMeta, kind.isAcceptableOrUnknown(data['kind']!, _kindMeta)); + context.handle( + _kindMeta, + kind.isAcceptableOrUnknown(data['kind']!, _kindMeta), + ); } else if (isInserting) { context.missing(_kindMeta); } if (data.containsKey('display_name')) { - context.handle(_displayNameMeta, displayName.isAcceptableOrUnknown(data['display_name']!, _displayNameMeta)); + context.handle( + _displayNameMeta, + displayName.isAcceptableOrUnknown( + data['display_name']!, + _displayNameMeta, + ), + ); } else if (isInserting) { context.missing(_displayNameMeta); } if (data.containsKey('config_json')) { - context.handle(_configJsonMeta, configJson.isAcceptableOrUnknown(data['config_json']!, _configJsonMeta)); + context.handle( + _configJsonMeta, + configJson.isAcceptableOrUnknown(data['config_json']!, _configJsonMeta), + ); } else if (isInserting) { context.missing(_configJsonMeta); } if (data.containsKey('is_default')) { - context.handle(_isDefaultMeta, isDefault.isAcceptableOrUnknown(data['is_default']!, _isDefaultMeta)); + context.handle( + _isDefaultMeta, + isDefault.isAcceptableOrUnknown(data['is_default']!, _isDefaultMeta), + ); } if (data.containsKey('created_at')) { - context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); } else if (isInserting) { context.missing(_createdAtMeta); } if (data.containsKey('last_authenticated_at')) { context.handle( _lastAuthenticatedAtMeta, - lastAuthenticatedAt.isAcceptableOrUnknown(data['last_authenticated_at']!, _lastAuthenticatedAtMeta), + lastAuthenticatedAt.isAcceptableOrUnknown( + data['last_authenticated_at']!, + _lastAuthenticatedAtMeta, + ), ); } return context; @@ -3167,12 +3826,30 @@ class $ConnectionsTable extends Connections with TableInfo<$ConnectionsTable, Co ConnectionRow map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ConnectionRow( - id: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}id'])!, - kind: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}kind'])!, - displayName: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}display_name'])!, - configJson: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}config_json'])!, - isDefault: attachedDatabase.typeMapping.read(DriftSqlType.bool, data['${effectivePrefix}is_default'])!, - createdAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}created_at'])!, + id: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}id'], + )!, + kind: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}kind'], + )!, + displayName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}display_name'], + )!, + configJson: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}config_json'], + )!, + isDefault: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_default'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}created_at'], + )!, lastAuthenticatedAt: attachedDatabase.typeMapping.read( DriftSqlType.int, data['${effectivePrefix}last_authenticated_at'], @@ -3248,7 +3925,10 @@ class ConnectionRow extends DataClass implements Insertable { ); } - factory ConnectionRow.fromJson(Map json, {ValueSerializer? serializer}) { + factory ConnectionRow.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return ConnectionRow( id: serializer.fromJson(json['id']), @@ -3257,7 +3937,9 @@ class ConnectionRow extends DataClass implements Insertable { configJson: serializer.fromJson(json['configJson']), isDefault: serializer.fromJson(json['isDefault']), createdAt: serializer.fromJson(json['createdAt']), - lastAuthenticatedAt: serializer.fromJson(json['lastAuthenticatedAt']), + lastAuthenticatedAt: serializer.fromJson( + json['lastAuthenticatedAt'], + ), ); } @override @@ -3289,17 +3971,25 @@ class ConnectionRow extends DataClass implements Insertable { configJson: configJson ?? this.configJson, isDefault: isDefault ?? this.isDefault, createdAt: createdAt ?? this.createdAt, - lastAuthenticatedAt: lastAuthenticatedAt.present ? lastAuthenticatedAt.value : this.lastAuthenticatedAt, + lastAuthenticatedAt: lastAuthenticatedAt.present + ? lastAuthenticatedAt.value + : this.lastAuthenticatedAt, ); ConnectionRow copyWithCompanion(ConnectionsCompanion data) { return ConnectionRow( id: data.id.present ? data.id.value : this.id, kind: data.kind.present ? data.kind.value : this.kind, - displayName: data.displayName.present ? data.displayName.value : this.displayName, - configJson: data.configJson.present ? data.configJson.value : this.configJson, + displayName: data.displayName.present + ? data.displayName.value + : this.displayName, + configJson: data.configJson.present + ? data.configJson.value + : this.configJson, isDefault: data.isDefault.present ? data.isDefault.value : this.isDefault, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, - lastAuthenticatedAt: data.lastAuthenticatedAt.present ? data.lastAuthenticatedAt.value : this.lastAuthenticatedAt, + lastAuthenticatedAt: data.lastAuthenticatedAt.present + ? data.lastAuthenticatedAt.value + : this.lastAuthenticatedAt, ); } @@ -3318,7 +4008,15 @@ class ConnectionRow extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, kind, displayName, configJson, isDefault, createdAt, lastAuthenticatedAt); + int get hashCode => Object.hash( + id, + kind, + displayName, + configJson, + isDefault, + createdAt, + lastAuthenticatedAt, + ); @override bool operator ==(Object other) => identical(this, other) || @@ -3382,7 +4080,8 @@ class ConnectionsCompanion extends UpdateCompanion { if (configJson != null) 'config_json': configJson, if (isDefault != null) 'is_default': isDefault, if (createdAt != null) 'created_at': createdAt, - if (lastAuthenticatedAt != null) 'last_authenticated_at': lastAuthenticatedAt, + if (lastAuthenticatedAt != null) + 'last_authenticated_at': lastAuthenticatedAt, if (rowid != null) 'rowid': rowid, }); } @@ -3455,7 +4154,8 @@ class ConnectionsCompanion extends UpdateCompanion { } } -class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> { +class $ProfilesTable extends Profiles + with TableInfo<$ProfilesTable, ProfileRow> { @override final GeneratedDatabase attachedDatabase; final String? _alias; @@ -3478,7 +4178,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _displayNameMeta = const VerificationMeta('displayName'); + static const VerificationMeta _displayNameMeta = const VerificationMeta( + 'displayName', + ); @override late final GeneratedColumn displayName = GeneratedColumn( 'display_name', @@ -3487,7 +4189,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _avatarThumbUrlMeta = const VerificationMeta('avatarThumbUrl'); + static const VerificationMeta _avatarThumbUrlMeta = const VerificationMeta( + 'avatarThumbUrl', + ); @override late final GeneratedColumn avatarThumbUrl = GeneratedColumn( 'avatar_thumb_url', @@ -3496,7 +4200,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> type: DriftSqlType.string, requiredDuringInsert: false, ); - static const VerificationMeta _configJsonMeta = const VerificationMeta('configJson'); + static const VerificationMeta _configJsonMeta = const VerificationMeta( + 'configJson', + ); @override late final GeneratedColumn configJson = GeneratedColumn( 'config_json', @@ -3505,7 +4211,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _sortOrderMeta = const VerificationMeta('sortOrder'); + static const VerificationMeta _sortOrderMeta = const VerificationMeta( + 'sortOrder', + ); @override late final GeneratedColumn sortOrder = GeneratedColumn( 'sort_order', @@ -3515,7 +4223,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> requiredDuringInsert: false, defaultValue: const Constant(0), ); - static const VerificationMeta _createdAtMeta = const VerificationMeta('createdAt'); + static const VerificationMeta _createdAtMeta = const VerificationMeta( + 'createdAt', + ); @override late final GeneratedColumn createdAt = GeneratedColumn( 'created_at', @@ -3524,7 +4234,9 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> type: DriftSqlType.int, requiredDuringInsert: true, ); - static const VerificationMeta _lastUsedAtMeta = const VerificationMeta('lastUsedAt'); + static const VerificationMeta _lastUsedAtMeta = const VerificationMeta( + 'lastUsedAt', + ); @override late final GeneratedColumn lastUsedAt = GeneratedColumn( 'last_used_at', @@ -3550,7 +4262,10 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> String get actualTableName => $name; static const String $name = 'profiles'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -3559,36 +4274,63 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> context.missing(_idMeta); } if (data.containsKey('kind')) { - context.handle(_kindMeta, kind.isAcceptableOrUnknown(data['kind']!, _kindMeta)); + context.handle( + _kindMeta, + kind.isAcceptableOrUnknown(data['kind']!, _kindMeta), + ); } else if (isInserting) { context.missing(_kindMeta); } if (data.containsKey('display_name')) { - context.handle(_displayNameMeta, displayName.isAcceptableOrUnknown(data['display_name']!, _displayNameMeta)); + context.handle( + _displayNameMeta, + displayName.isAcceptableOrUnknown( + data['display_name']!, + _displayNameMeta, + ), + ); } else if (isInserting) { context.missing(_displayNameMeta); } if (data.containsKey('avatar_thumb_url')) { context.handle( _avatarThumbUrlMeta, - avatarThumbUrl.isAcceptableOrUnknown(data['avatar_thumb_url']!, _avatarThumbUrlMeta), + avatarThumbUrl.isAcceptableOrUnknown( + data['avatar_thumb_url']!, + _avatarThumbUrlMeta, + ), ); } if (data.containsKey('config_json')) { - context.handle(_configJsonMeta, configJson.isAcceptableOrUnknown(data['config_json']!, _configJsonMeta)); + context.handle( + _configJsonMeta, + configJson.isAcceptableOrUnknown(data['config_json']!, _configJsonMeta), + ); } else if (isInserting) { context.missing(_configJsonMeta); } if (data.containsKey('sort_order')) { - context.handle(_sortOrderMeta, sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta)); + context.handle( + _sortOrderMeta, + sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta), + ); } if (data.containsKey('created_at')) { - context.handle(_createdAtMeta, createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta)); + context.handle( + _createdAtMeta, + createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta), + ); } else if (isInserting) { context.missing(_createdAtMeta); } if (data.containsKey('last_used_at')) { - context.handle(_lastUsedAtMeta, lastUsedAt.isAcceptableOrUnknown(data['last_used_at']!, _lastUsedAtMeta)); + context.handle( + _lastUsedAtMeta, + lastUsedAt.isAcceptableOrUnknown( + data['last_used_at']!, + _lastUsedAtMeta, + ), + ); } return context; } @@ -3599,17 +4341,38 @@ class $ProfilesTable extends Profiles with TableInfo<$ProfilesTable, ProfileRow> ProfileRow map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ProfileRow( - id: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}id'])!, - kind: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}kind'])!, - displayName: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}display_name'])!, + id: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}id'], + )!, + kind: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}kind'], + )!, + displayName: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}display_name'], + )!, avatarThumbUrl: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}avatar_thumb_url'], ), - configJson: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}config_json'])!, - sortOrder: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}sort_order'])!, - createdAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}created_at'])!, - lastUsedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}last_used_at']), + configJson: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}config_json'], + )!, + sortOrder: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}sort_order'], + )!, + createdAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}created_at'], + )!, + lastUsedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}last_used_at'], + ), ); } @@ -3671,15 +4434,22 @@ class ProfileRow extends DataClass implements Insertable { id: Value(id), kind: Value(kind), displayName: Value(displayName), - avatarThumbUrl: avatarThumbUrl == null && nullToAbsent ? const Value.absent() : Value(avatarThumbUrl), + avatarThumbUrl: avatarThumbUrl == null && nullToAbsent + ? const Value.absent() + : Value(avatarThumbUrl), configJson: Value(configJson), sortOrder: Value(sortOrder), createdAt: Value(createdAt), - lastUsedAt: lastUsedAt == null && nullToAbsent ? const Value.absent() : Value(lastUsedAt), + lastUsedAt: lastUsedAt == null && nullToAbsent + ? const Value.absent() + : Value(lastUsedAt), ); } - factory ProfileRow.fromJson(Map json, {ValueSerializer? serializer}) { + factory ProfileRow.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return ProfileRow( id: serializer.fromJson(json['id']), @@ -3720,7 +4490,9 @@ class ProfileRow extends DataClass implements Insertable { id: id ?? this.id, kind: kind ?? this.kind, displayName: displayName ?? this.displayName, - avatarThumbUrl: avatarThumbUrl.present ? avatarThumbUrl.value : this.avatarThumbUrl, + avatarThumbUrl: avatarThumbUrl.present + ? avatarThumbUrl.value + : this.avatarThumbUrl, configJson: configJson ?? this.configJson, sortOrder: sortOrder ?? this.sortOrder, createdAt: createdAt ?? this.createdAt, @@ -3730,12 +4502,20 @@ class ProfileRow extends DataClass implements Insertable { return ProfileRow( id: data.id.present ? data.id.value : this.id, kind: data.kind.present ? data.kind.value : this.kind, - displayName: data.displayName.present ? data.displayName.value : this.displayName, - avatarThumbUrl: data.avatarThumbUrl.present ? data.avatarThumbUrl.value : this.avatarThumbUrl, - configJson: data.configJson.present ? data.configJson.value : this.configJson, + displayName: data.displayName.present + ? data.displayName.value + : this.displayName, + avatarThumbUrl: data.avatarThumbUrl.present + ? data.avatarThumbUrl.value + : this.avatarThumbUrl, + configJson: data.configJson.present + ? data.configJson.value + : this.configJson, sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder, createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt, - lastUsedAt: data.lastUsedAt.present ? data.lastUsedAt.value : this.lastUsedAt, + lastUsedAt: data.lastUsedAt.present + ? data.lastUsedAt.value + : this.lastUsedAt, ); } @@ -3755,7 +4535,16 @@ class ProfileRow extends DataClass implements Insertable { } @override - int get hashCode => Object.hash(id, kind, displayName, avatarThumbUrl, configJson, sortOrder, createdAt, lastUsedAt); + int get hashCode => Object.hash( + id, + kind, + displayName, + avatarThumbUrl, + configJson, + sortOrder, + createdAt, + lastUsedAt, + ); @override bool operator ==(Object other) => identical(this, other) || @@ -3910,7 +4699,9 @@ class $ProfileConnectionsTable extends ProfileConnections final GeneratedDatabase attachedDatabase; final String? _alias; $ProfileConnectionsTable(this.attachedDatabase, [this._alias]); - static const VerificationMeta _profileIdMeta = const VerificationMeta('profileId'); + static const VerificationMeta _profileIdMeta = const VerificationMeta( + 'profileId', + ); @override late final GeneratedColumn profileId = GeneratedColumn( 'profile_id', @@ -3919,7 +4710,9 @@ class $ProfileConnectionsTable extends ProfileConnections type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _connectionIdMeta = const VerificationMeta('connectionId'); + static const VerificationMeta _connectionIdMeta = const VerificationMeta( + 'connectionId', + ); @override late final GeneratedColumn connectionId = GeneratedColumn( 'connection_id', @@ -3927,9 +4720,13 @@ class $ProfileConnectionsTable extends ProfileConnections false, type: DriftSqlType.string, requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways('REFERENCES connections (id) ON DELETE CASCADE'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES connections (id) ON DELETE CASCADE', + ), + ); + static const VerificationMeta _userTokenMeta = const VerificationMeta( + 'userToken', ); - static const VerificationMeta _userTokenMeta = const VerificationMeta('userToken'); @override late final GeneratedColumn userToken = GeneratedColumn( 'user_token', @@ -3939,7 +4736,9 @@ class $ProfileConnectionsTable extends ProfileConnections requiredDuringInsert: false, defaultValue: const Constant(''), ); - static const VerificationMeta _userIdentifierMeta = const VerificationMeta('userIdentifier'); + static const VerificationMeta _userIdentifierMeta = const VerificationMeta( + 'userIdentifier', + ); @override late final GeneratedColumn userIdentifier = GeneratedColumn( 'user_identifier', @@ -3948,7 +4747,9 @@ class $ProfileConnectionsTable extends ProfileConnections type: DriftSqlType.string, requiredDuringInsert: true, ); - static const VerificationMeta _isDefaultMeta = const VerificationMeta('isDefault'); + static const VerificationMeta _isDefaultMeta = const VerificationMeta( + 'isDefault', + ); @override late final GeneratedColumn isDefault = GeneratedColumn( 'is_default', @@ -3956,10 +4757,14 @@ class $ProfileConnectionsTable extends ProfileConnections false, type: DriftSqlType.bool, requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_default" IN (0, 1))'), + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("is_default" IN (0, 1))', + ), defaultValue: const Constant(false), ); - static const VerificationMeta _tokenAcquiredAtMeta = const VerificationMeta('tokenAcquiredAt'); + static const VerificationMeta _tokenAcquiredAtMeta = const VerificationMeta( + 'tokenAcquiredAt', + ); @override late final GeneratedColumn tokenAcquiredAt = GeneratedColumn( 'token_acquired_at', @@ -3968,7 +4773,9 @@ class $ProfileConnectionsTable extends ProfileConnections type: DriftSqlType.int, requiredDuringInsert: false, ); - static const VerificationMeta _lastUsedAtMeta = const VerificationMeta('lastUsedAt'); + static const VerificationMeta _lastUsedAtMeta = const VerificationMeta( + 'lastUsedAt', + ); @override late final GeneratedColumn lastUsedAt = GeneratedColumn( 'last_used_at', @@ -3993,41 +4800,71 @@ class $ProfileConnectionsTable extends ProfileConnections String get actualTableName => $name; static const String $name = 'profile_connections'; @override - VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { + VerificationContext validateIntegrity( + Insertable instance, { + bool isInserting = false, + }) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('profile_id')) { - context.handle(_profileIdMeta, profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta)); + context.handle( + _profileIdMeta, + profileId.isAcceptableOrUnknown(data['profile_id']!, _profileIdMeta), + ); } else if (isInserting) { context.missing(_profileIdMeta); } if (data.containsKey('connection_id')) { - context.handle(_connectionIdMeta, connectionId.isAcceptableOrUnknown(data['connection_id']!, _connectionIdMeta)); + context.handle( + _connectionIdMeta, + connectionId.isAcceptableOrUnknown( + data['connection_id']!, + _connectionIdMeta, + ), + ); } else if (isInserting) { context.missing(_connectionIdMeta); } if (data.containsKey('user_token')) { - context.handle(_userTokenMeta, userToken.isAcceptableOrUnknown(data['user_token']!, _userTokenMeta)); + context.handle( + _userTokenMeta, + userToken.isAcceptableOrUnknown(data['user_token']!, _userTokenMeta), + ); } if (data.containsKey('user_identifier')) { context.handle( _userIdentifierMeta, - userIdentifier.isAcceptableOrUnknown(data['user_identifier']!, _userIdentifierMeta), + userIdentifier.isAcceptableOrUnknown( + data['user_identifier']!, + _userIdentifierMeta, + ), ); } else if (isInserting) { context.missing(_userIdentifierMeta); } if (data.containsKey('is_default')) { - context.handle(_isDefaultMeta, isDefault.isAcceptableOrUnknown(data['is_default']!, _isDefaultMeta)); + context.handle( + _isDefaultMeta, + isDefault.isAcceptableOrUnknown(data['is_default']!, _isDefaultMeta), + ); } if (data.containsKey('token_acquired_at')) { context.handle( _tokenAcquiredAtMeta, - tokenAcquiredAt.isAcceptableOrUnknown(data['token_acquired_at']!, _tokenAcquiredAtMeta), + tokenAcquiredAt.isAcceptableOrUnknown( + data['token_acquired_at']!, + _tokenAcquiredAtMeta, + ), ); } if (data.containsKey('last_used_at')) { - context.handle(_lastUsedAtMeta, lastUsedAt.isAcceptableOrUnknown(data['last_used_at']!, _lastUsedAtMeta)); + context.handle( + _lastUsedAtMeta, + lastUsedAt.isAcceptableOrUnknown( + data['last_used_at']!, + _lastUsedAtMeta, + ), + ); } return context; } @@ -4038,16 +4875,34 @@ class $ProfileConnectionsTable extends ProfileConnections ProfileConnectionRow map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ProfileConnectionRow( - profileId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}profile_id'])!, - connectionId: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}connection_id'])!, - userToken: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}user_token'])!, + profileId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}profile_id'], + )!, + connectionId: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}connection_id'], + )!, + userToken: attachedDatabase.typeMapping.read( + DriftSqlType.string, + data['${effectivePrefix}user_token'], + )!, userIdentifier: attachedDatabase.typeMapping.read( DriftSqlType.string, data['${effectivePrefix}user_identifier'], )!, - isDefault: attachedDatabase.typeMapping.read(DriftSqlType.bool, data['${effectivePrefix}is_default'])!, - tokenAcquiredAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}token_acquired_at']), - lastUsedAt: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}last_used_at']), + isDefault: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}is_default'], + )!, + tokenAcquiredAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}token_acquired_at'], + ), + lastUsedAt: attachedDatabase.typeMapping.read( + DriftSqlType.int, + data['${effectivePrefix}last_used_at'], + ), ); } @@ -4057,7 +4912,8 @@ class $ProfileConnectionsTable extends ProfileConnections } } -class ProfileConnectionRow extends DataClass implements Insertable { +class ProfileConnectionRow extends DataClass + implements Insertable { final String profileId; final String connectionId; final String userToken; @@ -4098,12 +4954,19 @@ class ProfileConnectionRow extends DataClass implements Insertable json, {ValueSerializer? serializer}) { + factory ProfileConnectionRow.fromJson( + Map json, { + ValueSerializer? serializer, + }) { serializer ??= driftRuntimeOptions.defaultSerializer; return ProfileConnectionRow( profileId: serializer.fromJson(json['profileId']), @@ -4143,18 +5006,28 @@ class ProfileConnectionRow extends DataClass implements Insertable - Object.hash(profileId, connectionId, userToken, userIdentifier, isDefault, tokenAcquiredAt, lastUsedAt); + int get hashCode => Object.hash( + profileId, + connectionId, + userToken, + userIdentifier, + isDefault, + tokenAcquiredAt, + lastUsedAt, + ); @override bool operator ==(Object other) => identical(this, other) || @@ -4188,7 +5068,8 @@ class ProfileConnectionRow extends DataClass implements Insertable { +class ProfileConnectionsCompanion + extends UpdateCompanion { final Value profileId; final Value connectionId; final Value userToken; @@ -4312,15 +5193,19 @@ class ProfileConnectionsCompanion extends UpdateCompanion abstract class _$AppDatabase extends GeneratedDatabase { _$AppDatabase(QueryExecutor e) : super(e); $AppDatabaseManager get managers => $AppDatabaseManager(this); - late final $DownloadedMediaTable downloadedMedia = $DownloadedMediaTable(this); + late final $DownloadedMediaTable downloadedMedia = $DownloadedMediaTable( + this, + ); late final $DownloadOwnersTable downloadOwners = $DownloadOwnersTable(this); late final $DownloadQueueTable downloadQueue = $DownloadQueueTable(this); late final $ApiCacheTable apiCache = $ApiCacheTable(this); - late final $OfflineWatchProgressTable offlineWatchProgress = $OfflineWatchProgressTable(this); + late final $OfflineWatchProgressTable offlineWatchProgress = + $OfflineWatchProgressTable(this); late final $SyncRulesTable syncRules = $SyncRulesTable(this); late final $ConnectionsTable connections = $ConnectionsTable(this); late final $ProfilesTable profiles = $ProfilesTable(this); - late final $ProfileConnectionsTable profileConnections = $ProfileConnectionsTable(this); + late final $ProfileConnectionsTable profileConnections = + $ProfileConnectionsTable(this); late final Index idxDownloadedMediaStatus = Index( 'idx_downloaded_media_status', 'CREATE INDEX idx_downloaded_media_status ON downloaded_media (status)', @@ -4361,7 +5246,10 @@ abstract class _$AppDatabase extends GeneratedDatabase { 'idx_connections_kind', 'CREATE INDEX idx_connections_kind ON connections (kind)', ); - late final Index idxProfilesKind = Index('idx_profiles_kind', 'CREATE INDEX idx_profiles_kind ON profiles (kind)'); + late final Index idxProfilesKind = Index( + 'idx_profiles_kind', + 'CREATE INDEX idx_profiles_kind ON profiles (kind)', + ); late final Index idxProfileConnectionsConnectionId = Index( 'idx_profile_connections_connection_id', 'CREATE INDEX idx_profile_connections_connection_id ON profile_connections (connection_id)', @@ -4371,7 +5259,8 @@ abstract class _$AppDatabase extends GeneratedDatabase { 'CREATE INDEX idx_profile_connections_profile_id ON profile_connections (profile_id)', ); @override - Iterable> get allTables => allSchemaEntities.whereType>(); + Iterable> get allTables => + allSchemaEntities.whereType>(); @override List get allSchemaEntities => [ downloadedMedia, @@ -4400,7 +5289,10 @@ abstract class _$AppDatabase extends GeneratedDatabase { @override StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules([ WritePropagation( - on: TableUpdateQuery.onTableName('connections', limitUpdateKind: UpdateKind.delete), + on: TableUpdateQuery.onTableName( + 'connections', + limitUpdateKind: UpdateKind.delete, + ), result: [TableUpdate('profile_connections', kind: UpdateKind.delete)], ), ]); @@ -4451,7 +5343,8 @@ typedef $$DownloadedMediaTableUpdateCompanionBuilder = Value mediaIndex, }); -class $$DownloadedMediaTableFilterComposer extends Composer<_$AppDatabase, $DownloadedMediaTable> { +class $$DownloadedMediaTableFilterComposer + extends Composer<_$AppDatabase, $DownloadedMediaTable> { $$DownloadedMediaTableFilterComposer({ required super.$db, required super.$table, @@ -4459,63 +5352,104 @@ class $$DownloadedMediaTableFilterComposer extends Composer<_$AppDatabase, $Down super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnFilters(column)); + ColumnFilters get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => ColumnFilters(column)); + ColumnFilters get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get type => $composableBuilder(column: $table.type, builder: (column) => ColumnFilters(column)); + ColumnFilters get type => $composableBuilder( + column: $table.type, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get parentRatingKey => - $composableBuilder(column: $table.parentRatingKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get parentRatingKey => $composableBuilder( + column: $table.parentRatingKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get grandparentRatingKey => - $composableBuilder(column: $table.grandparentRatingKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get grandparentRatingKey => $composableBuilder( + column: $table.grandparentRatingKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get status => - $composableBuilder(column: $table.status, builder: (column) => ColumnFilters(column)); + ColumnFilters get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get progress => - $composableBuilder(column: $table.progress, builder: (column) => ColumnFilters(column)); + ColumnFilters get progress => $composableBuilder( + column: $table.progress, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get totalBytes => - $composableBuilder(column: $table.totalBytes, builder: (column) => ColumnFilters(column)); + ColumnFilters get totalBytes => $composableBuilder( + column: $table.totalBytes, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get downloadedBytes => - $composableBuilder(column: $table.downloadedBytes, builder: (column) => ColumnFilters(column)); + ColumnFilters get downloadedBytes => $composableBuilder( + column: $table.downloadedBytes, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get videoFilePath => - $composableBuilder(column: $table.videoFilePath, builder: (column) => ColumnFilters(column)); + ColumnFilters get videoFilePath => $composableBuilder( + column: $table.videoFilePath, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get thumbPath => - $composableBuilder(column: $table.thumbPath, builder: (column) => ColumnFilters(column)); + ColumnFilters get thumbPath => $composableBuilder( + column: $table.thumbPath, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get downloadedAt => - $composableBuilder(column: $table.downloadedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get downloadedAt => $composableBuilder( + column: $table.downloadedAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get errorMessage => - $composableBuilder(column: $table.errorMessage, builder: (column) => ColumnFilters(column)); + ColumnFilters get errorMessage => $composableBuilder( + column: $table.errorMessage, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get retryCount => - $composableBuilder(column: $table.retryCount, builder: (column) => ColumnFilters(column)); + ColumnFilters get retryCount => $composableBuilder( + column: $table.retryCount, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get bgTaskId => - $composableBuilder(column: $table.bgTaskId, builder: (column) => ColumnFilters(column)); + ColumnFilters get bgTaskId => $composableBuilder( + column: $table.bgTaskId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get mediaIndex => - $composableBuilder(column: $table.mediaIndex, builder: (column) => ColumnFilters(column)); + ColumnFilters get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => ColumnFilters(column), + ); } -class $$DownloadedMediaTableOrderingComposer extends Composer<_$AppDatabase, $DownloadedMediaTable> { +class $$DownloadedMediaTableOrderingComposer + extends Composer<_$AppDatabase, $DownloadedMediaTable> { $$DownloadedMediaTableOrderingComposer({ required super.$db, required super.$table, @@ -4523,64 +5457,104 @@ class $$DownloadedMediaTableOrderingComposer extends Composer<_$AppDatabase, $Do super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get type => - $composableBuilder(column: $table.type, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get type => $composableBuilder( + column: $table.type, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get parentRatingKey => - $composableBuilder(column: $table.parentRatingKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get parentRatingKey => $composableBuilder( + column: $table.parentRatingKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get grandparentRatingKey => - $composableBuilder(column: $table.grandparentRatingKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get grandparentRatingKey => $composableBuilder( + column: $table.grandparentRatingKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get status => - $composableBuilder(column: $table.status, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get status => $composableBuilder( + column: $table.status, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get progress => - $composableBuilder(column: $table.progress, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get progress => $composableBuilder( + column: $table.progress, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get totalBytes => - $composableBuilder(column: $table.totalBytes, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get totalBytes => $composableBuilder( + column: $table.totalBytes, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get downloadedBytes => - $composableBuilder(column: $table.downloadedBytes, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get downloadedBytes => $composableBuilder( + column: $table.downloadedBytes, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get videoFilePath => - $composableBuilder(column: $table.videoFilePath, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get videoFilePath => $composableBuilder( + column: $table.videoFilePath, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get thumbPath => - $composableBuilder(column: $table.thumbPath, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get thumbPath => $composableBuilder( + column: $table.thumbPath, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get downloadedAt => - $composableBuilder(column: $table.downloadedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get downloadedAt => $composableBuilder( + column: $table.downloadedAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get errorMessage => - $composableBuilder(column: $table.errorMessage, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get errorMessage => $composableBuilder( + column: $table.errorMessage, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get retryCount => - $composableBuilder(column: $table.retryCount, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get retryCount => $composableBuilder( + column: $table.retryCount, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get bgTaskId => - $composableBuilder(column: $table.bgTaskId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get bgTaskId => $composableBuilder( + column: $table.bgTaskId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get mediaIndex => - $composableBuilder(column: $table.mediaIndex, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => ColumnOrderings(column), + ); } -class $$DownloadedMediaTableAnnotationComposer extends Composer<_$AppDatabase, $DownloadedMediaTable> { +class $$DownloadedMediaTableAnnotationComposer + extends Composer<_$AppDatabase, $DownloadedMediaTable> { $$DownloadedMediaTableAnnotationComposer({ required super.$db, required super.$table, @@ -4588,49 +5562,82 @@ class $$DownloadedMediaTableAnnotationComposer extends Composer<_$AppDatabase, $ super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get serverId => $composableBuilder(column: $table.serverId, builder: (column) => column); + GeneratedColumn get serverId => + $composableBuilder(column: $table.serverId, builder: (column) => column); - GeneratedColumn get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => column); + GeneratedColumn get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => column, + ); - GeneratedColumn get ratingKey => $composableBuilder(column: $table.ratingKey, builder: (column) => column); + GeneratedColumn get ratingKey => + $composableBuilder(column: $table.ratingKey, builder: (column) => column); - GeneratedColumn get globalKey => $composableBuilder(column: $table.globalKey, builder: (column) => column); + GeneratedColumn get globalKey => + $composableBuilder(column: $table.globalKey, builder: (column) => column); - GeneratedColumn get type => $composableBuilder(column: $table.type, builder: (column) => column); + GeneratedColumn get type => + $composableBuilder(column: $table.type, builder: (column) => column); - GeneratedColumn get parentRatingKey => - $composableBuilder(column: $table.parentRatingKey, builder: (column) => column); + GeneratedColumn get parentRatingKey => $composableBuilder( + column: $table.parentRatingKey, + builder: (column) => column, + ); - GeneratedColumn get grandparentRatingKey => - $composableBuilder(column: $table.grandparentRatingKey, builder: (column) => column); + GeneratedColumn get grandparentRatingKey => $composableBuilder( + column: $table.grandparentRatingKey, + builder: (column) => column, + ); - GeneratedColumn get status => $composableBuilder(column: $table.status, builder: (column) => column); + GeneratedColumn get status => + $composableBuilder(column: $table.status, builder: (column) => column); - GeneratedColumn get progress => $composableBuilder(column: $table.progress, builder: (column) => column); + GeneratedColumn get progress => + $composableBuilder(column: $table.progress, builder: (column) => column); - GeneratedColumn get totalBytes => $composableBuilder(column: $table.totalBytes, builder: (column) => column); + GeneratedColumn get totalBytes => $composableBuilder( + column: $table.totalBytes, + builder: (column) => column, + ); - GeneratedColumn get downloadedBytes => - $composableBuilder(column: $table.downloadedBytes, builder: (column) => column); + GeneratedColumn get downloadedBytes => $composableBuilder( + column: $table.downloadedBytes, + builder: (column) => column, + ); - GeneratedColumn get videoFilePath => - $composableBuilder(column: $table.videoFilePath, builder: (column) => column); + GeneratedColumn get videoFilePath => $composableBuilder( + column: $table.videoFilePath, + builder: (column) => column, + ); - GeneratedColumn get thumbPath => $composableBuilder(column: $table.thumbPath, builder: (column) => column); + GeneratedColumn get thumbPath => + $composableBuilder(column: $table.thumbPath, builder: (column) => column); - GeneratedColumn get downloadedAt => $composableBuilder(column: $table.downloadedAt, builder: (column) => column); + GeneratedColumn get downloadedAt => $composableBuilder( + column: $table.downloadedAt, + builder: (column) => column, + ); - GeneratedColumn get errorMessage => - $composableBuilder(column: $table.errorMessage, builder: (column) => column); + GeneratedColumn get errorMessage => $composableBuilder( + column: $table.errorMessage, + builder: (column) => column, + ); - GeneratedColumn get retryCount => $composableBuilder(column: $table.retryCount, builder: (column) => column); + GeneratedColumn get retryCount => $composableBuilder( + column: $table.retryCount, + builder: (column) => column, + ); - GeneratedColumn get bgTaskId => $composableBuilder(column: $table.bgTaskId, builder: (column) => column); + GeneratedColumn get bgTaskId => + $composableBuilder(column: $table.bgTaskId, builder: (column) => column); - GeneratedColumn get mediaIndex => $composableBuilder(column: $table.mediaIndex, builder: (column) => column); + GeneratedColumn get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => column, + ); } class $$DownloadedMediaTableTableManager @@ -4644,18 +5651,30 @@ class $$DownloadedMediaTableTableManager $$DownloadedMediaTableAnnotationComposer, $$DownloadedMediaTableCreateCompanionBuilder, $$DownloadedMediaTableUpdateCompanionBuilder, - (DownloadedMediaItem, BaseReferences<_$AppDatabase, $DownloadedMediaTable, DownloadedMediaItem>), + ( + DownloadedMediaItem, + BaseReferences< + _$AppDatabase, + $DownloadedMediaTable, + DownloadedMediaItem + >, + ), DownloadedMediaItem, PrefetchHooks Function() > { - $$DownloadedMediaTableTableManager(_$AppDatabase db, $DownloadedMediaTable table) - : super( + $$DownloadedMediaTableTableManager( + _$AppDatabase db, + $DownloadedMediaTable table, + ) : super( TableManagerState( db: db, table: table, - createFilteringComposer: () => $$DownloadedMediaTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$DownloadedMediaTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$DownloadedMediaTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$DownloadedMediaTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$DownloadedMediaTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$DownloadedMediaTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -4740,7 +5759,9 @@ class $$DownloadedMediaTableTableManager bgTaskId: bgTaskId, mediaIndex: mediaIndex, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -4756,7 +5777,14 @@ typedef $$DownloadedMediaTableProcessedTableManager = $$DownloadedMediaTableAnnotationComposer, $$DownloadedMediaTableCreateCompanionBuilder, $$DownloadedMediaTableUpdateCompanionBuilder, - (DownloadedMediaItem, BaseReferences<_$AppDatabase, $DownloadedMediaTable, DownloadedMediaItem>), + ( + DownloadedMediaItem, + BaseReferences< + _$AppDatabase, + $DownloadedMediaTable, + DownloadedMediaItem + >, + ), DownloadedMediaItem, PrefetchHooks Function() >; @@ -4775,7 +5803,8 @@ typedef $$DownloadOwnersTableUpdateCompanionBuilder = Value rowid, }); -class $$DownloadOwnersTableFilterComposer extends Composer<_$AppDatabase, $DownloadOwnersTable> { +class $$DownloadOwnersTableFilterComposer + extends Composer<_$AppDatabase, $DownloadOwnersTable> { $$DownloadOwnersTableFilterComposer({ required super.$db, required super.$table, @@ -4783,17 +5812,24 @@ class $$DownloadOwnersTableFilterComposer extends Composer<_$AppDatabase, $Downl super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnFilters(column)); + ColumnFilters get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); } -class $$DownloadOwnersTableOrderingComposer extends Composer<_$AppDatabase, $DownloadOwnersTable> { +class $$DownloadOwnersTableOrderingComposer + extends Composer<_$AppDatabase, $DownloadOwnersTable> { $$DownloadOwnersTableOrderingComposer({ required super.$db, required super.$table, @@ -4801,17 +5837,24 @@ class $$DownloadOwnersTableOrderingComposer extends Composer<_$AppDatabase, $Dow super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); } -class $$DownloadOwnersTableAnnotationComposer extends Composer<_$AppDatabase, $DownloadOwnersTable> { +class $$DownloadOwnersTableAnnotationComposer + extends Composer<_$AppDatabase, $DownloadOwnersTable> { $$DownloadOwnersTableAnnotationComposer({ required super.$db, required super.$table, @@ -4819,11 +5862,14 @@ class $$DownloadOwnersTableAnnotationComposer extends Composer<_$AppDatabase, $D super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get profileId => $composableBuilder(column: $table.profileId, builder: (column) => column); + GeneratedColumn get profileId => + $composableBuilder(column: $table.profileId, builder: (column) => column); - GeneratedColumn get globalKey => $composableBuilder(column: $table.globalKey, builder: (column) => column); + GeneratedColumn get globalKey => + $composableBuilder(column: $table.globalKey, builder: (column) => column); - GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); } class $$DownloadOwnersTableTableManager @@ -4837,18 +5883,30 @@ class $$DownloadOwnersTableTableManager $$DownloadOwnersTableAnnotationComposer, $$DownloadOwnersTableCreateCompanionBuilder, $$DownloadOwnersTableUpdateCompanionBuilder, - (DownloadOwnerItem, BaseReferences<_$AppDatabase, $DownloadOwnersTable, DownloadOwnerItem>), + ( + DownloadOwnerItem, + BaseReferences< + _$AppDatabase, + $DownloadOwnersTable, + DownloadOwnerItem + >, + ), DownloadOwnerItem, PrefetchHooks Function() > { - $$DownloadOwnersTableTableManager(_$AppDatabase db, $DownloadOwnersTable table) - : super( + $$DownloadOwnersTableTableManager( + _$AppDatabase db, + $DownloadOwnersTable table, + ) : super( TableManagerState( db: db, table: table, - createFilteringComposer: () => $$DownloadOwnersTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$DownloadOwnersTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$DownloadOwnersTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$DownloadOwnersTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$DownloadOwnersTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$DownloadOwnersTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value profileId = const Value.absent(), @@ -4873,7 +5931,9 @@ class $$DownloadOwnersTableTableManager createdAt: createdAt, rowid: rowid, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -4889,7 +5949,10 @@ typedef $$DownloadOwnersTableProcessedTableManager = $$DownloadOwnersTableAnnotationComposer, $$DownloadOwnersTableCreateCompanionBuilder, $$DownloadOwnersTableUpdateCompanionBuilder, - (DownloadOwnerItem, BaseReferences<_$AppDatabase, $DownloadOwnersTable, DownloadOwnerItem>), + ( + DownloadOwnerItem, + BaseReferences<_$AppDatabase, $DownloadOwnersTable, DownloadOwnerItem>, + ), DownloadOwnerItem, PrefetchHooks Function() >; @@ -4912,7 +5975,8 @@ typedef $$DownloadQueueTableUpdateCompanionBuilder = Value downloadArtwork, }); -class $$DownloadQueueTableFilterComposer extends Composer<_$AppDatabase, $DownloadQueueTable> { +class $$DownloadQueueTableFilterComposer + extends Composer<_$AppDatabase, $DownloadQueueTable> { $$DownloadQueueTableFilterComposer({ required super.$db, required super.$table, @@ -4920,25 +5984,39 @@ class $$DownloadQueueTableFilterComposer extends Composer<_$AppDatabase, $Downlo super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get mediaGlobalKey => - $composableBuilder(column: $table.mediaGlobalKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get mediaGlobalKey => $composableBuilder( + column: $table.mediaGlobalKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get priority => - $composableBuilder(column: $table.priority, builder: (column) => ColumnFilters(column)); + ColumnFilters get priority => $composableBuilder( + column: $table.priority, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get addedAt => - $composableBuilder(column: $table.addedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get addedAt => $composableBuilder( + column: $table.addedAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get downloadSubtitles => - $composableBuilder(column: $table.downloadSubtitles, builder: (column) => ColumnFilters(column)); + ColumnFilters get downloadSubtitles => $composableBuilder( + column: $table.downloadSubtitles, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get downloadArtwork => - $composableBuilder(column: $table.downloadArtwork, builder: (column) => ColumnFilters(column)); + ColumnFilters get downloadArtwork => $composableBuilder( + column: $table.downloadArtwork, + builder: (column) => ColumnFilters(column), + ); } -class $$DownloadQueueTableOrderingComposer extends Composer<_$AppDatabase, $DownloadQueueTable> { +class $$DownloadQueueTableOrderingComposer + extends Composer<_$AppDatabase, $DownloadQueueTable> { $$DownloadQueueTableOrderingComposer({ required super.$db, required super.$table, @@ -4946,25 +6024,39 @@ class $$DownloadQueueTableOrderingComposer extends Composer<_$AppDatabase, $Down super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get mediaGlobalKey => - $composableBuilder(column: $table.mediaGlobalKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get mediaGlobalKey => $composableBuilder( + column: $table.mediaGlobalKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get priority => - $composableBuilder(column: $table.priority, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get priority => $composableBuilder( + column: $table.priority, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get addedAt => - $composableBuilder(column: $table.addedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get addedAt => $composableBuilder( + column: $table.addedAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get downloadSubtitles => - $composableBuilder(column: $table.downloadSubtitles, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get downloadSubtitles => $composableBuilder( + column: $table.downloadSubtitles, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get downloadArtwork => - $composableBuilder(column: $table.downloadArtwork, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get downloadArtwork => $composableBuilder( + column: $table.downloadArtwork, + builder: (column) => ColumnOrderings(column), + ); } -class $$DownloadQueueTableAnnotationComposer extends Composer<_$AppDatabase, $DownloadQueueTable> { +class $$DownloadQueueTableAnnotationComposer + extends Composer<_$AppDatabase, $DownloadQueueTable> { $$DownloadQueueTableAnnotationComposer({ required super.$db, required super.$table, @@ -4972,20 +6064,29 @@ class $$DownloadQueueTableAnnotationComposer extends Composer<_$AppDatabase, $Do super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get mediaGlobalKey => - $composableBuilder(column: $table.mediaGlobalKey, builder: (column) => column); + GeneratedColumn get mediaGlobalKey => $composableBuilder( + column: $table.mediaGlobalKey, + builder: (column) => column, + ); - GeneratedColumn get priority => $composableBuilder(column: $table.priority, builder: (column) => column); + GeneratedColumn get priority => + $composableBuilder(column: $table.priority, builder: (column) => column); - GeneratedColumn get addedAt => $composableBuilder(column: $table.addedAt, builder: (column) => column); + GeneratedColumn get addedAt => + $composableBuilder(column: $table.addedAt, builder: (column) => column); - GeneratedColumn get downloadSubtitles => - $composableBuilder(column: $table.downloadSubtitles, builder: (column) => column); + GeneratedColumn get downloadSubtitles => $composableBuilder( + column: $table.downloadSubtitles, + builder: (column) => column, + ); - GeneratedColumn get downloadArtwork => - $composableBuilder(column: $table.downloadArtwork, builder: (column) => column); + GeneratedColumn get downloadArtwork => $composableBuilder( + column: $table.downloadArtwork, + builder: (column) => column, + ); } class $$DownloadQueueTableTableManager @@ -4999,7 +6100,14 @@ class $$DownloadQueueTableTableManager $$DownloadQueueTableAnnotationComposer, $$DownloadQueueTableCreateCompanionBuilder, $$DownloadQueueTableUpdateCompanionBuilder, - (DownloadQueueItem, BaseReferences<_$AppDatabase, $DownloadQueueTable, DownloadQueueItem>), + ( + DownloadQueueItem, + BaseReferences< + _$AppDatabase, + $DownloadQueueTable, + DownloadQueueItem + >, + ), DownloadQueueItem, PrefetchHooks Function() > { @@ -5008,9 +6116,12 @@ class $$DownloadQueueTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$DownloadQueueTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$DownloadQueueTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$DownloadQueueTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$DownloadQueueTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$DownloadQueueTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$DownloadQueueTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -5043,7 +6154,9 @@ class $$DownloadQueueTableTableManager downloadSubtitles: downloadSubtitles, downloadArtwork: downloadArtwork, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -5059,7 +6172,10 @@ typedef $$DownloadQueueTableProcessedTableManager = $$DownloadQueueTableAnnotationComposer, $$DownloadQueueTableCreateCompanionBuilder, $$DownloadQueueTableUpdateCompanionBuilder, - (DownloadQueueItem, BaseReferences<_$AppDatabase, $DownloadQueueTable, DownloadQueueItem>), + ( + DownloadQueueItem, + BaseReferences<_$AppDatabase, $DownloadQueueTable, DownloadQueueItem>, + ), DownloadQueueItem, PrefetchHooks Function() >; @@ -5080,7 +6196,8 @@ typedef $$ApiCacheTableUpdateCompanionBuilder = Value rowid, }); -class $$ApiCacheTableFilterComposer extends Composer<_$AppDatabase, $ApiCacheTable> { +class $$ApiCacheTableFilterComposer + extends Composer<_$AppDatabase, $ApiCacheTable> { $$ApiCacheTableFilterComposer({ required super.$db, required super.$table, @@ -5088,19 +6205,29 @@ class $$ApiCacheTableFilterComposer extends Composer<_$AppDatabase, $ApiCacheTab super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get cacheKey => - $composableBuilder(column: $table.cacheKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get cacheKey => $composableBuilder( + column: $table.cacheKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get data => $composableBuilder(column: $table.data, builder: (column) => ColumnFilters(column)); + ColumnFilters get data => $composableBuilder( + column: $table.data, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get pinned => - $composableBuilder(column: $table.pinned, builder: (column) => ColumnFilters(column)); + ColumnFilters get pinned => $composableBuilder( + column: $table.pinned, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get cachedAt => - $composableBuilder(column: $table.cachedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnFilters(column), + ); } -class $$ApiCacheTableOrderingComposer extends Composer<_$AppDatabase, $ApiCacheTable> { +class $$ApiCacheTableOrderingComposer + extends Composer<_$AppDatabase, $ApiCacheTable> { $$ApiCacheTableOrderingComposer({ required super.$db, required super.$table, @@ -5108,20 +6235,29 @@ class $$ApiCacheTableOrderingComposer extends Composer<_$AppDatabase, $ApiCacheT super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get cacheKey => - $composableBuilder(column: $table.cacheKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get cacheKey => $composableBuilder( + column: $table.cacheKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get data => - $composableBuilder(column: $table.data, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get data => $composableBuilder( + column: $table.data, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get pinned => - $composableBuilder(column: $table.pinned, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get pinned => $composableBuilder( + column: $table.pinned, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get cachedAt => - $composableBuilder(column: $table.cachedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get cachedAt => $composableBuilder( + column: $table.cachedAt, + builder: (column) => ColumnOrderings(column), + ); } -class $$ApiCacheTableAnnotationComposer extends Composer<_$AppDatabase, $ApiCacheTable> { +class $$ApiCacheTableAnnotationComposer + extends Composer<_$AppDatabase, $ApiCacheTable> { $$ApiCacheTableAnnotationComposer({ required super.$db, required super.$table, @@ -5129,13 +6265,17 @@ class $$ApiCacheTableAnnotationComposer extends Composer<_$AppDatabase, $ApiCach super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get cacheKey => $composableBuilder(column: $table.cacheKey, builder: (column) => column); + GeneratedColumn get cacheKey => + $composableBuilder(column: $table.cacheKey, builder: (column) => column); - GeneratedColumn get data => $composableBuilder(column: $table.data, builder: (column) => column); + GeneratedColumn get data => + $composableBuilder(column: $table.data, builder: (column) => column); - GeneratedColumn get pinned => $composableBuilder(column: $table.pinned, builder: (column) => column); + GeneratedColumn get pinned => + $composableBuilder(column: $table.pinned, builder: (column) => column); - GeneratedColumn get cachedAt => $composableBuilder(column: $table.cachedAt, builder: (column) => column); + GeneratedColumn get cachedAt => + $composableBuilder(column: $table.cachedAt, builder: (column) => column); } class $$ApiCacheTableTableManager @@ -5149,7 +6289,10 @@ class $$ApiCacheTableTableManager $$ApiCacheTableAnnotationComposer, $$ApiCacheTableCreateCompanionBuilder, $$ApiCacheTableUpdateCompanionBuilder, - (ApiCacheData, BaseReferences<_$AppDatabase, $ApiCacheTable, ApiCacheData>), + ( + ApiCacheData, + BaseReferences<_$AppDatabase, $ApiCacheTable, ApiCacheData>, + ), ApiCacheData, PrefetchHooks Function() > { @@ -5158,9 +6301,12 @@ class $$ApiCacheTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$ApiCacheTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$ApiCacheTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$ApiCacheTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$ApiCacheTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ApiCacheTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$ApiCacheTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value cacheKey = const Value.absent(), @@ -5168,7 +6314,13 @@ class $$ApiCacheTableTableManager Value pinned = const Value.absent(), Value cachedAt = const Value.absent(), Value rowid = const Value.absent(), - }) => ApiCacheCompanion(cacheKey: cacheKey, data: data, pinned: pinned, cachedAt: cachedAt, rowid: rowid), + }) => ApiCacheCompanion( + cacheKey: cacheKey, + data: data, + pinned: pinned, + cachedAt: cachedAt, + rowid: rowid, + ), createCompanionCallback: ({ required String cacheKey, @@ -5183,7 +6335,9 @@ class $$ApiCacheTableTableManager cachedAt: cachedAt, rowid: rowid, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -5199,7 +6353,10 @@ typedef $$ApiCacheTableProcessedTableManager = $$ApiCacheTableAnnotationComposer, $$ApiCacheTableCreateCompanionBuilder, $$ApiCacheTableUpdateCompanionBuilder, - (ApiCacheData, BaseReferences<_$AppDatabase, $ApiCacheTable, ApiCacheData>), + ( + ApiCacheData, + BaseReferences<_$AppDatabase, $ApiCacheTable, ApiCacheData>, + ), ApiCacheData, PrefetchHooks Function() >; @@ -5238,7 +6395,8 @@ typedef $$OfflineWatchProgressTableUpdateCompanionBuilder = Value lastError, }); -class $$OfflineWatchProgressTableFilterComposer extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { +class $$OfflineWatchProgressTableFilterComposer + extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { $$OfflineWatchProgressTableFilterComposer({ required super.$db, required super.$table, @@ -5246,49 +6404,79 @@ class $$OfflineWatchProgressTableFilterComposer extends Composer<_$AppDatabase, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnFilters(column)); + ColumnFilters get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnFilters(column)); + ColumnFilters get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => ColumnFilters(column)); + ColumnFilters get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get actionType => - $composableBuilder(column: $table.actionType, builder: (column) => ColumnFilters(column)); + ColumnFilters get actionType => $composableBuilder( + column: $table.actionType, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get viewOffset => - $composableBuilder(column: $table.viewOffset, builder: (column) => ColumnFilters(column)); + ColumnFilters get viewOffset => $composableBuilder( + column: $table.viewOffset, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get duration => - $composableBuilder(column: $table.duration, builder: (column) => ColumnFilters(column)); + ColumnFilters get duration => $composableBuilder( + column: $table.duration, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get shouldMarkWatched => - $composableBuilder(column: $table.shouldMarkWatched, builder: (column) => ColumnFilters(column)); + ColumnFilters get shouldMarkWatched => $composableBuilder( + column: $table.shouldMarkWatched, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get updatedAt => - $composableBuilder(column: $table.updatedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get syncAttempts => - $composableBuilder(column: $table.syncAttempts, builder: (column) => ColumnFilters(column)); + ColumnFilters get syncAttempts => $composableBuilder( + column: $table.syncAttempts, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get lastError => - $composableBuilder(column: $table.lastError, builder: (column) => ColumnFilters(column)); + ColumnFilters get lastError => $composableBuilder( + column: $table.lastError, + builder: (column) => ColumnFilters(column), + ); } -class $$OfflineWatchProgressTableOrderingComposer extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { +class $$OfflineWatchProgressTableOrderingComposer + extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { $$OfflineWatchProgressTableOrderingComposer({ required super.$db, required super.$table, @@ -5296,49 +6484,79 @@ class $$OfflineWatchProgressTableOrderingComposer extends Composer<_$AppDatabase super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get actionType => - $composableBuilder(column: $table.actionType, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get actionType => $composableBuilder( + column: $table.actionType, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get viewOffset => - $composableBuilder(column: $table.viewOffset, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get viewOffset => $composableBuilder( + column: $table.viewOffset, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get duration => - $composableBuilder(column: $table.duration, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get duration => $composableBuilder( + column: $table.duration, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get shouldMarkWatched => - $composableBuilder(column: $table.shouldMarkWatched, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get shouldMarkWatched => $composableBuilder( + column: $table.shouldMarkWatched, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get updatedAt => - $composableBuilder(column: $table.updatedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get updatedAt => $composableBuilder( + column: $table.updatedAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get syncAttempts => - $composableBuilder(column: $table.syncAttempts, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get syncAttempts => $composableBuilder( + column: $table.syncAttempts, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get lastError => - $composableBuilder(column: $table.lastError, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get lastError => $composableBuilder( + column: $table.lastError, + builder: (column) => ColumnOrderings(column), + ); } -class $$OfflineWatchProgressTableAnnotationComposer extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { +class $$OfflineWatchProgressTableAnnotationComposer + extends Composer<_$AppDatabase, $OfflineWatchProgressTable> { $$OfflineWatchProgressTableAnnotationComposer({ required super.$db, required super.$table, @@ -5346,35 +6564,57 @@ class $$OfflineWatchProgressTableAnnotationComposer extends Composer<_$AppDataba super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get profileId => $composableBuilder(column: $table.profileId, builder: (column) => column); + GeneratedColumn get profileId => + $composableBuilder(column: $table.profileId, builder: (column) => column); - GeneratedColumn get serverId => $composableBuilder(column: $table.serverId, builder: (column) => column); + GeneratedColumn get serverId => + $composableBuilder(column: $table.serverId, builder: (column) => column); - GeneratedColumn get clientScopeId => - $composableBuilder(column: $table.clientScopeId, builder: (column) => column); + GeneratedColumn get clientScopeId => $composableBuilder( + column: $table.clientScopeId, + builder: (column) => column, + ); - GeneratedColumn get ratingKey => $composableBuilder(column: $table.ratingKey, builder: (column) => column); + GeneratedColumn get ratingKey => + $composableBuilder(column: $table.ratingKey, builder: (column) => column); - GeneratedColumn get globalKey => $composableBuilder(column: $table.globalKey, builder: (column) => column); + GeneratedColumn get globalKey => + $composableBuilder(column: $table.globalKey, builder: (column) => column); - GeneratedColumn get actionType => $composableBuilder(column: $table.actionType, builder: (column) => column); + GeneratedColumn get actionType => $composableBuilder( + column: $table.actionType, + builder: (column) => column, + ); - GeneratedColumn get viewOffset => $composableBuilder(column: $table.viewOffset, builder: (column) => column); + GeneratedColumn get viewOffset => $composableBuilder( + column: $table.viewOffset, + builder: (column) => column, + ); - GeneratedColumn get duration => $composableBuilder(column: $table.duration, builder: (column) => column); + GeneratedColumn get duration => + $composableBuilder(column: $table.duration, builder: (column) => column); - GeneratedColumn get shouldMarkWatched => - $composableBuilder(column: $table.shouldMarkWatched, builder: (column) => column); + GeneratedColumn get shouldMarkWatched => $composableBuilder( + column: $table.shouldMarkWatched, + builder: (column) => column, + ); - GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); - GeneratedColumn get updatedAt => $composableBuilder(column: $table.updatedAt, builder: (column) => column); + GeneratedColumn get updatedAt => + $composableBuilder(column: $table.updatedAt, builder: (column) => column); - GeneratedColumn get syncAttempts => $composableBuilder(column: $table.syncAttempts, builder: (column) => column); + GeneratedColumn get syncAttempts => $composableBuilder( + column: $table.syncAttempts, + builder: (column) => column, + ); - GeneratedColumn get lastError => $composableBuilder(column: $table.lastError, builder: (column) => column); + GeneratedColumn get lastError => + $composableBuilder(column: $table.lastError, builder: (column) => column); } class $$OfflineWatchProgressTableTableManager @@ -5390,19 +6630,34 @@ class $$OfflineWatchProgressTableTableManager $$OfflineWatchProgressTableUpdateCompanionBuilder, ( OfflineWatchProgressItem, - BaseReferences<_$AppDatabase, $OfflineWatchProgressTable, OfflineWatchProgressItem>, + BaseReferences< + _$AppDatabase, + $OfflineWatchProgressTable, + OfflineWatchProgressItem + >, ), OfflineWatchProgressItem, PrefetchHooks Function() > { - $$OfflineWatchProgressTableTableManager(_$AppDatabase db, $OfflineWatchProgressTable table) - : super( + $$OfflineWatchProgressTableTableManager( + _$AppDatabase db, + $OfflineWatchProgressTable table, + ) : super( TableManagerState( db: db, table: table, - createFilteringComposer: () => $$OfflineWatchProgressTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$OfflineWatchProgressTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$OfflineWatchProgressTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$OfflineWatchProgressTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$OfflineWatchProgressTableOrderingComposer( + $db: db, + $table: table, + ), + createComputedFieldComposer: () => + $$OfflineWatchProgressTableAnnotationComposer( + $db: db, + $table: table, + ), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -5467,7 +6722,9 @@ class $$OfflineWatchProgressTableTableManager syncAttempts: syncAttempts, lastError: lastError, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -5483,7 +6740,14 @@ typedef $$OfflineWatchProgressTableProcessedTableManager = $$OfflineWatchProgressTableAnnotationComposer, $$OfflineWatchProgressTableCreateCompanionBuilder, $$OfflineWatchProgressTableUpdateCompanionBuilder, - (OfflineWatchProgressItem, BaseReferences<_$AppDatabase, $OfflineWatchProgressTable, OfflineWatchProgressItem>), + ( + OfflineWatchProgressItem, + BaseReferences< + _$AppDatabase, + $OfflineWatchProgressTable, + OfflineWatchProgressItem + >, + ), OfflineWatchProgressItem, PrefetchHooks Function() >; @@ -5518,7 +6782,8 @@ typedef $$SyncRulesTableUpdateCompanionBuilder = Value downloadFilter, }); -class $$SyncRulesTableFilterComposer extends Composer<_$AppDatabase, $SyncRulesTable> { +class $$SyncRulesTableFilterComposer + extends Composer<_$AppDatabase, $SyncRulesTable> { $$SyncRulesTableFilterComposer({ required super.$db, required super.$table, @@ -5526,43 +6791,69 @@ class $$SyncRulesTableFilterComposer extends Composer<_$AppDatabase, $SyncRulesT super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnFilters(column)); + ColumnFilters get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnFilters(column)); + ColumnFilters get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnFilters(column)); + ColumnFilters get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get targetType => - $composableBuilder(column: $table.targetType, builder: (column) => ColumnFilters(column)); + ColumnFilters get targetType => $composableBuilder( + column: $table.targetType, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get episodeCount => - $composableBuilder(column: $table.episodeCount, builder: (column) => ColumnFilters(column)); + ColumnFilters get episodeCount => $composableBuilder( + column: $table.episodeCount, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get enabled => - $composableBuilder(column: $table.enabled, builder: (column) => ColumnFilters(column)); + ColumnFilters get enabled => $composableBuilder( + column: $table.enabled, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get lastExecutedAt => - $composableBuilder(column: $table.lastExecutedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get lastExecutedAt => $composableBuilder( + column: $table.lastExecutedAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get mediaIndex => - $composableBuilder(column: $table.mediaIndex, builder: (column) => ColumnFilters(column)); + ColumnFilters get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get downloadFilter => - $composableBuilder(column: $table.downloadFilter, builder: (column) => ColumnFilters(column)); + ColumnFilters get downloadFilter => $composableBuilder( + column: $table.downloadFilter, + builder: (column) => ColumnFilters(column), + ); } -class $$SyncRulesTableOrderingComposer extends Composer<_$AppDatabase, $SyncRulesTable> { +class $$SyncRulesTableOrderingComposer + extends Composer<_$AppDatabase, $SyncRulesTable> { $$SyncRulesTableOrderingComposer({ required super.$db, required super.$table, @@ -5570,43 +6861,69 @@ class $$SyncRulesTableOrderingComposer extends Composer<_$AppDatabase, $SyncRule super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get serverId => - $composableBuilder(column: $table.serverId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get serverId => $composableBuilder( + column: $table.serverId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get ratingKey => - $composableBuilder(column: $table.ratingKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get ratingKey => $composableBuilder( + column: $table.ratingKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get globalKey => - $composableBuilder(column: $table.globalKey, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get globalKey => $composableBuilder( + column: $table.globalKey, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get targetType => - $composableBuilder(column: $table.targetType, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get targetType => $composableBuilder( + column: $table.targetType, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get episodeCount => - $composableBuilder(column: $table.episodeCount, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get episodeCount => $composableBuilder( + column: $table.episodeCount, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get enabled => - $composableBuilder(column: $table.enabled, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get enabled => $composableBuilder( + column: $table.enabled, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get lastExecutedAt => - $composableBuilder(column: $table.lastExecutedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get lastExecutedAt => $composableBuilder( + column: $table.lastExecutedAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get mediaIndex => - $composableBuilder(column: $table.mediaIndex, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get downloadFilter => - $composableBuilder(column: $table.downloadFilter, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get downloadFilter => $composableBuilder( + column: $table.downloadFilter, + builder: (column) => ColumnOrderings(column), + ); } -class $$SyncRulesTableAnnotationComposer extends Composer<_$AppDatabase, $SyncRulesTable> { +class $$SyncRulesTableAnnotationComposer + extends Composer<_$AppDatabase, $SyncRulesTable> { $$SyncRulesTableAnnotationComposer({ required super.$db, required super.$table, @@ -5614,31 +6931,51 @@ class $$SyncRulesTableAnnotationComposer extends Composer<_$AppDatabase, $SyncRu super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get profileId => $composableBuilder(column: $table.profileId, builder: (column) => column); + GeneratedColumn get profileId => + $composableBuilder(column: $table.profileId, builder: (column) => column); - GeneratedColumn get serverId => $composableBuilder(column: $table.serverId, builder: (column) => column); + GeneratedColumn get serverId => + $composableBuilder(column: $table.serverId, builder: (column) => column); - GeneratedColumn get ratingKey => $composableBuilder(column: $table.ratingKey, builder: (column) => column); + GeneratedColumn get ratingKey => + $composableBuilder(column: $table.ratingKey, builder: (column) => column); - GeneratedColumn get globalKey => $composableBuilder(column: $table.globalKey, builder: (column) => column); + GeneratedColumn get globalKey => + $composableBuilder(column: $table.globalKey, builder: (column) => column); - GeneratedColumn get targetType => $composableBuilder(column: $table.targetType, builder: (column) => column); + GeneratedColumn get targetType => $composableBuilder( + column: $table.targetType, + builder: (column) => column, + ); - GeneratedColumn get episodeCount => $composableBuilder(column: $table.episodeCount, builder: (column) => column); + GeneratedColumn get episodeCount => $composableBuilder( + column: $table.episodeCount, + builder: (column) => column, + ); - GeneratedColumn get enabled => $composableBuilder(column: $table.enabled, builder: (column) => column); + GeneratedColumn get enabled => + $composableBuilder(column: $table.enabled, builder: (column) => column); - GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); - GeneratedColumn get lastExecutedAt => - $composableBuilder(column: $table.lastExecutedAt, builder: (column) => column); + GeneratedColumn get lastExecutedAt => $composableBuilder( + column: $table.lastExecutedAt, + builder: (column) => column, + ); - GeneratedColumn get mediaIndex => $composableBuilder(column: $table.mediaIndex, builder: (column) => column); + GeneratedColumn get mediaIndex => $composableBuilder( + column: $table.mediaIndex, + builder: (column) => column, + ); - GeneratedColumn get downloadFilter => - $composableBuilder(column: $table.downloadFilter, builder: (column) => column); + GeneratedColumn get downloadFilter => $composableBuilder( + column: $table.downloadFilter, + builder: (column) => column, + ); } class $$SyncRulesTableTableManager @@ -5652,7 +6989,10 @@ class $$SyncRulesTableTableManager $$SyncRulesTableAnnotationComposer, $$SyncRulesTableCreateCompanionBuilder, $$SyncRulesTableUpdateCompanionBuilder, - (SyncRuleItem, BaseReferences<_$AppDatabase, $SyncRulesTable, SyncRuleItem>), + ( + SyncRuleItem, + BaseReferences<_$AppDatabase, $SyncRulesTable, SyncRuleItem>, + ), SyncRuleItem, PrefetchHooks Function() > { @@ -5661,9 +7001,12 @@ class $$SyncRulesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$SyncRulesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$SyncRulesTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$SyncRulesTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$SyncRulesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$SyncRulesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$SyncRulesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -5720,7 +7063,9 @@ class $$SyncRulesTableTableManager mediaIndex: mediaIndex, downloadFilter: downloadFilter, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -5736,7 +7081,10 @@ typedef $$SyncRulesTableProcessedTableManager = $$SyncRulesTableAnnotationComposer, $$SyncRulesTableCreateCompanionBuilder, $$SyncRulesTableUpdateCompanionBuilder, - (SyncRuleItem, BaseReferences<_$AppDatabase, $SyncRulesTable, SyncRuleItem>), + ( + SyncRuleItem, + BaseReferences<_$AppDatabase, $SyncRulesTable, SyncRuleItem>, + ), SyncRuleItem, PrefetchHooks Function() >; @@ -5763,15 +7111,22 @@ typedef $$ConnectionsTableUpdateCompanionBuilder = Value rowid, }); -final class $$ConnectionsTableReferences extends BaseReferences<_$AppDatabase, $ConnectionsTable, ConnectionRow> { +final class $$ConnectionsTableReferences + extends BaseReferences<_$AppDatabase, $ConnectionsTable, ConnectionRow> { $$ConnectionsTableReferences(super.$_db, super.$_table, super.$_typedResult); - static MultiTypedResultKey<$ProfileConnectionsTable, List> _profileConnectionsRefsTable( - _$AppDatabase db, - ) => MultiTypedResultKey.fromTable( - db.profileConnections, - aliasName: $_aliasNameGenerator(db.connections.id, db.profileConnections.connectionId), - ); + static MultiTypedResultKey< + $ProfileConnectionsTable, + List + > + _profileConnectionsRefsTable(_$AppDatabase db) => + MultiTypedResultKey.fromTable( + db.profileConnections, + aliasName: $_aliasNameGenerator( + db.connections.id, + db.profileConnections.connectionId, + ), + ); $$ProfileConnectionsTableProcessedTableManager get profileConnectionsRefs { final manager = $$ProfileConnectionsTableTableManager( @@ -5779,12 +7134,17 @@ final class $$ConnectionsTableReferences extends BaseReferences<_$AppDatabase, $ $_db.profileConnections, ).filter((f) => f.connectionId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull(_profileConnectionsRefsTable($_db)); - return ProcessedTableManager(manager.$state.copyWith(prefetchedData: cache)); + final cache = $_typedResult.readTableOrNull( + _profileConnectionsRefsTable($_db), + ); + return ProcessedTableManager( + manager.$state.copyWith(prefetchedData: cache), + ); } } -class $$ConnectionsTableFilterComposer extends Composer<_$AppDatabase, $ConnectionsTable> { +class $$ConnectionsTableFilterComposer + extends Composer<_$AppDatabase, $ConnectionsTable> { $$ConnectionsTableFilterComposer({ required super.$db, required super.$table, @@ -5792,45 +7152,69 @@ class $$ConnectionsTableFilterComposer extends Composer<_$AppDatabase, $Connecti super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get kind => $composableBuilder(column: $table.kind, builder: (column) => ColumnFilters(column)); + ColumnFilters get kind => $composableBuilder( + column: $table.kind, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => ColumnFilters(column)); + ColumnFilters get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get configJson => - $composableBuilder(column: $table.configJson, builder: (column) => ColumnFilters(column)); + ColumnFilters get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get isDefault => - $composableBuilder(column: $table.isDefault, builder: (column) => ColumnFilters(column)); + ColumnFilters get isDefault => $composableBuilder( + column: $table.isDefault, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get lastAuthenticatedAt => - $composableBuilder(column: $table.lastAuthenticatedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get lastAuthenticatedAt => $composableBuilder( + column: $table.lastAuthenticatedAt, + builder: (column) => ColumnFilters(column), + ); - Expression profileConnectionsRefs(Expression Function($$ProfileConnectionsTableFilterComposer f) f) { + Expression profileConnectionsRefs( + Expression Function($$ProfileConnectionsTableFilterComposer f) f, + ) { final $$ProfileConnectionsTableFilterComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.id, referencedTable: $db.profileConnections, getReferencedColumn: (t) => t.connectionId, - builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => - $$ProfileConnectionsTableFilterComposer( + builder: + ( + joinBuilder, { + $addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer, + }) => $$ProfileConnectionsTableFilterComposer( $db: $db, $table: $db.profileConnections, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, ), ); return f(composer); } } -class $$ConnectionsTableOrderingComposer extends Composer<_$AppDatabase, $ConnectionsTable> { +class $$ConnectionsTableOrderingComposer + extends Composer<_$AppDatabase, $ConnectionsTable> { $$ConnectionsTableOrderingComposer({ required super.$db, required super.$table, @@ -5838,28 +7222,44 @@ class $$ConnectionsTableOrderingComposer extends Composer<_$AppDatabase, $Connec super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get kind => - $composableBuilder(column: $table.kind, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get kind => $composableBuilder( + column: $table.kind, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get configJson => - $composableBuilder(column: $table.configJson, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get isDefault => - $composableBuilder(column: $table.isDefault, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get isDefault => $composableBuilder( + column: $table.isDefault, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get lastAuthenticatedAt => - $composableBuilder(column: $table.lastAuthenticatedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get lastAuthenticatedAt => $composableBuilder( + column: $table.lastAuthenticatedAt, + builder: (column) => ColumnOrderings(column), + ); } -class $$ConnectionsTableAnnotationComposer extends Composer<_$AppDatabase, $ConnectionsTable> { +class $$ConnectionsTableAnnotationComposer + extends Composer<_$AppDatabase, $ConnectionsTable> { $$ConnectionsTableAnnotationComposer({ required super.$db, required super.$table, @@ -5867,39 +7267,56 @@ class $$ConnectionsTableAnnotationComposer extends Composer<_$AppDatabase, $Conn super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get kind => $composableBuilder(column: $table.kind, builder: (column) => column); + GeneratedColumn get kind => + $composableBuilder(column: $table.kind, builder: (column) => column); - GeneratedColumn get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => column); + GeneratedColumn get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => column, + ); - GeneratedColumn get configJson => $composableBuilder(column: $table.configJson, builder: (column) => column); + GeneratedColumn get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => column, + ); - GeneratedColumn get isDefault => $composableBuilder(column: $table.isDefault, builder: (column) => column); + GeneratedColumn get isDefault => + $composableBuilder(column: $table.isDefault, builder: (column) => column); - GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); - GeneratedColumn get lastAuthenticatedAt => - $composableBuilder(column: $table.lastAuthenticatedAt, builder: (column) => column); + GeneratedColumn get lastAuthenticatedAt => $composableBuilder( + column: $table.lastAuthenticatedAt, + builder: (column) => column, + ); Expression profileConnectionsRefs( Expression Function($$ProfileConnectionsTableAnnotationComposer a) f, ) { - final $$ProfileConnectionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.profileConnections, - getReferencedColumn: (t) => t.connectionId, - builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => - $$ProfileConnectionsTableAnnotationComposer( - $db: $db, - $table: $db.profileConnections, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, - ), - ); + final $$ProfileConnectionsTableAnnotationComposer composer = + $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.profileConnections, + getReferencedColumn: (t) => t.connectionId, + builder: + ( + joinBuilder, { + $addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer, + }) => $$ProfileConnectionsTableAnnotationComposer( + $db: $db, + $table: $db.profileConnections, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + ), + ); return f(composer); } } @@ -5924,9 +7341,12 @@ class $$ConnectionsTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$ConnectionsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$ConnectionsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$ConnectionsTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$ConnectionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ConnectionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$ConnectionsTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -5967,23 +7387,42 @@ class $$ConnectionsTableTableManager lastAuthenticatedAt: lastAuthenticatedAt, rowid: rowid, ), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), $$ConnectionsTableReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map( + (e) => ( + e.readTable(table), + $$ConnectionsTableReferences(db, table, e), + ), + ) + .toList(), prefetchHooksCallback: ({profileConnectionsRefs = false}) { return PrefetchHooks( db: db, - explicitlyWatchedTables: [if (profileConnectionsRefs) db.profileConnections], + explicitlyWatchedTables: [ + if (profileConnectionsRefs) db.profileConnections, + ], addJoins: null, getPrefetchedDataCallback: (items) async { return [ if (profileConnectionsRefs) - await $_getPrefetchedData( + await $_getPrefetchedData< + ConnectionRow, + $ConnectionsTable, + ProfileConnectionRow + >( currentTable: table, - referencedTable: $$ConnectionsTableReferences._profileConnectionsRefsTable(db), + referencedTable: $$ConnectionsTableReferences + ._profileConnectionsRefsTable(db), managerFromTypedResult: (p0) => - $$ConnectionsTableReferences(db, table, p0).profileConnectionsRefs, + $$ConnectionsTableReferences( + db, + table, + p0, + ).profileConnectionsRefs, referencedItemsForCurrentItem: (item, referencedItems) => - referencedItems.where((e) => e.connectionId == item.id), + referencedItems.where( + (e) => e.connectionId == item.id, + ), typedResults: items, ), ]; @@ -6033,7 +7472,8 @@ typedef $$ProfilesTableUpdateCompanionBuilder = Value rowid, }); -class $$ProfilesTableFilterComposer extends Composer<_$AppDatabase, $ProfilesTable> { +class $$ProfilesTableFilterComposer + extends Composer<_$AppDatabase, $ProfilesTable> { $$ProfilesTableFilterComposer({ required super.$db, required super.$table, @@ -6041,30 +7481,49 @@ class $$ProfilesTableFilterComposer extends Composer<_$AppDatabase, $ProfilesTab super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get id => $composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column)); + ColumnFilters get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get kind => $composableBuilder(column: $table.kind, builder: (column) => ColumnFilters(column)); + ColumnFilters get kind => $composableBuilder( + column: $table.kind, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => ColumnFilters(column)); + ColumnFilters get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get avatarThumbUrl => - $composableBuilder(column: $table.avatarThumbUrl, builder: (column) => ColumnFilters(column)); + ColumnFilters get avatarThumbUrl => $composableBuilder( + column: $table.avatarThumbUrl, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get configJson => - $composableBuilder(column: $table.configJson, builder: (column) => ColumnFilters(column)); + ColumnFilters get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get sortOrder => - $composableBuilder(column: $table.sortOrder, builder: (column) => ColumnFilters(column)); + ColumnFilters get sortOrder => $composableBuilder( + column: $table.sortOrder, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get lastUsedAt => - $composableBuilder(column: $table.lastUsedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => ColumnFilters(column), + ); } -class $$ProfilesTableOrderingComposer extends Composer<_$AppDatabase, $ProfilesTable> { +class $$ProfilesTableOrderingComposer + extends Composer<_$AppDatabase, $ProfilesTable> { $$ProfilesTableOrderingComposer({ required super.$db, required super.$table, @@ -6072,31 +7531,49 @@ class $$ProfilesTableOrderingComposer extends Composer<_$AppDatabase, $ProfilesT super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get id => $composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get id => $composableBuilder( + column: $table.id, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get kind => - $composableBuilder(column: $table.kind, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get kind => $composableBuilder( + column: $table.kind, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get avatarThumbUrl => - $composableBuilder(column: $table.avatarThumbUrl, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get avatarThumbUrl => $composableBuilder( + column: $table.avatarThumbUrl, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get configJson => - $composableBuilder(column: $table.configJson, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get sortOrder => - $composableBuilder(column: $table.sortOrder, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get sortOrder => $composableBuilder( + column: $table.sortOrder, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get createdAt => - $composableBuilder(column: $table.createdAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get createdAt => $composableBuilder( + column: $table.createdAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get lastUsedAt => - $composableBuilder(column: $table.lastUsedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => ColumnOrderings(column), + ); } -class $$ProfilesTableAnnotationComposer extends Composer<_$AppDatabase, $ProfilesTable> { +class $$ProfilesTableAnnotationComposer + extends Composer<_$AppDatabase, $ProfilesTable> { $$ProfilesTableAnnotationComposer({ required super.$db, required super.$table, @@ -6104,23 +7581,37 @@ class $$ProfilesTableAnnotationComposer extends Composer<_$AppDatabase, $Profile super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); + GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); - GeneratedColumn get kind => $composableBuilder(column: $table.kind, builder: (column) => column); + GeneratedColumn get kind => + $composableBuilder(column: $table.kind, builder: (column) => column); - GeneratedColumn get displayName => - $composableBuilder(column: $table.displayName, builder: (column) => column); + GeneratedColumn get displayName => $composableBuilder( + column: $table.displayName, + builder: (column) => column, + ); - GeneratedColumn get avatarThumbUrl => - $composableBuilder(column: $table.avatarThumbUrl, builder: (column) => column); + GeneratedColumn get avatarThumbUrl => $composableBuilder( + column: $table.avatarThumbUrl, + builder: (column) => column, + ); - GeneratedColumn get configJson => $composableBuilder(column: $table.configJson, builder: (column) => column); + GeneratedColumn get configJson => $composableBuilder( + column: $table.configJson, + builder: (column) => column, + ); - GeneratedColumn get sortOrder => $composableBuilder(column: $table.sortOrder, builder: (column) => column); + GeneratedColumn get sortOrder => + $composableBuilder(column: $table.sortOrder, builder: (column) => column); - GeneratedColumn get createdAt => $composableBuilder(column: $table.createdAt, builder: (column) => column); + GeneratedColumn get createdAt => + $composableBuilder(column: $table.createdAt, builder: (column) => column); - GeneratedColumn get lastUsedAt => $composableBuilder(column: $table.lastUsedAt, builder: (column) => column); + GeneratedColumn get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => column, + ); } class $$ProfilesTableTableManager @@ -6134,7 +7625,10 @@ class $$ProfilesTableTableManager $$ProfilesTableAnnotationComposer, $$ProfilesTableCreateCompanionBuilder, $$ProfilesTableUpdateCompanionBuilder, - (ProfileRow, BaseReferences<_$AppDatabase, $ProfilesTable, ProfileRow>), + ( + ProfileRow, + BaseReferences<_$AppDatabase, $ProfilesTable, ProfileRow>, + ), ProfileRow, PrefetchHooks Function() > { @@ -6143,9 +7637,12 @@ class $$ProfilesTableTableManager TableManagerState( db: db, table: table, - createFilteringComposer: () => $$ProfilesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$ProfilesTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$ProfilesTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$ProfilesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ProfilesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$ProfilesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), @@ -6190,7 +7687,9 @@ class $$ProfilesTableTableManager lastUsedAt: lastUsedAt, rowid: rowid, ), - withReferenceMapper: (p0) => p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), BaseReferences(db, table, e))) + .toList(), prefetchHooksCallback: null, ), ); @@ -6234,23 +7733,43 @@ typedef $$ProfileConnectionsTableUpdateCompanionBuilder = }); final class $$ProfileConnectionsTableReferences - extends BaseReferences<_$AppDatabase, $ProfileConnectionsTable, ProfileConnectionRow> { - $$ProfileConnectionsTableReferences(super.$_db, super.$_table, super.$_typedResult); + extends + BaseReferences< + _$AppDatabase, + $ProfileConnectionsTable, + ProfileConnectionRow + > { + $$ProfileConnectionsTableReferences( + super.$_db, + super.$_table, + super.$_typedResult, + ); static $ConnectionsTable _connectionIdTable(_$AppDatabase db) => - db.connections.createAlias($_aliasNameGenerator(db.profileConnections.connectionId, db.connections.id)); + db.connections.createAlias( + $_aliasNameGenerator( + db.profileConnections.connectionId, + db.connections.id, + ), + ); $$ConnectionsTableProcessedTableManager get connectionId { final $_column = $_itemColumn('connection_id')!; - final manager = $$ConnectionsTableTableManager($_db, $_db.connections).filter((f) => f.id.sqlEquals($_column)); + final manager = $$ConnectionsTableTableManager( + $_db, + $_db.connections, + ).filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_connectionIdTable($_db)); if (item == null) return manager; - return ProcessedTableManager(manager.$state.copyWith(prefetchedData: [item])); + return ProcessedTableManager( + manager.$state.copyWith(prefetchedData: [item]), + ); } } -class $$ProfileConnectionsTableFilterComposer extends Composer<_$AppDatabase, $ProfileConnectionsTable> { +class $$ProfileConnectionsTableFilterComposer + extends Composer<_$AppDatabase, $ProfileConnectionsTable> { $$ProfileConnectionsTableFilterComposer({ required super.$db, required super.$table, @@ -6258,23 +7777,35 @@ class $$ProfileConnectionsTableFilterComposer extends Composer<_$AppDatabase, $P super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnFilters get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnFilters(column)); + ColumnFilters get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get userToken => - $composableBuilder(column: $table.userToken, builder: (column) => ColumnFilters(column)); + ColumnFilters get userToken => $composableBuilder( + column: $table.userToken, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get userIdentifier => - $composableBuilder(column: $table.userIdentifier, builder: (column) => ColumnFilters(column)); + ColumnFilters get userIdentifier => $composableBuilder( + column: $table.userIdentifier, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get isDefault => - $composableBuilder(column: $table.isDefault, builder: (column) => ColumnFilters(column)); + ColumnFilters get isDefault => $composableBuilder( + column: $table.isDefault, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get tokenAcquiredAt => - $composableBuilder(column: $table.tokenAcquiredAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get tokenAcquiredAt => $composableBuilder( + column: $table.tokenAcquiredAt, + builder: (column) => ColumnFilters(column), + ); - ColumnFilters get lastUsedAt => - $composableBuilder(column: $table.lastUsedAt, builder: (column) => ColumnFilters(column)); + ColumnFilters get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => ColumnFilters(column), + ); $$ConnectionsTableFilterComposer get connectionId { final $$ConnectionsTableFilterComposer composer = $composerBuilder( @@ -6282,20 +7813,26 @@ class $$ProfileConnectionsTableFilterComposer extends Composer<_$AppDatabase, $P getCurrentColumn: (t) => t.connectionId, referencedTable: $db.connections, getReferencedColumn: (t) => t.id, - builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => - $$ConnectionsTableFilterComposer( + builder: + ( + joinBuilder, { + $addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer, + }) => $$ConnectionsTableFilterComposer( $db: $db, $table: $db.connections, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, ), ); return composer; } } -class $$ProfileConnectionsTableOrderingComposer extends Composer<_$AppDatabase, $ProfileConnectionsTable> { +class $$ProfileConnectionsTableOrderingComposer + extends Composer<_$AppDatabase, $ProfileConnectionsTable> { $$ProfileConnectionsTableOrderingComposer({ required super.$db, required super.$table, @@ -6303,23 +7840,35 @@ class $$ProfileConnectionsTableOrderingComposer extends Composer<_$AppDatabase, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - ColumnOrderings get profileId => - $composableBuilder(column: $table.profileId, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get profileId => $composableBuilder( + column: $table.profileId, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get userToken => - $composableBuilder(column: $table.userToken, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get userToken => $composableBuilder( + column: $table.userToken, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get userIdentifier => - $composableBuilder(column: $table.userIdentifier, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get userIdentifier => $composableBuilder( + column: $table.userIdentifier, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get isDefault => - $composableBuilder(column: $table.isDefault, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get isDefault => $composableBuilder( + column: $table.isDefault, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get tokenAcquiredAt => - $composableBuilder(column: $table.tokenAcquiredAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get tokenAcquiredAt => $composableBuilder( + column: $table.tokenAcquiredAt, + builder: (column) => ColumnOrderings(column), + ); - ColumnOrderings get lastUsedAt => - $composableBuilder(column: $table.lastUsedAt, builder: (column) => ColumnOrderings(column)); + ColumnOrderings get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => ColumnOrderings(column), + ); $$ConnectionsTableOrderingComposer get connectionId { final $$ConnectionsTableOrderingComposer composer = $composerBuilder( @@ -6327,20 +7876,26 @@ class $$ProfileConnectionsTableOrderingComposer extends Composer<_$AppDatabase, getCurrentColumn: (t) => t.connectionId, referencedTable: $db.connections, getReferencedColumn: (t) => t.id, - builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => - $$ConnectionsTableOrderingComposer( + builder: + ( + joinBuilder, { + $addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer, + }) => $$ConnectionsTableOrderingComposer( $db: $db, $table: $db.connections, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, ), ); return composer; } } -class $$ProfileConnectionsTableAnnotationComposer extends Composer<_$AppDatabase, $ProfileConnectionsTable> { +class $$ProfileConnectionsTableAnnotationComposer + extends Composer<_$AppDatabase, $ProfileConnectionsTable> { $$ProfileConnectionsTableAnnotationComposer({ required super.$db, required super.$table, @@ -6348,19 +7903,29 @@ class $$ProfileConnectionsTableAnnotationComposer extends Composer<_$AppDatabase super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); - GeneratedColumn get profileId => $composableBuilder(column: $table.profileId, builder: (column) => column); + GeneratedColumn get profileId => + $composableBuilder(column: $table.profileId, builder: (column) => column); - GeneratedColumn get userToken => $composableBuilder(column: $table.userToken, builder: (column) => column); + GeneratedColumn get userToken => + $composableBuilder(column: $table.userToken, builder: (column) => column); - GeneratedColumn get userIdentifier => - $composableBuilder(column: $table.userIdentifier, builder: (column) => column); + GeneratedColumn get userIdentifier => $composableBuilder( + column: $table.userIdentifier, + builder: (column) => column, + ); - GeneratedColumn get isDefault => $composableBuilder(column: $table.isDefault, builder: (column) => column); + GeneratedColumn get isDefault => + $composableBuilder(column: $table.isDefault, builder: (column) => column); - GeneratedColumn get tokenAcquiredAt => - $composableBuilder(column: $table.tokenAcquiredAt, builder: (column) => column); + GeneratedColumn get tokenAcquiredAt => $composableBuilder( + column: $table.tokenAcquiredAt, + builder: (column) => column, + ); - GeneratedColumn get lastUsedAt => $composableBuilder(column: $table.lastUsedAt, builder: (column) => column); + GeneratedColumn get lastUsedAt => $composableBuilder( + column: $table.lastUsedAt, + builder: (column) => column, + ); $$ConnectionsTableAnnotationComposer get connectionId { final $$ConnectionsTableAnnotationComposer composer = $composerBuilder( @@ -6368,13 +7933,18 @@ class $$ProfileConnectionsTableAnnotationComposer extends Composer<_$AppDatabase getCurrentColumn: (t) => t.connectionId, referencedTable: $db.connections, getReferencedColumn: (t) => t.id, - builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => - $$ConnectionsTableAnnotationComposer( + builder: + ( + joinBuilder, { + $addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer, + }) => $$ConnectionsTableAnnotationComposer( $db: $db, $table: $db.connections, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, ), ); return composer; @@ -6396,14 +7966,22 @@ class $$ProfileConnectionsTableTableManager ProfileConnectionRow, PrefetchHooks Function({bool connectionId}) > { - $$ProfileConnectionsTableTableManager(_$AppDatabase db, $ProfileConnectionsTable table) - : super( + $$ProfileConnectionsTableTableManager( + _$AppDatabase db, + $ProfileConnectionsTable table, + ) : super( TableManagerState( db: db, table: table, - createFilteringComposer: () => $$ProfileConnectionsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => $$ProfileConnectionsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => $$ProfileConnectionsTableAnnotationComposer($db: db, $table: table), + createFilteringComposer: () => + $$ProfileConnectionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ProfileConnectionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$ProfileConnectionsTableAnnotationComposer( + $db: db, + $table: table, + ), updateCompanionCallback: ({ Value profileId = const Value.absent(), @@ -6444,8 +8022,14 @@ class $$ProfileConnectionsTableTableManager lastUsedAt: lastUsedAt, rowid: rowid, ), - withReferenceMapper: (p0) => - p0.map((e) => (e.readTable(table), $$ProfileConnectionsTableReferences(db, table, e))).toList(), + withReferenceMapper: (p0) => p0 + .map( + (e) => ( + e.readTable(table), + $$ProfileConnectionsTableReferences(db, table, e), + ), + ) + .toList(), prefetchHooksCallback: ({connectionId = false}) { return PrefetchHooks( db: db, @@ -6471,8 +8055,13 @@ class $$ProfileConnectionsTableTableManager state.withJoin( currentTable: table, currentColumn: table.connectionId, - referencedTable: $$ProfileConnectionsTableReferences._connectionIdTable(db), - referencedColumn: $$ProfileConnectionsTableReferences._connectionIdTable(db).id, + referencedTable: + $$ProfileConnectionsTableReferences + ._connectionIdTable(db), + referencedColumn: + $$ProfileConnectionsTableReferences + ._connectionIdTable(db) + .id, ) as T; } @@ -6508,14 +8097,20 @@ class $AppDatabaseManager { $AppDatabaseManager(this._db); $$DownloadedMediaTableTableManager get downloadedMedia => $$DownloadedMediaTableTableManager(_db, _db.downloadedMedia); - $$DownloadOwnersTableTableManager get downloadOwners => $$DownloadOwnersTableTableManager(_db, _db.downloadOwners); - $$DownloadQueueTableTableManager get downloadQueue => $$DownloadQueueTableTableManager(_db, _db.downloadQueue); - $$ApiCacheTableTableManager get apiCache => $$ApiCacheTableTableManager(_db, _db.apiCache); + $$DownloadOwnersTableTableManager get downloadOwners => + $$DownloadOwnersTableTableManager(_db, _db.downloadOwners); + $$DownloadQueueTableTableManager get downloadQueue => + $$DownloadQueueTableTableManager(_db, _db.downloadQueue); + $$ApiCacheTableTableManager get apiCache => + $$ApiCacheTableTableManager(_db, _db.apiCache); $$OfflineWatchProgressTableTableManager get offlineWatchProgress => $$OfflineWatchProgressTableTableManager(_db, _db.offlineWatchProgress); - $$SyncRulesTableTableManager get syncRules => $$SyncRulesTableTableManager(_db, _db.syncRules); - $$ConnectionsTableTableManager get connections => $$ConnectionsTableTableManager(_db, _db.connections); - $$ProfilesTableTableManager get profiles => $$ProfilesTableTableManager(_db, _db.profiles); + $$SyncRulesTableTableManager get syncRules => + $$SyncRulesTableTableManager(_db, _db.syncRules); + $$ConnectionsTableTableManager get connections => + $$ConnectionsTableTableManager(_db, _db.connections); + $$ProfilesTableTableManager get profiles => + $$ProfilesTableTableManager(_db, _db.profiles); $$ProfileConnectionsTableTableManager get profileConnections => $$ProfileConnectionsTableTableManager(_db, _db.profileConnections); } diff --git a/lib/media/media_filter.g.dart b/lib/media/media_filter.g.dart index a1844e56..8086ec91 100644 --- a/lib/media/media_filter.g.dart +++ b/lib/media/media_filter.g.dart @@ -14,22 +14,25 @@ MediaFilter _$MediaFilterFromJson(Map json) => MediaFilter( type: json['type'] as String? ?? 'filter', ); -Map _$MediaFilterToJson(MediaFilter instance) => { - 'filter': instance.filter, - 'filterType': instance.filterType, - 'key': instance.key, - 'title': instance.title, - 'type': instance.type, -}; +Map _$MediaFilterToJson(MediaFilter instance) => + { + 'filter': instance.filter, + 'filterType': instance.filterType, + 'key': instance.key, + 'title': instance.title, + 'type': instance.type, + }; -MediaFilterValue _$MediaFilterValueFromJson(Map json) => MediaFilterValue( - key: json['key'] as String? ?? '', - title: json['title'] as String? ?? '', - type: json['type'] as String?, -); +MediaFilterValue _$MediaFilterValueFromJson(Map json) => + MediaFilterValue( + key: json['key'] as String? ?? '', + title: json['title'] as String? ?? '', + type: json['type'] as String?, + ); -Map _$MediaFilterValueToJson(MediaFilterValue instance) => { - 'key': instance.key, - 'title': instance.title, - 'type': ?instance.type, -}; +Map _$MediaFilterValueToJson(MediaFilterValue instance) => + { + 'key': instance.key, + 'title': instance.title, + 'type': ?instance.type, + }; diff --git a/lib/media/media_item.dart b/lib/media/media_item.dart index 6fadda54..eb3e1bee 100644 --- a/lib/media/media_item.dart +++ b/lib/media/media_item.dart @@ -1,13 +1,503 @@ +// ignore_for_file: invalid_annotation_target + +import 'package:freezed_annotation/freezed_annotation.dart'; + import '../services/settings_service.dart' show EpisodePosterMode; import '../utils/global_key_utils.dart'; import '../utils/json_utils.dart'; import 'media_backend.dart'; import 'media_kind.dart'; -import 'media_part.dart'; import 'media_role.dart'; import 'media_version.dart'; -part 'media_item/base.dart'; -part 'media_item/json.dart'; -part 'media_item/plex.dart'; -part 'media_item/jellyfin.dart'; +part 'media_item.freezed.dart'; +part 'media_item.g.dart'; + +/// Backend-neutral media item shape used by UI, providers, persistence, and +/// playback. Concrete variants retain backend-only fields without forcing the +/// rest of the app to traffic in Plex/Jellyfin DTOs. +@Freezed(unionKey: 'backend', unionValueCase: FreezedUnionCase.none, equal: false, makeCollectionsUnmodifiable: false) +sealed class MediaItem with _$MediaItem { + const MediaItem._(); + + /// Backend-dispatching compatibility factory used by existing call sites. + factory MediaItem({ + required String id, + required MediaBackend backend, + required MediaKind kind, + String? guid, + String? title, + String? titleSort, + String? summary, + String? tagline, + String? originalTitle, + String? studio, + int? year, + String? originallyAvailableAt, + String? contentRating, + String? parentId, + String? parentTitle, + String? parentThumbPath, + int? parentIndex, + int? index, + String? grandparentId, + String? grandparentTitle, + String? grandparentThumbPath, + String? grandparentArtPath, + String? thumbPath, + String? artPath, + String? clearLogoPath, + String? backgroundSquarePath, + int? durationMs, + int? viewOffsetMs, + int? viewCount, + int? lastViewedAt, + int? leafCount, + int? viewedLeafCount, + int? childCount, + int? addedAt, + int? updatedAt, + double? rating, + double? userRating, + List? genres, + List? directors, + List? writers, + List? producers, + List? countries, + List? collections, + List? labels, + List? styles, + List? moods, + List? roles, + List? mediaVersions, + String? libraryId, + String? libraryTitle, + String? audioLanguage, + String? subtitleLanguage, + int? subtitleMode, + String? serverId, + String? serverName, + Map? raw, + }) { + return switch (backend) { + MediaBackend.plex => PlexMediaItem( + id: id, + kind: kind, + guid: guid, + title: title, + titleSort: titleSort, + summary: summary, + tagline: tagline, + originalTitle: originalTitle, + studio: studio, + year: year, + originallyAvailableAt: originallyAvailableAt, + contentRating: contentRating, + parentId: parentId, + parentTitle: parentTitle, + parentThumbPath: parentThumbPath, + parentIndex: parentIndex, + index: index, + grandparentId: grandparentId, + grandparentTitle: grandparentTitle, + grandparentThumbPath: grandparentThumbPath, + grandparentArtPath: grandparentArtPath, + thumbPath: thumbPath, + artPath: artPath, + clearLogoPath: clearLogoPath, + backgroundSquarePath: backgroundSquarePath, + durationMs: durationMs, + viewOffsetMs: viewOffsetMs, + viewCount: viewCount, + lastViewedAt: lastViewedAt, + leafCount: leafCount, + viewedLeafCount: viewedLeafCount, + childCount: childCount, + addedAt: addedAt, + updatedAt: updatedAt, + rating: rating, + userRating: userRating, + genres: genres, + directors: directors, + writers: writers, + producers: producers, + countries: countries, + collections: collections, + labels: labels, + styles: styles, + moods: moods, + roles: roles, + mediaVersions: mediaVersions, + libraryId: libraryId, + libraryTitle: libraryTitle, + audioLanguage: audioLanguage, + subtitleLanguage: subtitleLanguage, + subtitleMode: subtitleMode, + serverId: serverId, + serverName: serverName, + raw: raw, + ), + MediaBackend.jellyfin => JellyfinMediaItem( + id: id, + kind: kind, + guid: guid, + title: title, + titleSort: titleSort, + summary: summary, + tagline: tagline, + originalTitle: originalTitle, + studio: studio, + year: year, + originallyAvailableAt: originallyAvailableAt, + contentRating: contentRating, + parentId: parentId, + parentTitle: parentTitle, + parentThumbPath: parentThumbPath, + parentIndex: parentIndex, + index: index, + grandparentId: grandparentId, + grandparentTitle: grandparentTitle, + grandparentThumbPath: grandparentThumbPath, + grandparentArtPath: grandparentArtPath, + thumbPath: thumbPath, + artPath: artPath, + clearLogoPath: clearLogoPath, + backgroundSquarePath: backgroundSquarePath, + durationMs: durationMs, + viewOffsetMs: viewOffsetMs, + viewCount: viewCount, + lastViewedAt: lastViewedAt, + leafCount: leafCount, + viewedLeafCount: viewedLeafCount, + childCount: childCount, + addedAt: addedAt, + updatedAt: updatedAt, + rating: rating, + userRating: userRating, + genres: genres, + directors: directors, + writers: writers, + producers: producers, + countries: countries, + collections: collections, + labels: labels, + styles: styles, + moods: moods, + roles: roles, + mediaVersions: mediaVersions, + libraryId: libraryId, + libraryTitle: libraryTitle, + audioLanguage: audioLanguage, + serverId: serverId, + serverName: serverName, + raw: raw, + ), + }; + } + + /// Backend-tagged concrete subclass for items sourced from a Plex server. + @FreezedUnionValue('plex') + @JsonSerializable(includeIfNull: false, explicitToJson: true) + const factory MediaItem.plex({ + @JsonKey(readValue: readStringField, defaultValue: '') required String id, + @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) required MediaKind kind, + String? guid, + String? title, + String? titleSort, + String? summary, + String? tagline, + String? originalTitle, + + /// Plex `editionTitle` distinguishes versions of the same movie. + String? editionTitle, + String? studio, + @JsonKey(fromJson: flexibleInt) int? year, + String? originallyAvailableAt, + String? contentRating, + String? parentId, + String? parentTitle, + String? parentThumbPath, + @JsonKey(fromJson: flexibleInt) int? parentIndex, + @JsonKey(fromJson: flexibleInt) int? index, + String? grandparentId, + String? grandparentTitle, + String? grandparentThumbPath, + String? grandparentArtPath, + String? thumbPath, + String? artPath, + String? clearLogoPath, + String? backgroundSquarePath, + @JsonKey(fromJson: flexibleInt) int? durationMs, + @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, + @JsonKey(fromJson: flexibleInt) int? viewCount, + @JsonKey(fromJson: flexibleInt) int? lastViewedAt, + @JsonKey(fromJson: flexibleInt) int? leafCount, + @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, + @JsonKey(fromJson: flexibleInt) int? childCount, + @JsonKey(fromJson: flexibleInt) int? addedAt, + @JsonKey(fromJson: flexibleInt) int? updatedAt, + @JsonKey(fromJson: flexibleDouble) double? rating, + @JsonKey(fromJson: flexibleDouble) double? audienceRating, + @JsonKey(fromJson: flexibleDouble) double? userRating, + String? ratingImage, + String? audienceRatingImage, + @JsonKey(fromJson: _mediaItemStringList) List? genres, + @JsonKey(fromJson: _mediaItemStringList) List? directors, + @JsonKey(fromJson: _mediaItemStringList) List? writers, + @JsonKey(fromJson: _mediaItemStringList) List? producers, + @JsonKey(fromJson: _mediaItemStringList) List? countries, + @JsonKey(fromJson: _mediaItemStringList) List? collections, + @JsonKey(fromJson: _mediaItemStringList) List? labels, + @JsonKey(fromJson: _mediaItemStringList) List? styles, + @JsonKey(fromJson: _mediaItemStringList) List? moods, + @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, + @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, + String? libraryId, + String? libraryTitle, + String? audioLanguage, + String? subtitleLanguage, + @JsonKey(fromJson: flexibleInt) int? subtitleMode, + String? trailerKey, + @JsonKey(fromJson: flexibleInt) int? playlistItemId, + @JsonKey(fromJson: flexibleInt) int? playQueueItemId, + String? subtype, + @JsonKey(fromJson: flexibleInt) int? extraType, + String? serverId, + String? serverName, + @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw, + }) = PlexMediaItem; + + /// Backend-tagged concrete subclass for items sourced from a Jellyfin server. + @FreezedUnionValue('jellyfin') + @JsonSerializable(includeIfNull: false, explicitToJson: true) + const factory MediaItem.jellyfin({ + @JsonKey(readValue: readStringField, defaultValue: '') required String id, + @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) required MediaKind kind, + String? guid, + String? title, + String? titleSort, + String? summary, + String? tagline, + String? originalTitle, + String? studio, + @JsonKey(fromJson: flexibleInt) int? year, + String? originallyAvailableAt, + String? contentRating, + String? parentId, + String? parentTitle, + String? parentThumbPath, + @JsonKey(fromJson: flexibleInt) int? parentIndex, + @JsonKey(fromJson: flexibleInt) int? index, + String? grandparentId, + String? grandparentTitle, + String? grandparentThumbPath, + String? grandparentArtPath, + String? thumbPath, + String? artPath, + String? clearLogoPath, + String? backgroundSquarePath, + @JsonKey(fromJson: flexibleInt) int? durationMs, + @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, + @JsonKey(fromJson: flexibleInt) int? viewCount, + @JsonKey(fromJson: flexibleInt) int? lastViewedAt, + @JsonKey(fromJson: flexibleInt) int? leafCount, + @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, + @JsonKey(fromJson: flexibleInt) int? childCount, + @JsonKey(fromJson: flexibleInt) int? addedAt, + @JsonKey(fromJson: flexibleInt) int? updatedAt, + @JsonKey(fromJson: flexibleDouble) double? rating, + @JsonKey(fromJson: flexibleDouble) double? userRating, + @JsonKey(fromJson: _mediaItemStringList) List? genres, + @JsonKey(fromJson: _mediaItemStringList) List? directors, + @JsonKey(fromJson: _mediaItemStringList) List? writers, + @JsonKey(fromJson: _mediaItemStringList) List? producers, + @JsonKey(fromJson: _mediaItemStringList) List? countries, + @JsonKey(fromJson: _mediaItemStringList) List? collections, + @JsonKey(fromJson: _mediaItemStringList) List? labels, + @JsonKey(fromJson: _mediaItemStringList) List? styles, + @JsonKey(fromJson: _mediaItemStringList) List? moods, + @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, + @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, + String? libraryId, + String? libraryTitle, + String? audioLanguage, + + /// Jellyfin playlist entry id used by playlist write endpoints. + String? playlistItemId, + String? serverId, + String? serverName, + @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw, + }) = JellyfinMediaItem; + + MediaBackend get backend => switch (this) { + PlexMediaItem() => MediaBackend.plex, + JellyfinMediaItem() => MediaBackend.jellyfin, + }; + + /// Restore a [MediaItem] from a [toJson] payload. Missing/unknown backend + /// values use [MediaBackend.fromString] so old offline cache rows remain + /// readable instead of throwing before union dispatch. + factory MediaItem.fromJson(Map json) { + return switch (MediaBackend.fromString(json['backend'] as String?)) { + MediaBackend.plex => _$PlexMediaItemFromJson(json), + MediaBackend.jellyfin => _$JellyfinMediaItemFromJson(json), + }; + } + + Map toJson() { + return switch (this) { + final PlexMediaItem item => {'backend': MediaBackend.plex.id, ..._$PlexMediaItemToJson(item)}, + final JellyfinMediaItem item => {'backend': MediaBackend.jellyfin.id, ..._$JellyfinMediaItemToJson(item)}, + }; + } + + /// Global unique identifier across all servers (`serverId:id`). Falls back + /// to bare [id] if [serverId] is missing. + String get globalKey => serverId != null ? buildGlobalKey(serverId!, id) : id; + + /// Global unique identifier of this item's library section. + String? get libraryGlobalKey => serverId != null && libraryId != null ? buildGlobalKey(serverId!, libraryId!) : null; + + /// Parent rating keys for hierarchical invalidation. For an episode: + /// `[seasonId, showId]`. For a season: `[showId]`. For a movie: `[]`. + List get parentChain => [?parentId, ?grandparentId]; + + /// Whether this item has started but not finished playback. + bool get hasActiveProgress { + if (durationMs == null || viewOffsetMs == null) return false; + return viewOffsetMs! > 0 && viewOffsetMs! < durationMs!; + } + + /// Whether this container (show/season) has some but not all leaves watched. + bool get isPartiallyWatched => + viewedLeafCount != null && leafCount != null && viewedLeafCount! > 0 && viewedLeafCount! < leafCount!; + + /// Whether the item is fully watched. Series/seasons consult leaf counts; + /// individual movies/episodes use [viewCount]. + bool get isWatched { + if (leafCount != null && viewedLeafCount != null) { + return viewedLeafCount! >= leafCount!; + } + return viewCount != null && viewCount! > 0; + } + + /// Display-friendly title that prefers the show name for episodes/seasons. + String get displayTitle { + if ((kind == MediaKind.episode || kind == MediaKind.season) && grandparentTitle != null) { + return grandparentTitle!; + } + if (kind == MediaKind.season && parentTitle != null) { + return parentTitle!; + } + return title ?? ''; + } + + /// Subtitle line shown below [displayTitle] for episodes/seasons. + String? get displaySubtitle { + if (kind == MediaKind.episode || kind == MediaKind.season) { + if (grandparentTitle != null || (kind == MediaKind.season && parentTitle != null)) { + return title; + } + } + return null; + } + + /// Plex-only edition label. Jellyfin returns null. + String? get editionTitle => null; + + /// Returns the appropriate poster path based on episode poster mode. + String? posterThumb({EpisodePosterMode mode = EpisodePosterMode.seriesPoster, bool mixedHubContext = false}) { + if (kind == MediaKind.episode) { + switch (mode) { + case EpisodePosterMode.episodeThumbnail: + return thumbPath; + case EpisodePosterMode.seasonPoster: + return parentThumbPath ?? grandparentThumbPath ?? thumbPath; + case EpisodePosterMode.seriesPoster: + return grandparentThumbPath ?? thumbPath; + } + } else if (kind == MediaKind.season) { + if (mixedHubContext && mode == EpisodePosterMode.episodeThumbnail) { + return artPath ?? thumbPath; + } + if (grandparentThumbPath != null) { + return grandparentThumbPath; + } + } + + if (mixedHubContext && + mode == EpisodePosterMode.episodeThumbnail && + (kind == MediaKind.movie || kind == MediaKind.show)) { + return artPath ?? thumbPath; + } + + return thumbPath; + } + + /// Secondary poster path to try when [posterThumb] returns an image URL that + /// exists syntactically but the server cannot serve it. + String? posterThumbFallback({EpisodePosterMode mode = EpisodePosterMode.seriesPoster, bool mixedHubContext = false}) { + if (kind != MediaKind.episode || mode != EpisodePosterMode.seasonPoster) return null; + final fallback = grandparentThumbPath ?? thumbPath; + return fallback != null && fallback != posterThumb(mode: mode, mixedHubContext: mixedHubContext) ? fallback : null; + } + + /// True when the item should render in 16:9. + bool usesWideAspectRatio(EpisodePosterMode mode, {bool mixedHubContext = false}) { + if (kind == MediaKind.clip) return true; + if (kind == MediaKind.episode && mode == EpisodePosterMode.episodeThumbnail) { + return true; + } + if (mixedHubContext && + mode == EpisodePosterMode.episodeThumbnail && + (kind == MediaKind.movie || kind == MediaKind.show || kind == MediaKind.season)) { + return true; + } + return false; + } + + /// Returns the best hero art path based on the container's aspect ratio. + String? heroArt({required double containerAspectRatio}) { + final candidates = heroArtCandidates(containerAspectRatio: containerAspectRatio); + if (candidates.isEmpty) return null; + return candidates.first; + } + + /// Returns hero art candidates in display-preference order. + List heroArtCandidates({required double containerAspectRatio}) { + final preferred = containerAspectRatio < 1.39 ? [backgroundSquarePath, artPath] : [artPath, backgroundSquarePath]; + + final candidates = []; + for (final path in preferred) { + if (path == null || path.isEmpty || candidates.contains(path)) continue; + candidates.add(path); + } + return candidates; + } +} + +MediaKind _mediaKindFromJson(Object? raw) => MediaKind.fromString(raw as String?); + +String _mediaKindToJson(MediaKind kind) => kind.id; + +List? _mediaItemStringList(Object? raw) => stringListFromRaw(raw, stringify: true); + +List? _mediaItemRolesFromJson(Object? raw) { + return raw is List + ? [ + for (final role in raw) + if (role is Map) MediaRole.fromJson(role), + ] + : null; +} + +List? _mediaItemVersionsFromJson(Object? raw) { + return raw is List + ? [ + for (final version in raw) + if (version is Map) MediaVersion.fromJson(version), + ] + : null; +} + +Map? _mediaItemRawFromJson(Object? raw) => raw is Map ? Map.from(raw) : null; diff --git a/lib/media/media_item.freezed.dart b/lib/media/media_item.freezed.dart new file mode 100644 index 00000000..7ce1e04c --- /dev/null +++ b/lib/media/media_item.freezed.dart @@ -0,0 +1,603 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file +// ignore_for_file: type=lint +// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark + +part of 'media_item.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +/// @nodoc +mixin _$MediaItem { + +@JsonKey(readValue: readStringField, defaultValue: '') String get id;@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind get kind; String? get guid; String? get title; String? get titleSort; String? get summary; String? get tagline; String? get originalTitle; String? get studio;@JsonKey(fromJson: flexibleInt) int? get year; String? get originallyAvailableAt; String? get contentRating; String? get parentId; String? get parentTitle; String? get parentThumbPath;@JsonKey(fromJson: flexibleInt) int? get parentIndex;@JsonKey(fromJson: flexibleInt) int? get index; String? get grandparentId; String? get grandparentTitle; String? get grandparentThumbPath; String? get grandparentArtPath; String? get thumbPath; String? get artPath; String? get clearLogoPath; String? get backgroundSquarePath;@JsonKey(fromJson: flexibleInt) int? get durationMs;@JsonKey(fromJson: flexibleInt) int? get viewOffsetMs;@JsonKey(fromJson: flexibleInt) int? get viewCount;@JsonKey(fromJson: flexibleInt) int? get lastViewedAt;@JsonKey(fromJson: flexibleInt) int? get leafCount;@JsonKey(fromJson: flexibleInt) int? get viewedLeafCount;@JsonKey(fromJson: flexibleInt) int? get childCount;@JsonKey(fromJson: flexibleInt) int? get addedAt;@JsonKey(fromJson: flexibleInt) int? get updatedAt;@JsonKey(fromJson: flexibleDouble) double? get rating;@JsonKey(fromJson: flexibleDouble) double? get userRating;@JsonKey(fromJson: _mediaItemStringList) List? get genres;@JsonKey(fromJson: _mediaItemStringList) List? get directors;@JsonKey(fromJson: _mediaItemStringList) List? get writers;@JsonKey(fromJson: _mediaItemStringList) List? get producers;@JsonKey(fromJson: _mediaItemStringList) List? get countries;@JsonKey(fromJson: _mediaItemStringList) List? get collections;@JsonKey(fromJson: _mediaItemStringList) List? get labels;@JsonKey(fromJson: _mediaItemStringList) List? get styles;@JsonKey(fromJson: _mediaItemStringList) List? get moods;@JsonKey(fromJson: _mediaItemRolesFromJson) List? get roles;@JsonKey(fromJson: _mediaItemVersionsFromJson) List? get mediaVersions; String? get libraryId; String? get libraryTitle; String? get audioLanguage;/// Jellyfin playlist entry id used by playlist write endpoints. +@JsonKey(fromJson: flexibleInt) Object? get playlistItemId; String? get serverId; String? get serverName;@JsonKey(fromJson: _mediaItemRawFromJson) Map? get raw; +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$MediaItemCopyWith get copyWith => _$MediaItemCopyWithImpl(this as MediaItem, _$identity); + + + + + +@override +String toString() { + return 'MediaItem(id: $id, kind: $kind, guid: $guid, title: $title, titleSort: $titleSort, summary: $summary, tagline: $tagline, originalTitle: $originalTitle, studio: $studio, year: $year, originallyAvailableAt: $originallyAvailableAt, contentRating: $contentRating, parentId: $parentId, parentTitle: $parentTitle, parentThumbPath: $parentThumbPath, parentIndex: $parentIndex, index: $index, grandparentId: $grandparentId, grandparentTitle: $grandparentTitle, grandparentThumbPath: $grandparentThumbPath, grandparentArtPath: $grandparentArtPath, thumbPath: $thumbPath, artPath: $artPath, clearLogoPath: $clearLogoPath, backgroundSquarePath: $backgroundSquarePath, durationMs: $durationMs, viewOffsetMs: $viewOffsetMs, viewCount: $viewCount, lastViewedAt: $lastViewedAt, leafCount: $leafCount, viewedLeafCount: $viewedLeafCount, childCount: $childCount, addedAt: $addedAt, updatedAt: $updatedAt, rating: $rating, userRating: $userRating, genres: $genres, directors: $directors, writers: $writers, producers: $producers, countries: $countries, collections: $collections, labels: $labels, styles: $styles, moods: $moods, roles: $roles, mediaVersions: $mediaVersions, libraryId: $libraryId, libraryTitle: $libraryTitle, audioLanguage: $audioLanguage, playlistItemId: $playlistItemId, serverId: $serverId, serverName: $serverName, raw: $raw)'; +} + + +} + +/// @nodoc +abstract mixin class $MediaItemCopyWith<$Res> { + factory $MediaItemCopyWith(MediaItem value, $Res Function(MediaItem) _then) = _$MediaItemCopyWithImpl; +@useResult +$Res call({ +@JsonKey(readValue: readStringField, defaultValue: '') String id,@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? studio,@JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath,@JsonKey(fromJson: flexibleInt) int? parentIndex,@JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath,@JsonKey(fromJson: flexibleInt) int? durationMs,@JsonKey(fromJson: flexibleInt) int? viewOffsetMs,@JsonKey(fromJson: flexibleInt) int? viewCount,@JsonKey(fromJson: flexibleInt) int? lastViewedAt,@JsonKey(fromJson: flexibleInt) int? leafCount,@JsonKey(fromJson: flexibleInt) int? viewedLeafCount,@JsonKey(fromJson: flexibleInt) int? childCount,@JsonKey(fromJson: flexibleInt) int? addedAt,@JsonKey(fromJson: flexibleInt) int? updatedAt,@JsonKey(fromJson: flexibleDouble) double? rating,@JsonKey(fromJson: flexibleDouble) double? userRating,@JsonKey(fromJson: _mediaItemStringList) List? genres,@JsonKey(fromJson: _mediaItemStringList) List? directors,@JsonKey(fromJson: _mediaItemStringList) List? writers,@JsonKey(fromJson: _mediaItemStringList) List? producers,@JsonKey(fromJson: _mediaItemStringList) List? countries,@JsonKey(fromJson: _mediaItemStringList) List? collections,@JsonKey(fromJson: _mediaItemStringList) List? labels,@JsonKey(fromJson: _mediaItemStringList) List? styles,@JsonKey(fromJson: _mediaItemStringList) List? moods,@JsonKey(fromJson: _mediaItemRolesFromJson) List? roles,@JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? serverId, String? serverName,@JsonKey(fromJson: _mediaItemRawFromJson) Map? raw +}); + + + + +} +/// @nodoc +class _$MediaItemCopyWithImpl<$Res> + implements $MediaItemCopyWith<$Res> { + _$MediaItemCopyWithImpl(this._self, this._then); + + final MediaItem _self; + final $Res Function(MediaItem) _then; + +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? kind = null,Object? guid = freezed,Object? title = freezed,Object? titleSort = freezed,Object? summary = freezed,Object? tagline = freezed,Object? originalTitle = freezed,Object? studio = freezed,Object? year = freezed,Object? originallyAvailableAt = freezed,Object? contentRating = freezed,Object? parentId = freezed,Object? parentTitle = freezed,Object? parentThumbPath = freezed,Object? parentIndex = freezed,Object? index = freezed,Object? grandparentId = freezed,Object? grandparentTitle = freezed,Object? grandparentThumbPath = freezed,Object? grandparentArtPath = freezed,Object? thumbPath = freezed,Object? artPath = freezed,Object? clearLogoPath = freezed,Object? backgroundSquarePath = freezed,Object? durationMs = freezed,Object? viewOffsetMs = freezed,Object? viewCount = freezed,Object? lastViewedAt = freezed,Object? leafCount = freezed,Object? viewedLeafCount = freezed,Object? childCount = freezed,Object? addedAt = freezed,Object? updatedAt = freezed,Object? rating = freezed,Object? userRating = freezed,Object? genres = freezed,Object? directors = freezed,Object? writers = freezed,Object? producers = freezed,Object? countries = freezed,Object? collections = freezed,Object? labels = freezed,Object? styles = freezed,Object? moods = freezed,Object? roles = freezed,Object? mediaVersions = freezed,Object? libraryId = freezed,Object? libraryTitle = freezed,Object? audioLanguage = freezed,Object? serverId = freezed,Object? serverName = freezed,Object? raw = freezed,}) { + return _then(_self.copyWith( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,kind: null == kind ? _self.kind : kind // ignore: cast_nullable_to_non_nullable +as MediaKind,guid: freezed == guid ? _self.guid : guid // ignore: cast_nullable_to_non_nullable +as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String?,titleSort: freezed == titleSort ? _self.titleSort : titleSort // ignore: cast_nullable_to_non_nullable +as String?,summary: freezed == summary ? _self.summary : summary // ignore: cast_nullable_to_non_nullable +as String?,tagline: freezed == tagline ? _self.tagline : tagline // ignore: cast_nullable_to_non_nullable +as String?,originalTitle: freezed == originalTitle ? _self.originalTitle : originalTitle // ignore: cast_nullable_to_non_nullable +as String?,studio: freezed == studio ? _self.studio : studio // ignore: cast_nullable_to_non_nullable +as String?,year: freezed == year ? _self.year : year // ignore: cast_nullable_to_non_nullable +as int?,originallyAvailableAt: freezed == originallyAvailableAt ? _self.originallyAvailableAt : originallyAvailableAt // ignore: cast_nullable_to_non_nullable +as String?,contentRating: freezed == contentRating ? _self.contentRating : contentRating // ignore: cast_nullable_to_non_nullable +as String?,parentId: freezed == parentId ? _self.parentId : parentId // ignore: cast_nullable_to_non_nullable +as String?,parentTitle: freezed == parentTitle ? _self.parentTitle : parentTitle // ignore: cast_nullable_to_non_nullable +as String?,parentThumbPath: freezed == parentThumbPath ? _self.parentThumbPath : parentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,parentIndex: freezed == parentIndex ? _self.parentIndex : parentIndex // ignore: cast_nullable_to_non_nullable +as int?,index: freezed == index ? _self.index : index // ignore: cast_nullable_to_non_nullable +as int?,grandparentId: freezed == grandparentId ? _self.grandparentId : grandparentId // ignore: cast_nullable_to_non_nullable +as String?,grandparentTitle: freezed == grandparentTitle ? _self.grandparentTitle : grandparentTitle // ignore: cast_nullable_to_non_nullable +as String?,grandparentThumbPath: freezed == grandparentThumbPath ? _self.grandparentThumbPath : grandparentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,grandparentArtPath: freezed == grandparentArtPath ? _self.grandparentArtPath : grandparentArtPath // ignore: cast_nullable_to_non_nullable +as String?,thumbPath: freezed == thumbPath ? _self.thumbPath : thumbPath // ignore: cast_nullable_to_non_nullable +as String?,artPath: freezed == artPath ? _self.artPath : artPath // ignore: cast_nullable_to_non_nullable +as String?,clearLogoPath: freezed == clearLogoPath ? _self.clearLogoPath : clearLogoPath // ignore: cast_nullable_to_non_nullable +as String?,backgroundSquarePath: freezed == backgroundSquarePath ? _self.backgroundSquarePath : backgroundSquarePath // ignore: cast_nullable_to_non_nullable +as String?,durationMs: freezed == durationMs ? _self.durationMs : durationMs // ignore: cast_nullable_to_non_nullable +as int?,viewOffsetMs: freezed == viewOffsetMs ? _self.viewOffsetMs : viewOffsetMs // ignore: cast_nullable_to_non_nullable +as int?,viewCount: freezed == viewCount ? _self.viewCount : viewCount // ignore: cast_nullable_to_non_nullable +as int?,lastViewedAt: freezed == lastViewedAt ? _self.lastViewedAt : lastViewedAt // ignore: cast_nullable_to_non_nullable +as int?,leafCount: freezed == leafCount ? _self.leafCount : leafCount // ignore: cast_nullable_to_non_nullable +as int?,viewedLeafCount: freezed == viewedLeafCount ? _self.viewedLeafCount : viewedLeafCount // ignore: cast_nullable_to_non_nullable +as int?,childCount: freezed == childCount ? _self.childCount : childCount // ignore: cast_nullable_to_non_nullable +as int?,addedAt: freezed == addedAt ? _self.addedAt : addedAt // ignore: cast_nullable_to_non_nullable +as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?,rating: freezed == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable +as double?,userRating: freezed == userRating ? _self.userRating : userRating // ignore: cast_nullable_to_non_nullable +as double?,genres: freezed == genres ? _self.genres : genres // ignore: cast_nullable_to_non_nullable +as List?,directors: freezed == directors ? _self.directors : directors // ignore: cast_nullable_to_non_nullable +as List?,writers: freezed == writers ? _self.writers : writers // ignore: cast_nullable_to_non_nullable +as List?,producers: freezed == producers ? _self.producers : producers // ignore: cast_nullable_to_non_nullable +as List?,countries: freezed == countries ? _self.countries : countries // ignore: cast_nullable_to_non_nullable +as List?,collections: freezed == collections ? _self.collections : collections // ignore: cast_nullable_to_non_nullable +as List?,labels: freezed == labels ? _self.labels : labels // ignore: cast_nullable_to_non_nullable +as List?,styles: freezed == styles ? _self.styles : styles // ignore: cast_nullable_to_non_nullable +as List?,moods: freezed == moods ? _self.moods : moods // ignore: cast_nullable_to_non_nullable +as List?,roles: freezed == roles ? _self.roles : roles // ignore: cast_nullable_to_non_nullable +as List?,mediaVersions: freezed == mediaVersions ? _self.mediaVersions : mediaVersions // ignore: cast_nullable_to_non_nullable +as List?,libraryId: freezed == libraryId ? _self.libraryId : libraryId // ignore: cast_nullable_to_non_nullable +as String?,libraryTitle: freezed == libraryTitle ? _self.libraryTitle : libraryTitle // ignore: cast_nullable_to_non_nullable +as String?,audioLanguage: freezed == audioLanguage ? _self.audioLanguage : audioLanguage // ignore: cast_nullable_to_non_nullable +as String?,serverId: freezed == serverId ? _self.serverId : serverId // ignore: cast_nullable_to_non_nullable +as String?,serverName: freezed == serverName ? _self.serverName : serverName // ignore: cast_nullable_to_non_nullable +as String?,raw: freezed == raw ? _self.raw : raw // ignore: cast_nullable_to_non_nullable +as Map?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [MediaItem]. +extension MediaItemPatterns on MediaItem { +/// A variant of `map` that fallback to returning `orElse`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeMap({TResult Function( PlexMediaItem value)? plex,TResult Function( JellyfinMediaItem value)? jellyfin,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case PlexMediaItem() when plex != null: +return plex(_that);case JellyfinMediaItem() when jellyfin != null: +return jellyfin(_that);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// Callbacks receives the raw object, upcasted. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case final Subclass2 value: +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult map({required TResult Function( PlexMediaItem value) plex,required TResult Function( JellyfinMediaItem value) jellyfin,}){ +final _that = this; +switch (_that) { +case PlexMediaItem(): +return plex(_that);case JellyfinMediaItem(): +return jellyfin(_that);} +} +/// A variant of `map` that fallback to returning `null`. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case final Subclass value: +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? mapOrNull({TResult? Function( PlexMediaItem value)? plex,TResult? Function( JellyfinMediaItem value)? jellyfin,}){ +final _that = this; +switch (_that) { +case PlexMediaItem() when plex != null: +return plex(_that);case JellyfinMediaItem() when jellyfin != null: +return jellyfin(_that);case _: + return null; + +} +} +/// A variant of `when` that fallback to an `orElse` callback. +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return orElse(); +/// } +/// ``` + +@optionalTypeArgs TResult maybeWhen({TResult Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? editionTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? audienceRating, @JsonKey(fromJson: flexibleDouble) double? userRating, String? ratingImage, String? audienceRatingImage, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? subtitleLanguage, @JsonKey(fromJson: flexibleInt) int? subtitleMode, String? trailerKey, @JsonKey(fromJson: flexibleInt) int? playlistItemId, @JsonKey(fromJson: flexibleInt) int? playQueueItemId, String? subtype, @JsonKey(fromJson: flexibleInt) int? extraType, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw)? plex,TResult Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? userRating, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? playlistItemId, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw)? jellyfin,required TResult orElse(),}) {final _that = this; +switch (_that) { +case PlexMediaItem() when plex != null: +return plex(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.editionTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.audienceRating,_that.userRating,_that.ratingImage,_that.audienceRatingImage,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.subtitleLanguage,_that.subtitleMode,_that.trailerKey,_that.playlistItemId,_that.playQueueItemId,_that.subtype,_that.extraType,_that.serverId,_that.serverName,_that.raw);case JellyfinMediaItem() when jellyfin != null: +return jellyfin(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.userRating,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.playlistItemId,_that.serverId,_that.serverName,_that.raw);case _: + return orElse(); + +} +} +/// A `switch`-like method, using callbacks. +/// +/// As opposed to `map`, this offers destructuring. +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case Subclass2(:final field2): +/// return ...; +/// } +/// ``` + +@optionalTypeArgs TResult when({required TResult Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? editionTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? audienceRating, @JsonKey(fromJson: flexibleDouble) double? userRating, String? ratingImage, String? audienceRatingImage, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? subtitleLanguage, @JsonKey(fromJson: flexibleInt) int? subtitleMode, String? trailerKey, @JsonKey(fromJson: flexibleInt) int? playlistItemId, @JsonKey(fromJson: flexibleInt) int? playQueueItemId, String? subtype, @JsonKey(fromJson: flexibleInt) int? extraType, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw) plex,required TResult Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? userRating, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? playlistItemId, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw) jellyfin,}) {final _that = this; +switch (_that) { +case PlexMediaItem(): +return plex(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.editionTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.audienceRating,_that.userRating,_that.ratingImage,_that.audienceRatingImage,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.subtitleLanguage,_that.subtitleMode,_that.trailerKey,_that.playlistItemId,_that.playQueueItemId,_that.subtype,_that.extraType,_that.serverId,_that.serverName,_that.raw);case JellyfinMediaItem(): +return jellyfin(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.userRating,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.playlistItemId,_that.serverId,_that.serverName,_that.raw);} +} +/// A variant of `when` that fallback to returning `null` +/// +/// It is equivalent to doing: +/// ```dart +/// switch (sealedClass) { +/// case Subclass(:final field): +/// return ...; +/// case _: +/// return null; +/// } +/// ``` + +@optionalTypeArgs TResult? whenOrNull({TResult? Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? editionTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? audienceRating, @JsonKey(fromJson: flexibleDouble) double? userRating, String? ratingImage, String? audienceRatingImage, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? subtitleLanguage, @JsonKey(fromJson: flexibleInt) int? subtitleMode, String? trailerKey, @JsonKey(fromJson: flexibleInt) int? playlistItemId, @JsonKey(fromJson: flexibleInt) int? playQueueItemId, String? subtype, @JsonKey(fromJson: flexibleInt) int? extraType, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw)? plex,TResult? Function(@JsonKey(readValue: readStringField, defaultValue: '') String id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? studio, @JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath, @JsonKey(fromJson: flexibleInt) int? parentIndex, @JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath, @JsonKey(fromJson: flexibleInt) int? durationMs, @JsonKey(fromJson: flexibleInt) int? viewOffsetMs, @JsonKey(fromJson: flexibleInt) int? viewCount, @JsonKey(fromJson: flexibleInt) int? lastViewedAt, @JsonKey(fromJson: flexibleInt) int? leafCount, @JsonKey(fromJson: flexibleInt) int? viewedLeafCount, @JsonKey(fromJson: flexibleInt) int? childCount, @JsonKey(fromJson: flexibleInt) int? addedAt, @JsonKey(fromJson: flexibleInt) int? updatedAt, @JsonKey(fromJson: flexibleDouble) double? rating, @JsonKey(fromJson: flexibleDouble) double? userRating, @JsonKey(fromJson: _mediaItemStringList) List? genres, @JsonKey(fromJson: _mediaItemStringList) List? directors, @JsonKey(fromJson: _mediaItemStringList) List? writers, @JsonKey(fromJson: _mediaItemStringList) List? producers, @JsonKey(fromJson: _mediaItemStringList) List? countries, @JsonKey(fromJson: _mediaItemStringList) List? collections, @JsonKey(fromJson: _mediaItemStringList) List? labels, @JsonKey(fromJson: _mediaItemStringList) List? styles, @JsonKey(fromJson: _mediaItemStringList) List? moods, @JsonKey(fromJson: _mediaItemRolesFromJson) List? roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? playlistItemId, String? serverId, String? serverName, @JsonKey(fromJson: _mediaItemRawFromJson) Map? raw)? jellyfin,}) {final _that = this; +switch (_that) { +case PlexMediaItem() when plex != null: +return plex(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.editionTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.audienceRating,_that.userRating,_that.ratingImage,_that.audienceRatingImage,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.subtitleLanguage,_that.subtitleMode,_that.trailerKey,_that.playlistItemId,_that.playQueueItemId,_that.subtype,_that.extraType,_that.serverId,_that.serverName,_that.raw);case JellyfinMediaItem() when jellyfin != null: +return jellyfin(_that.id,_that.kind,_that.guid,_that.title,_that.titleSort,_that.summary,_that.tagline,_that.originalTitle,_that.studio,_that.year,_that.originallyAvailableAt,_that.contentRating,_that.parentId,_that.parentTitle,_that.parentThumbPath,_that.parentIndex,_that.index,_that.grandparentId,_that.grandparentTitle,_that.grandparentThumbPath,_that.grandparentArtPath,_that.thumbPath,_that.artPath,_that.clearLogoPath,_that.backgroundSquarePath,_that.durationMs,_that.viewOffsetMs,_that.viewCount,_that.lastViewedAt,_that.leafCount,_that.viewedLeafCount,_that.childCount,_that.addedAt,_that.updatedAt,_that.rating,_that.userRating,_that.genres,_that.directors,_that.writers,_that.producers,_that.countries,_that.collections,_that.labels,_that.styles,_that.moods,_that.roles,_that.mediaVersions,_that.libraryId,_that.libraryTitle,_that.audioLanguage,_that.playlistItemId,_that.serverId,_that.serverName,_that.raw);case _: + return null; + +} +} + +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false, explicitToJson: true) +class PlexMediaItem extends MediaItem { + const PlexMediaItem({@JsonKey(readValue: readStringField, defaultValue: '') required this.id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) required this.kind, this.guid, this.title, this.titleSort, this.summary, this.tagline, this.originalTitle, this.editionTitle, this.studio, @JsonKey(fromJson: flexibleInt) this.year, this.originallyAvailableAt, this.contentRating, this.parentId, this.parentTitle, this.parentThumbPath, @JsonKey(fromJson: flexibleInt) this.parentIndex, @JsonKey(fromJson: flexibleInt) this.index, this.grandparentId, this.grandparentTitle, this.grandparentThumbPath, this.grandparentArtPath, this.thumbPath, this.artPath, this.clearLogoPath, this.backgroundSquarePath, @JsonKey(fromJson: flexibleInt) this.durationMs, @JsonKey(fromJson: flexibleInt) this.viewOffsetMs, @JsonKey(fromJson: flexibleInt) this.viewCount, @JsonKey(fromJson: flexibleInt) this.lastViewedAt, @JsonKey(fromJson: flexibleInt) this.leafCount, @JsonKey(fromJson: flexibleInt) this.viewedLeafCount, @JsonKey(fromJson: flexibleInt) this.childCount, @JsonKey(fromJson: flexibleInt) this.addedAt, @JsonKey(fromJson: flexibleInt) this.updatedAt, @JsonKey(fromJson: flexibleDouble) this.rating, @JsonKey(fromJson: flexibleDouble) this.audienceRating, @JsonKey(fromJson: flexibleDouble) this.userRating, this.ratingImage, this.audienceRatingImage, @JsonKey(fromJson: _mediaItemStringList) this.genres, @JsonKey(fromJson: _mediaItemStringList) this.directors, @JsonKey(fromJson: _mediaItemStringList) this.writers, @JsonKey(fromJson: _mediaItemStringList) this.producers, @JsonKey(fromJson: _mediaItemStringList) this.countries, @JsonKey(fromJson: _mediaItemStringList) this.collections, @JsonKey(fromJson: _mediaItemStringList) this.labels, @JsonKey(fromJson: _mediaItemStringList) this.styles, @JsonKey(fromJson: _mediaItemStringList) this.moods, @JsonKey(fromJson: _mediaItemRolesFromJson) this.roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) this.mediaVersions, this.libraryId, this.libraryTitle, this.audioLanguage, this.subtitleLanguage, @JsonKey(fromJson: flexibleInt) this.subtitleMode, this.trailerKey, @JsonKey(fromJson: flexibleInt) this.playlistItemId, @JsonKey(fromJson: flexibleInt) this.playQueueItemId, this.subtype, @JsonKey(fromJson: flexibleInt) this.extraType, this.serverId, this.serverName, @JsonKey(fromJson: _mediaItemRawFromJson) this.raw}): super._(); + + +@override@JsonKey(readValue: readStringField, defaultValue: '') final String id; +@override@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) final MediaKind kind; +@override final String? guid; +@override final String? title; +@override final String? titleSort; +@override final String? summary; +@override final String? tagline; +@override final String? originalTitle; +/// Plex `editionTitle` distinguishes versions of the same movie. + final String? editionTitle; +@override final String? studio; +@override@JsonKey(fromJson: flexibleInt) final int? year; +@override final String? originallyAvailableAt; +@override final String? contentRating; +@override final String? parentId; +@override final String? parentTitle; +@override final String? parentThumbPath; +@override@JsonKey(fromJson: flexibleInt) final int? parentIndex; +@override@JsonKey(fromJson: flexibleInt) final int? index; +@override final String? grandparentId; +@override final String? grandparentTitle; +@override final String? grandparentThumbPath; +@override final String? grandparentArtPath; +@override final String? thumbPath; +@override final String? artPath; +@override final String? clearLogoPath; +@override final String? backgroundSquarePath; +@override@JsonKey(fromJson: flexibleInt) final int? durationMs; +@override@JsonKey(fromJson: flexibleInt) final int? viewOffsetMs; +@override@JsonKey(fromJson: flexibleInt) final int? viewCount; +@override@JsonKey(fromJson: flexibleInt) final int? lastViewedAt; +@override@JsonKey(fromJson: flexibleInt) final int? leafCount; +@override@JsonKey(fromJson: flexibleInt) final int? viewedLeafCount; +@override@JsonKey(fromJson: flexibleInt) final int? childCount; +@override@JsonKey(fromJson: flexibleInt) final int? addedAt; +@override@JsonKey(fromJson: flexibleInt) final int? updatedAt; +@override@JsonKey(fromJson: flexibleDouble) final double? rating; +@JsonKey(fromJson: flexibleDouble) final double? audienceRating; +@override@JsonKey(fromJson: flexibleDouble) final double? userRating; + final String? ratingImage; + final String? audienceRatingImage; +@override@JsonKey(fromJson: _mediaItemStringList) final List? genres; +@override@JsonKey(fromJson: _mediaItemStringList) final List? directors; +@override@JsonKey(fromJson: _mediaItemStringList) final List? writers; +@override@JsonKey(fromJson: _mediaItemStringList) final List? producers; +@override@JsonKey(fromJson: _mediaItemStringList) final List? countries; +@override@JsonKey(fromJson: _mediaItemStringList) final List? collections; +@override@JsonKey(fromJson: _mediaItemStringList) final List? labels; +@override@JsonKey(fromJson: _mediaItemStringList) final List? styles; +@override@JsonKey(fromJson: _mediaItemStringList) final List? moods; +@override@JsonKey(fromJson: _mediaItemRolesFromJson) final List? roles; +@override@JsonKey(fromJson: _mediaItemVersionsFromJson) final List? mediaVersions; +@override final String? libraryId; +@override final String? libraryTitle; +@override final String? audioLanguage; + final String? subtitleLanguage; +@JsonKey(fromJson: flexibleInt) final int? subtitleMode; + final String? trailerKey; +@override@JsonKey(fromJson: flexibleInt) final int? playlistItemId; +@JsonKey(fromJson: flexibleInt) final int? playQueueItemId; + final String? subtype; +@JsonKey(fromJson: flexibleInt) final int? extraType; +@override final String? serverId; +@override final String? serverName; +@override@JsonKey(fromJson: _mediaItemRawFromJson) final Map? raw; + +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$PlexMediaItemCopyWith get copyWith => _$PlexMediaItemCopyWithImpl(this, _$identity); + + + + + +@override +String toString() { + return 'MediaItem.plex(id: $id, kind: $kind, guid: $guid, title: $title, titleSort: $titleSort, summary: $summary, tagline: $tagline, originalTitle: $originalTitle, editionTitle: $editionTitle, studio: $studio, year: $year, originallyAvailableAt: $originallyAvailableAt, contentRating: $contentRating, parentId: $parentId, parentTitle: $parentTitle, parentThumbPath: $parentThumbPath, parentIndex: $parentIndex, index: $index, grandparentId: $grandparentId, grandparentTitle: $grandparentTitle, grandparentThumbPath: $grandparentThumbPath, grandparentArtPath: $grandparentArtPath, thumbPath: $thumbPath, artPath: $artPath, clearLogoPath: $clearLogoPath, backgroundSquarePath: $backgroundSquarePath, durationMs: $durationMs, viewOffsetMs: $viewOffsetMs, viewCount: $viewCount, lastViewedAt: $lastViewedAt, leafCount: $leafCount, viewedLeafCount: $viewedLeafCount, childCount: $childCount, addedAt: $addedAt, updatedAt: $updatedAt, rating: $rating, audienceRating: $audienceRating, userRating: $userRating, ratingImage: $ratingImage, audienceRatingImage: $audienceRatingImage, genres: $genres, directors: $directors, writers: $writers, producers: $producers, countries: $countries, collections: $collections, labels: $labels, styles: $styles, moods: $moods, roles: $roles, mediaVersions: $mediaVersions, libraryId: $libraryId, libraryTitle: $libraryTitle, audioLanguage: $audioLanguage, subtitleLanguage: $subtitleLanguage, subtitleMode: $subtitleMode, trailerKey: $trailerKey, playlistItemId: $playlistItemId, playQueueItemId: $playQueueItemId, subtype: $subtype, extraType: $extraType, serverId: $serverId, serverName: $serverName, raw: $raw)'; +} + + +} + +/// @nodoc +abstract mixin class $PlexMediaItemCopyWith<$Res> implements $MediaItemCopyWith<$Res> { + factory $PlexMediaItemCopyWith(PlexMediaItem value, $Res Function(PlexMediaItem) _then) = _$PlexMediaItemCopyWithImpl; +@override @useResult +$Res call({ +@JsonKey(readValue: readStringField, defaultValue: '') String id,@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? editionTitle, String? studio,@JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath,@JsonKey(fromJson: flexibleInt) int? parentIndex,@JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath,@JsonKey(fromJson: flexibleInt) int? durationMs,@JsonKey(fromJson: flexibleInt) int? viewOffsetMs,@JsonKey(fromJson: flexibleInt) int? viewCount,@JsonKey(fromJson: flexibleInt) int? lastViewedAt,@JsonKey(fromJson: flexibleInt) int? leafCount,@JsonKey(fromJson: flexibleInt) int? viewedLeafCount,@JsonKey(fromJson: flexibleInt) int? childCount,@JsonKey(fromJson: flexibleInt) int? addedAt,@JsonKey(fromJson: flexibleInt) int? updatedAt,@JsonKey(fromJson: flexibleDouble) double? rating,@JsonKey(fromJson: flexibleDouble) double? audienceRating,@JsonKey(fromJson: flexibleDouble) double? userRating, String? ratingImage, String? audienceRatingImage,@JsonKey(fromJson: _mediaItemStringList) List? genres,@JsonKey(fromJson: _mediaItemStringList) List? directors,@JsonKey(fromJson: _mediaItemStringList) List? writers,@JsonKey(fromJson: _mediaItemStringList) List? producers,@JsonKey(fromJson: _mediaItemStringList) List? countries,@JsonKey(fromJson: _mediaItemStringList) List? collections,@JsonKey(fromJson: _mediaItemStringList) List? labels,@JsonKey(fromJson: _mediaItemStringList) List? styles,@JsonKey(fromJson: _mediaItemStringList) List? moods,@JsonKey(fromJson: _mediaItemRolesFromJson) List? roles,@JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? subtitleLanguage,@JsonKey(fromJson: flexibleInt) int? subtitleMode, String? trailerKey,@JsonKey(fromJson: flexibleInt) int? playlistItemId,@JsonKey(fromJson: flexibleInt) int? playQueueItemId, String? subtype,@JsonKey(fromJson: flexibleInt) int? extraType, String? serverId, String? serverName,@JsonKey(fromJson: _mediaItemRawFromJson) Map? raw +}); + + + + +} +/// @nodoc +class _$PlexMediaItemCopyWithImpl<$Res> + implements $PlexMediaItemCopyWith<$Res> { + _$PlexMediaItemCopyWithImpl(this._self, this._then); + + final PlexMediaItem _self; + final $Res Function(PlexMediaItem) _then; + +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? kind = null,Object? guid = freezed,Object? title = freezed,Object? titleSort = freezed,Object? summary = freezed,Object? tagline = freezed,Object? originalTitle = freezed,Object? editionTitle = freezed,Object? studio = freezed,Object? year = freezed,Object? originallyAvailableAt = freezed,Object? contentRating = freezed,Object? parentId = freezed,Object? parentTitle = freezed,Object? parentThumbPath = freezed,Object? parentIndex = freezed,Object? index = freezed,Object? grandparentId = freezed,Object? grandparentTitle = freezed,Object? grandparentThumbPath = freezed,Object? grandparentArtPath = freezed,Object? thumbPath = freezed,Object? artPath = freezed,Object? clearLogoPath = freezed,Object? backgroundSquarePath = freezed,Object? durationMs = freezed,Object? viewOffsetMs = freezed,Object? viewCount = freezed,Object? lastViewedAt = freezed,Object? leafCount = freezed,Object? viewedLeafCount = freezed,Object? childCount = freezed,Object? addedAt = freezed,Object? updatedAt = freezed,Object? rating = freezed,Object? audienceRating = freezed,Object? userRating = freezed,Object? ratingImage = freezed,Object? audienceRatingImage = freezed,Object? genres = freezed,Object? directors = freezed,Object? writers = freezed,Object? producers = freezed,Object? countries = freezed,Object? collections = freezed,Object? labels = freezed,Object? styles = freezed,Object? moods = freezed,Object? roles = freezed,Object? mediaVersions = freezed,Object? libraryId = freezed,Object? libraryTitle = freezed,Object? audioLanguage = freezed,Object? subtitleLanguage = freezed,Object? subtitleMode = freezed,Object? trailerKey = freezed,Object? playlistItemId = freezed,Object? playQueueItemId = freezed,Object? subtype = freezed,Object? extraType = freezed,Object? serverId = freezed,Object? serverName = freezed,Object? raw = freezed,}) { + return _then(PlexMediaItem( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,kind: null == kind ? _self.kind : kind // ignore: cast_nullable_to_non_nullable +as MediaKind,guid: freezed == guid ? _self.guid : guid // ignore: cast_nullable_to_non_nullable +as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String?,titleSort: freezed == titleSort ? _self.titleSort : titleSort // ignore: cast_nullable_to_non_nullable +as String?,summary: freezed == summary ? _self.summary : summary // ignore: cast_nullable_to_non_nullable +as String?,tagline: freezed == tagline ? _self.tagline : tagline // ignore: cast_nullable_to_non_nullable +as String?,originalTitle: freezed == originalTitle ? _self.originalTitle : originalTitle // ignore: cast_nullable_to_non_nullable +as String?,editionTitle: freezed == editionTitle ? _self.editionTitle : editionTitle // ignore: cast_nullable_to_non_nullable +as String?,studio: freezed == studio ? _self.studio : studio // ignore: cast_nullable_to_non_nullable +as String?,year: freezed == year ? _self.year : year // ignore: cast_nullable_to_non_nullable +as int?,originallyAvailableAt: freezed == originallyAvailableAt ? _self.originallyAvailableAt : originallyAvailableAt // ignore: cast_nullable_to_non_nullable +as String?,contentRating: freezed == contentRating ? _self.contentRating : contentRating // ignore: cast_nullable_to_non_nullable +as String?,parentId: freezed == parentId ? _self.parentId : parentId // ignore: cast_nullable_to_non_nullable +as String?,parentTitle: freezed == parentTitle ? _self.parentTitle : parentTitle // ignore: cast_nullable_to_non_nullable +as String?,parentThumbPath: freezed == parentThumbPath ? _self.parentThumbPath : parentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,parentIndex: freezed == parentIndex ? _self.parentIndex : parentIndex // ignore: cast_nullable_to_non_nullable +as int?,index: freezed == index ? _self.index : index // ignore: cast_nullable_to_non_nullable +as int?,grandparentId: freezed == grandparentId ? _self.grandparentId : grandparentId // ignore: cast_nullable_to_non_nullable +as String?,grandparentTitle: freezed == grandparentTitle ? _self.grandparentTitle : grandparentTitle // ignore: cast_nullable_to_non_nullable +as String?,grandparentThumbPath: freezed == grandparentThumbPath ? _self.grandparentThumbPath : grandparentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,grandparentArtPath: freezed == grandparentArtPath ? _self.grandparentArtPath : grandparentArtPath // ignore: cast_nullable_to_non_nullable +as String?,thumbPath: freezed == thumbPath ? _self.thumbPath : thumbPath // ignore: cast_nullable_to_non_nullable +as String?,artPath: freezed == artPath ? _self.artPath : artPath // ignore: cast_nullable_to_non_nullable +as String?,clearLogoPath: freezed == clearLogoPath ? _self.clearLogoPath : clearLogoPath // ignore: cast_nullable_to_non_nullable +as String?,backgroundSquarePath: freezed == backgroundSquarePath ? _self.backgroundSquarePath : backgroundSquarePath // ignore: cast_nullable_to_non_nullable +as String?,durationMs: freezed == durationMs ? _self.durationMs : durationMs // ignore: cast_nullable_to_non_nullable +as int?,viewOffsetMs: freezed == viewOffsetMs ? _self.viewOffsetMs : viewOffsetMs // ignore: cast_nullable_to_non_nullable +as int?,viewCount: freezed == viewCount ? _self.viewCount : viewCount // ignore: cast_nullable_to_non_nullable +as int?,lastViewedAt: freezed == lastViewedAt ? _self.lastViewedAt : lastViewedAt // ignore: cast_nullable_to_non_nullable +as int?,leafCount: freezed == leafCount ? _self.leafCount : leafCount // ignore: cast_nullable_to_non_nullable +as int?,viewedLeafCount: freezed == viewedLeafCount ? _self.viewedLeafCount : viewedLeafCount // ignore: cast_nullable_to_non_nullable +as int?,childCount: freezed == childCount ? _self.childCount : childCount // ignore: cast_nullable_to_non_nullable +as int?,addedAt: freezed == addedAt ? _self.addedAt : addedAt // ignore: cast_nullable_to_non_nullable +as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?,rating: freezed == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable +as double?,audienceRating: freezed == audienceRating ? _self.audienceRating : audienceRating // ignore: cast_nullable_to_non_nullable +as double?,userRating: freezed == userRating ? _self.userRating : userRating // ignore: cast_nullable_to_non_nullable +as double?,ratingImage: freezed == ratingImage ? _self.ratingImage : ratingImage // ignore: cast_nullable_to_non_nullable +as String?,audienceRatingImage: freezed == audienceRatingImage ? _self.audienceRatingImage : audienceRatingImage // ignore: cast_nullable_to_non_nullable +as String?,genres: freezed == genres ? _self.genres : genres // ignore: cast_nullable_to_non_nullable +as List?,directors: freezed == directors ? _self.directors : directors // ignore: cast_nullable_to_non_nullable +as List?,writers: freezed == writers ? _self.writers : writers // ignore: cast_nullable_to_non_nullable +as List?,producers: freezed == producers ? _self.producers : producers // ignore: cast_nullable_to_non_nullable +as List?,countries: freezed == countries ? _self.countries : countries // ignore: cast_nullable_to_non_nullable +as List?,collections: freezed == collections ? _self.collections : collections // ignore: cast_nullable_to_non_nullable +as List?,labels: freezed == labels ? _self.labels : labels // ignore: cast_nullable_to_non_nullable +as List?,styles: freezed == styles ? _self.styles : styles // ignore: cast_nullable_to_non_nullable +as List?,moods: freezed == moods ? _self.moods : moods // ignore: cast_nullable_to_non_nullable +as List?,roles: freezed == roles ? _self.roles : roles // ignore: cast_nullable_to_non_nullable +as List?,mediaVersions: freezed == mediaVersions ? _self.mediaVersions : mediaVersions // ignore: cast_nullable_to_non_nullable +as List?,libraryId: freezed == libraryId ? _self.libraryId : libraryId // ignore: cast_nullable_to_non_nullable +as String?,libraryTitle: freezed == libraryTitle ? _self.libraryTitle : libraryTitle // ignore: cast_nullable_to_non_nullable +as String?,audioLanguage: freezed == audioLanguage ? _self.audioLanguage : audioLanguage // ignore: cast_nullable_to_non_nullable +as String?,subtitleLanguage: freezed == subtitleLanguage ? _self.subtitleLanguage : subtitleLanguage // ignore: cast_nullable_to_non_nullable +as String?,subtitleMode: freezed == subtitleMode ? _self.subtitleMode : subtitleMode // ignore: cast_nullable_to_non_nullable +as int?,trailerKey: freezed == trailerKey ? _self.trailerKey : trailerKey // ignore: cast_nullable_to_non_nullable +as String?,playlistItemId: freezed == playlistItemId ? _self.playlistItemId : playlistItemId // ignore: cast_nullable_to_non_nullable +as int?,playQueueItemId: freezed == playQueueItemId ? _self.playQueueItemId : playQueueItemId // ignore: cast_nullable_to_non_nullable +as int?,subtype: freezed == subtype ? _self.subtype : subtype // ignore: cast_nullable_to_non_nullable +as String?,extraType: freezed == extraType ? _self.extraType : extraType // ignore: cast_nullable_to_non_nullable +as int?,serverId: freezed == serverId ? _self.serverId : serverId // ignore: cast_nullable_to_non_nullable +as String?,serverName: freezed == serverName ? _self.serverName : serverName // ignore: cast_nullable_to_non_nullable +as String?,raw: freezed == raw ? _self.raw : raw // ignore: cast_nullable_to_non_nullable +as Map?, + )); +} + + +} + +/// @nodoc + +@JsonSerializable(includeIfNull: false, explicitToJson: true) +class JellyfinMediaItem extends MediaItem { + const JellyfinMediaItem({@JsonKey(readValue: readStringField, defaultValue: '') required this.id, @JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) required this.kind, this.guid, this.title, this.titleSort, this.summary, this.tagline, this.originalTitle, this.studio, @JsonKey(fromJson: flexibleInt) this.year, this.originallyAvailableAt, this.contentRating, this.parentId, this.parentTitle, this.parentThumbPath, @JsonKey(fromJson: flexibleInt) this.parentIndex, @JsonKey(fromJson: flexibleInt) this.index, this.grandparentId, this.grandparentTitle, this.grandparentThumbPath, this.grandparentArtPath, this.thumbPath, this.artPath, this.clearLogoPath, this.backgroundSquarePath, @JsonKey(fromJson: flexibleInt) this.durationMs, @JsonKey(fromJson: flexibleInt) this.viewOffsetMs, @JsonKey(fromJson: flexibleInt) this.viewCount, @JsonKey(fromJson: flexibleInt) this.lastViewedAt, @JsonKey(fromJson: flexibleInt) this.leafCount, @JsonKey(fromJson: flexibleInt) this.viewedLeafCount, @JsonKey(fromJson: flexibleInt) this.childCount, @JsonKey(fromJson: flexibleInt) this.addedAt, @JsonKey(fromJson: flexibleInt) this.updatedAt, @JsonKey(fromJson: flexibleDouble) this.rating, @JsonKey(fromJson: flexibleDouble) this.userRating, @JsonKey(fromJson: _mediaItemStringList) this.genres, @JsonKey(fromJson: _mediaItemStringList) this.directors, @JsonKey(fromJson: _mediaItemStringList) this.writers, @JsonKey(fromJson: _mediaItemStringList) this.producers, @JsonKey(fromJson: _mediaItemStringList) this.countries, @JsonKey(fromJson: _mediaItemStringList) this.collections, @JsonKey(fromJson: _mediaItemStringList) this.labels, @JsonKey(fromJson: _mediaItemStringList) this.styles, @JsonKey(fromJson: _mediaItemStringList) this.moods, @JsonKey(fromJson: _mediaItemRolesFromJson) this.roles, @JsonKey(fromJson: _mediaItemVersionsFromJson) this.mediaVersions, this.libraryId, this.libraryTitle, this.audioLanguage, this.playlistItemId, this.serverId, this.serverName, @JsonKey(fromJson: _mediaItemRawFromJson) this.raw}): super._(); + + +@override@JsonKey(readValue: readStringField, defaultValue: '') final String id; +@override@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) final MediaKind kind; +@override final String? guid; +@override final String? title; +@override final String? titleSort; +@override final String? summary; +@override final String? tagline; +@override final String? originalTitle; +@override final String? studio; +@override@JsonKey(fromJson: flexibleInt) final int? year; +@override final String? originallyAvailableAt; +@override final String? contentRating; +@override final String? parentId; +@override final String? parentTitle; +@override final String? parentThumbPath; +@override@JsonKey(fromJson: flexibleInt) final int? parentIndex; +@override@JsonKey(fromJson: flexibleInt) final int? index; +@override final String? grandparentId; +@override final String? grandparentTitle; +@override final String? grandparentThumbPath; +@override final String? grandparentArtPath; +@override final String? thumbPath; +@override final String? artPath; +@override final String? clearLogoPath; +@override final String? backgroundSquarePath; +@override@JsonKey(fromJson: flexibleInt) final int? durationMs; +@override@JsonKey(fromJson: flexibleInt) final int? viewOffsetMs; +@override@JsonKey(fromJson: flexibleInt) final int? viewCount; +@override@JsonKey(fromJson: flexibleInt) final int? lastViewedAt; +@override@JsonKey(fromJson: flexibleInt) final int? leafCount; +@override@JsonKey(fromJson: flexibleInt) final int? viewedLeafCount; +@override@JsonKey(fromJson: flexibleInt) final int? childCount; +@override@JsonKey(fromJson: flexibleInt) final int? addedAt; +@override@JsonKey(fromJson: flexibleInt) final int? updatedAt; +@override@JsonKey(fromJson: flexibleDouble) final double? rating; +@override@JsonKey(fromJson: flexibleDouble) final double? userRating; +@override@JsonKey(fromJson: _mediaItemStringList) final List? genres; +@override@JsonKey(fromJson: _mediaItemStringList) final List? directors; +@override@JsonKey(fromJson: _mediaItemStringList) final List? writers; +@override@JsonKey(fromJson: _mediaItemStringList) final List? producers; +@override@JsonKey(fromJson: _mediaItemStringList) final List? countries; +@override@JsonKey(fromJson: _mediaItemStringList) final List? collections; +@override@JsonKey(fromJson: _mediaItemStringList) final List? labels; +@override@JsonKey(fromJson: _mediaItemStringList) final List? styles; +@override@JsonKey(fromJson: _mediaItemStringList) final List? moods; +@override@JsonKey(fromJson: _mediaItemRolesFromJson) final List? roles; +@override@JsonKey(fromJson: _mediaItemVersionsFromJson) final List? mediaVersions; +@override final String? libraryId; +@override final String? libraryTitle; +@override final String? audioLanguage; +/// Jellyfin playlist entry id used by playlist write endpoints. +@override final String? playlistItemId; +@override final String? serverId; +@override final String? serverName; +@override@JsonKey(fromJson: _mediaItemRawFromJson) final Map? raw; + +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$JellyfinMediaItemCopyWith get copyWith => _$JellyfinMediaItemCopyWithImpl(this, _$identity); + + + + + +@override +String toString() { + return 'MediaItem.jellyfin(id: $id, kind: $kind, guid: $guid, title: $title, titleSort: $titleSort, summary: $summary, tagline: $tagline, originalTitle: $originalTitle, studio: $studio, year: $year, originallyAvailableAt: $originallyAvailableAt, contentRating: $contentRating, parentId: $parentId, parentTitle: $parentTitle, parentThumbPath: $parentThumbPath, parentIndex: $parentIndex, index: $index, grandparentId: $grandparentId, grandparentTitle: $grandparentTitle, grandparentThumbPath: $grandparentThumbPath, grandparentArtPath: $grandparentArtPath, thumbPath: $thumbPath, artPath: $artPath, clearLogoPath: $clearLogoPath, backgroundSquarePath: $backgroundSquarePath, durationMs: $durationMs, viewOffsetMs: $viewOffsetMs, viewCount: $viewCount, lastViewedAt: $lastViewedAt, leafCount: $leafCount, viewedLeafCount: $viewedLeafCount, childCount: $childCount, addedAt: $addedAt, updatedAt: $updatedAt, rating: $rating, userRating: $userRating, genres: $genres, directors: $directors, writers: $writers, producers: $producers, countries: $countries, collections: $collections, labels: $labels, styles: $styles, moods: $moods, roles: $roles, mediaVersions: $mediaVersions, libraryId: $libraryId, libraryTitle: $libraryTitle, audioLanguage: $audioLanguage, playlistItemId: $playlistItemId, serverId: $serverId, serverName: $serverName, raw: $raw)'; +} + + +} + +/// @nodoc +abstract mixin class $JellyfinMediaItemCopyWith<$Res> implements $MediaItemCopyWith<$Res> { + factory $JellyfinMediaItemCopyWith(JellyfinMediaItem value, $Res Function(JellyfinMediaItem) _then) = _$JellyfinMediaItemCopyWithImpl; +@override @useResult +$Res call({ +@JsonKey(readValue: readStringField, defaultValue: '') String id,@JsonKey(fromJson: _mediaKindFromJson, toJson: _mediaKindToJson) MediaKind kind, String? guid, String? title, String? titleSort, String? summary, String? tagline, String? originalTitle, String? studio,@JsonKey(fromJson: flexibleInt) int? year, String? originallyAvailableAt, String? contentRating, String? parentId, String? parentTitle, String? parentThumbPath,@JsonKey(fromJson: flexibleInt) int? parentIndex,@JsonKey(fromJson: flexibleInt) int? index, String? grandparentId, String? grandparentTitle, String? grandparentThumbPath, String? grandparentArtPath, String? thumbPath, String? artPath, String? clearLogoPath, String? backgroundSquarePath,@JsonKey(fromJson: flexibleInt) int? durationMs,@JsonKey(fromJson: flexibleInt) int? viewOffsetMs,@JsonKey(fromJson: flexibleInt) int? viewCount,@JsonKey(fromJson: flexibleInt) int? lastViewedAt,@JsonKey(fromJson: flexibleInt) int? leafCount,@JsonKey(fromJson: flexibleInt) int? viewedLeafCount,@JsonKey(fromJson: flexibleInt) int? childCount,@JsonKey(fromJson: flexibleInt) int? addedAt,@JsonKey(fromJson: flexibleInt) int? updatedAt,@JsonKey(fromJson: flexibleDouble) double? rating,@JsonKey(fromJson: flexibleDouble) double? userRating,@JsonKey(fromJson: _mediaItemStringList) List? genres,@JsonKey(fromJson: _mediaItemStringList) List? directors,@JsonKey(fromJson: _mediaItemStringList) List? writers,@JsonKey(fromJson: _mediaItemStringList) List? producers,@JsonKey(fromJson: _mediaItemStringList) List? countries,@JsonKey(fromJson: _mediaItemStringList) List? collections,@JsonKey(fromJson: _mediaItemStringList) List? labels,@JsonKey(fromJson: _mediaItemStringList) List? styles,@JsonKey(fromJson: _mediaItemStringList) List? moods,@JsonKey(fromJson: _mediaItemRolesFromJson) List? roles,@JsonKey(fromJson: _mediaItemVersionsFromJson) List? mediaVersions, String? libraryId, String? libraryTitle, String? audioLanguage, String? playlistItemId, String? serverId, String? serverName,@JsonKey(fromJson: _mediaItemRawFromJson) Map? raw +}); + + + + +} +/// @nodoc +class _$JellyfinMediaItemCopyWithImpl<$Res> + implements $JellyfinMediaItemCopyWith<$Res> { + _$JellyfinMediaItemCopyWithImpl(this._self, this._then); + + final JellyfinMediaItem _self; + final $Res Function(JellyfinMediaItem) _then; + +/// Create a copy of MediaItem +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? kind = null,Object? guid = freezed,Object? title = freezed,Object? titleSort = freezed,Object? summary = freezed,Object? tagline = freezed,Object? originalTitle = freezed,Object? studio = freezed,Object? year = freezed,Object? originallyAvailableAt = freezed,Object? contentRating = freezed,Object? parentId = freezed,Object? parentTitle = freezed,Object? parentThumbPath = freezed,Object? parentIndex = freezed,Object? index = freezed,Object? grandparentId = freezed,Object? grandparentTitle = freezed,Object? grandparentThumbPath = freezed,Object? grandparentArtPath = freezed,Object? thumbPath = freezed,Object? artPath = freezed,Object? clearLogoPath = freezed,Object? backgroundSquarePath = freezed,Object? durationMs = freezed,Object? viewOffsetMs = freezed,Object? viewCount = freezed,Object? lastViewedAt = freezed,Object? leafCount = freezed,Object? viewedLeafCount = freezed,Object? childCount = freezed,Object? addedAt = freezed,Object? updatedAt = freezed,Object? rating = freezed,Object? userRating = freezed,Object? genres = freezed,Object? directors = freezed,Object? writers = freezed,Object? producers = freezed,Object? countries = freezed,Object? collections = freezed,Object? labels = freezed,Object? styles = freezed,Object? moods = freezed,Object? roles = freezed,Object? mediaVersions = freezed,Object? libraryId = freezed,Object? libraryTitle = freezed,Object? audioLanguage = freezed,Object? playlistItemId = freezed,Object? serverId = freezed,Object? serverName = freezed,Object? raw = freezed,}) { + return _then(JellyfinMediaItem( +id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable +as String,kind: null == kind ? _self.kind : kind // ignore: cast_nullable_to_non_nullable +as MediaKind,guid: freezed == guid ? _self.guid : guid // ignore: cast_nullable_to_non_nullable +as String?,title: freezed == title ? _self.title : title // ignore: cast_nullable_to_non_nullable +as String?,titleSort: freezed == titleSort ? _self.titleSort : titleSort // ignore: cast_nullable_to_non_nullable +as String?,summary: freezed == summary ? _self.summary : summary // ignore: cast_nullable_to_non_nullable +as String?,tagline: freezed == tagline ? _self.tagline : tagline // ignore: cast_nullable_to_non_nullable +as String?,originalTitle: freezed == originalTitle ? _self.originalTitle : originalTitle // ignore: cast_nullable_to_non_nullable +as String?,studio: freezed == studio ? _self.studio : studio // ignore: cast_nullable_to_non_nullable +as String?,year: freezed == year ? _self.year : year // ignore: cast_nullable_to_non_nullable +as int?,originallyAvailableAt: freezed == originallyAvailableAt ? _self.originallyAvailableAt : originallyAvailableAt // ignore: cast_nullable_to_non_nullable +as String?,contentRating: freezed == contentRating ? _self.contentRating : contentRating // ignore: cast_nullable_to_non_nullable +as String?,parentId: freezed == parentId ? _self.parentId : parentId // ignore: cast_nullable_to_non_nullable +as String?,parentTitle: freezed == parentTitle ? _self.parentTitle : parentTitle // ignore: cast_nullable_to_non_nullable +as String?,parentThumbPath: freezed == parentThumbPath ? _self.parentThumbPath : parentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,parentIndex: freezed == parentIndex ? _self.parentIndex : parentIndex // ignore: cast_nullable_to_non_nullable +as int?,index: freezed == index ? _self.index : index // ignore: cast_nullable_to_non_nullable +as int?,grandparentId: freezed == grandparentId ? _self.grandparentId : grandparentId // ignore: cast_nullable_to_non_nullable +as String?,grandparentTitle: freezed == grandparentTitle ? _self.grandparentTitle : grandparentTitle // ignore: cast_nullable_to_non_nullable +as String?,grandparentThumbPath: freezed == grandparentThumbPath ? _self.grandparentThumbPath : grandparentThumbPath // ignore: cast_nullable_to_non_nullable +as String?,grandparentArtPath: freezed == grandparentArtPath ? _self.grandparentArtPath : grandparentArtPath // ignore: cast_nullable_to_non_nullable +as String?,thumbPath: freezed == thumbPath ? _self.thumbPath : thumbPath // ignore: cast_nullable_to_non_nullable +as String?,artPath: freezed == artPath ? _self.artPath : artPath // ignore: cast_nullable_to_non_nullable +as String?,clearLogoPath: freezed == clearLogoPath ? _self.clearLogoPath : clearLogoPath // ignore: cast_nullable_to_non_nullable +as String?,backgroundSquarePath: freezed == backgroundSquarePath ? _self.backgroundSquarePath : backgroundSquarePath // ignore: cast_nullable_to_non_nullable +as String?,durationMs: freezed == durationMs ? _self.durationMs : durationMs // ignore: cast_nullable_to_non_nullable +as int?,viewOffsetMs: freezed == viewOffsetMs ? _self.viewOffsetMs : viewOffsetMs // ignore: cast_nullable_to_non_nullable +as int?,viewCount: freezed == viewCount ? _self.viewCount : viewCount // ignore: cast_nullable_to_non_nullable +as int?,lastViewedAt: freezed == lastViewedAt ? _self.lastViewedAt : lastViewedAt // ignore: cast_nullable_to_non_nullable +as int?,leafCount: freezed == leafCount ? _self.leafCount : leafCount // ignore: cast_nullable_to_non_nullable +as int?,viewedLeafCount: freezed == viewedLeafCount ? _self.viewedLeafCount : viewedLeafCount // ignore: cast_nullable_to_non_nullable +as int?,childCount: freezed == childCount ? _self.childCount : childCount // ignore: cast_nullable_to_non_nullable +as int?,addedAt: freezed == addedAt ? _self.addedAt : addedAt // ignore: cast_nullable_to_non_nullable +as int?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable +as int?,rating: freezed == rating ? _self.rating : rating // ignore: cast_nullable_to_non_nullable +as double?,userRating: freezed == userRating ? _self.userRating : userRating // ignore: cast_nullable_to_non_nullable +as double?,genres: freezed == genres ? _self.genres : genres // ignore: cast_nullable_to_non_nullable +as List?,directors: freezed == directors ? _self.directors : directors // ignore: cast_nullable_to_non_nullable +as List?,writers: freezed == writers ? _self.writers : writers // ignore: cast_nullable_to_non_nullable +as List?,producers: freezed == producers ? _self.producers : producers // ignore: cast_nullable_to_non_nullable +as List?,countries: freezed == countries ? _self.countries : countries // ignore: cast_nullable_to_non_nullable +as List?,collections: freezed == collections ? _self.collections : collections // ignore: cast_nullable_to_non_nullable +as List?,labels: freezed == labels ? _self.labels : labels // ignore: cast_nullable_to_non_nullable +as List?,styles: freezed == styles ? _self.styles : styles // ignore: cast_nullable_to_non_nullable +as List?,moods: freezed == moods ? _self.moods : moods // ignore: cast_nullable_to_non_nullable +as List?,roles: freezed == roles ? _self.roles : roles // ignore: cast_nullable_to_non_nullable +as List?,mediaVersions: freezed == mediaVersions ? _self.mediaVersions : mediaVersions // ignore: cast_nullable_to_non_nullable +as List?,libraryId: freezed == libraryId ? _self.libraryId : libraryId // ignore: cast_nullable_to_non_nullable +as String?,libraryTitle: freezed == libraryTitle ? _self.libraryTitle : libraryTitle // ignore: cast_nullable_to_non_nullable +as String?,audioLanguage: freezed == audioLanguage ? _self.audioLanguage : audioLanguage // ignore: cast_nullable_to_non_nullable +as String?,playlistItemId: freezed == playlistItemId ? _self.playlistItemId : playlistItemId // ignore: cast_nullable_to_non_nullable +as String?,serverId: freezed == serverId ? _self.serverId : serverId // ignore: cast_nullable_to_non_nullable +as String?,serverName: freezed == serverName ? _self.serverName : serverName // ignore: cast_nullable_to_non_nullable +as String?,raw: freezed == raw ? _self.raw : raw // ignore: cast_nullable_to_non_nullable +as Map?, + )); +} + + +} + +// dart format on diff --git a/lib/media/media_item.g.dart b/lib/media/media_item.g.dart new file mode 100644 index 00000000..bf59a4a4 --- /dev/null +++ b/lib/media/media_item.g.dart @@ -0,0 +1,259 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'media_item.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PlexMediaItem _$PlexMediaItemFromJson(Map json) => + PlexMediaItem( + id: readStringField(json, 'id') as String? ?? '', + kind: _mediaKindFromJson(json['kind']), + guid: json['guid'] as String?, + title: json['title'] as String?, + titleSort: json['titleSort'] as String?, + summary: json['summary'] as String?, + tagline: json['tagline'] as String?, + originalTitle: json['originalTitle'] as String?, + editionTitle: json['editionTitle'] as String?, + studio: json['studio'] as String?, + year: flexibleInt(json['year']), + originallyAvailableAt: json['originallyAvailableAt'] as String?, + contentRating: json['contentRating'] as String?, + parentId: json['parentId'] as String?, + parentTitle: json['parentTitle'] as String?, + parentThumbPath: json['parentThumbPath'] as String?, + parentIndex: flexibleInt(json['parentIndex']), + index: flexibleInt(json['index']), + grandparentId: json['grandparentId'] as String?, + grandparentTitle: json['grandparentTitle'] as String?, + grandparentThumbPath: json['grandparentThumbPath'] as String?, + grandparentArtPath: json['grandparentArtPath'] as String?, + thumbPath: json['thumbPath'] as String?, + artPath: json['artPath'] as String?, + clearLogoPath: json['clearLogoPath'] as String?, + backgroundSquarePath: json['backgroundSquarePath'] as String?, + durationMs: flexibleInt(json['durationMs']), + viewOffsetMs: flexibleInt(json['viewOffsetMs']), + viewCount: flexibleInt(json['viewCount']), + lastViewedAt: flexibleInt(json['lastViewedAt']), + leafCount: flexibleInt(json['leafCount']), + viewedLeafCount: flexibleInt(json['viewedLeafCount']), + childCount: flexibleInt(json['childCount']), + addedAt: flexibleInt(json['addedAt']), + updatedAt: flexibleInt(json['updatedAt']), + rating: flexibleDouble(json['rating']), + audienceRating: flexibleDouble(json['audienceRating']), + userRating: flexibleDouble(json['userRating']), + ratingImage: json['ratingImage'] as String?, + audienceRatingImage: json['audienceRatingImage'] as String?, + genres: _mediaItemStringList(json['genres']), + directors: _mediaItemStringList(json['directors']), + writers: _mediaItemStringList(json['writers']), + producers: _mediaItemStringList(json['producers']), + countries: _mediaItemStringList(json['countries']), + collections: _mediaItemStringList(json['collections']), + labels: _mediaItemStringList(json['labels']), + styles: _mediaItemStringList(json['styles']), + moods: _mediaItemStringList(json['moods']), + roles: _mediaItemRolesFromJson(json['roles']), + mediaVersions: _mediaItemVersionsFromJson(json['mediaVersions']), + libraryId: json['libraryId'] as String?, + libraryTitle: json['libraryTitle'] as String?, + audioLanguage: json['audioLanguage'] as String?, + subtitleLanguage: json['subtitleLanguage'] as String?, + subtitleMode: flexibleInt(json['subtitleMode']), + trailerKey: json['trailerKey'] as String?, + playlistItemId: flexibleInt(json['playlistItemId']), + playQueueItemId: flexibleInt(json['playQueueItemId']), + subtype: json['subtype'] as String?, + extraType: flexibleInt(json['extraType']), + serverId: json['serverId'] as String?, + serverName: json['serverName'] as String?, + raw: _mediaItemRawFromJson(json['raw']), + ); + +Map _$PlexMediaItemToJson(PlexMediaItem instance) => + { + 'id': instance.id, + 'kind': _mediaKindToJson(instance.kind), + 'guid': ?instance.guid, + 'title': ?instance.title, + 'titleSort': ?instance.titleSort, + 'summary': ?instance.summary, + 'tagline': ?instance.tagline, + 'originalTitle': ?instance.originalTitle, + 'editionTitle': ?instance.editionTitle, + 'studio': ?instance.studio, + 'year': ?instance.year, + 'originallyAvailableAt': ?instance.originallyAvailableAt, + 'contentRating': ?instance.contentRating, + 'parentId': ?instance.parentId, + 'parentTitle': ?instance.parentTitle, + 'parentThumbPath': ?instance.parentThumbPath, + 'parentIndex': ?instance.parentIndex, + 'index': ?instance.index, + 'grandparentId': ?instance.grandparentId, + 'grandparentTitle': ?instance.grandparentTitle, + 'grandparentThumbPath': ?instance.grandparentThumbPath, + 'grandparentArtPath': ?instance.grandparentArtPath, + 'thumbPath': ?instance.thumbPath, + 'artPath': ?instance.artPath, + 'clearLogoPath': ?instance.clearLogoPath, + 'backgroundSquarePath': ?instance.backgroundSquarePath, + 'durationMs': ?instance.durationMs, + 'viewOffsetMs': ?instance.viewOffsetMs, + 'viewCount': ?instance.viewCount, + 'lastViewedAt': ?instance.lastViewedAt, + 'leafCount': ?instance.leafCount, + 'viewedLeafCount': ?instance.viewedLeafCount, + 'childCount': ?instance.childCount, + 'addedAt': ?instance.addedAt, + 'updatedAt': ?instance.updatedAt, + 'rating': ?instance.rating, + 'audienceRating': ?instance.audienceRating, + 'userRating': ?instance.userRating, + 'ratingImage': ?instance.ratingImage, + 'audienceRatingImage': ?instance.audienceRatingImage, + 'genres': ?instance.genres, + 'directors': ?instance.directors, + 'writers': ?instance.writers, + 'producers': ?instance.producers, + 'countries': ?instance.countries, + 'collections': ?instance.collections, + 'labels': ?instance.labels, + 'styles': ?instance.styles, + 'moods': ?instance.moods, + 'roles': ?instance.roles?.map((e) => e.toJson()).toList(), + 'mediaVersions': ?instance.mediaVersions?.map((e) => e.toJson()).toList(), + 'libraryId': ?instance.libraryId, + 'libraryTitle': ?instance.libraryTitle, + 'audioLanguage': ?instance.audioLanguage, + 'subtitleLanguage': ?instance.subtitleLanguage, + 'subtitleMode': ?instance.subtitleMode, + 'trailerKey': ?instance.trailerKey, + 'playlistItemId': ?instance.playlistItemId, + 'playQueueItemId': ?instance.playQueueItemId, + 'subtype': ?instance.subtype, + 'extraType': ?instance.extraType, + 'serverId': ?instance.serverId, + 'serverName': ?instance.serverName, + 'raw': ?instance.raw, + }; + +JellyfinMediaItem _$JellyfinMediaItemFromJson(Map json) => + JellyfinMediaItem( + id: readStringField(json, 'id') as String? ?? '', + kind: _mediaKindFromJson(json['kind']), + guid: json['guid'] as String?, + title: json['title'] as String?, + titleSort: json['titleSort'] as String?, + summary: json['summary'] as String?, + tagline: json['tagline'] as String?, + originalTitle: json['originalTitle'] as String?, + studio: json['studio'] as String?, + year: flexibleInt(json['year']), + originallyAvailableAt: json['originallyAvailableAt'] as String?, + contentRating: json['contentRating'] as String?, + parentId: json['parentId'] as String?, + parentTitle: json['parentTitle'] as String?, + parentThumbPath: json['parentThumbPath'] as String?, + parentIndex: flexibleInt(json['parentIndex']), + index: flexibleInt(json['index']), + grandparentId: json['grandparentId'] as String?, + grandparentTitle: json['grandparentTitle'] as String?, + grandparentThumbPath: json['grandparentThumbPath'] as String?, + grandparentArtPath: json['grandparentArtPath'] as String?, + thumbPath: json['thumbPath'] as String?, + artPath: json['artPath'] as String?, + clearLogoPath: json['clearLogoPath'] as String?, + backgroundSquarePath: json['backgroundSquarePath'] as String?, + durationMs: flexibleInt(json['durationMs']), + viewOffsetMs: flexibleInt(json['viewOffsetMs']), + viewCount: flexibleInt(json['viewCount']), + lastViewedAt: flexibleInt(json['lastViewedAt']), + leafCount: flexibleInt(json['leafCount']), + viewedLeafCount: flexibleInt(json['viewedLeafCount']), + childCount: flexibleInt(json['childCount']), + addedAt: flexibleInt(json['addedAt']), + updatedAt: flexibleInt(json['updatedAt']), + rating: flexibleDouble(json['rating']), + userRating: flexibleDouble(json['userRating']), + genres: _mediaItemStringList(json['genres']), + directors: _mediaItemStringList(json['directors']), + writers: _mediaItemStringList(json['writers']), + producers: _mediaItemStringList(json['producers']), + countries: _mediaItemStringList(json['countries']), + collections: _mediaItemStringList(json['collections']), + labels: _mediaItemStringList(json['labels']), + styles: _mediaItemStringList(json['styles']), + moods: _mediaItemStringList(json['moods']), + roles: _mediaItemRolesFromJson(json['roles']), + mediaVersions: _mediaItemVersionsFromJson(json['mediaVersions']), + libraryId: json['libraryId'] as String?, + libraryTitle: json['libraryTitle'] as String?, + audioLanguage: json['audioLanguage'] as String?, + playlistItemId: json['playlistItemId'] as String?, + serverId: json['serverId'] as String?, + serverName: json['serverName'] as String?, + raw: _mediaItemRawFromJson(json['raw']), + ); + +Map _$JellyfinMediaItemToJson(JellyfinMediaItem instance) => + { + 'id': instance.id, + 'kind': _mediaKindToJson(instance.kind), + 'guid': ?instance.guid, + 'title': ?instance.title, + 'titleSort': ?instance.titleSort, + 'summary': ?instance.summary, + 'tagline': ?instance.tagline, + 'originalTitle': ?instance.originalTitle, + 'studio': ?instance.studio, + 'year': ?instance.year, + 'originallyAvailableAt': ?instance.originallyAvailableAt, + 'contentRating': ?instance.contentRating, + 'parentId': ?instance.parentId, + 'parentTitle': ?instance.parentTitle, + 'parentThumbPath': ?instance.parentThumbPath, + 'parentIndex': ?instance.parentIndex, + 'index': ?instance.index, + 'grandparentId': ?instance.grandparentId, + 'grandparentTitle': ?instance.grandparentTitle, + 'grandparentThumbPath': ?instance.grandparentThumbPath, + 'grandparentArtPath': ?instance.grandparentArtPath, + 'thumbPath': ?instance.thumbPath, + 'artPath': ?instance.artPath, + 'clearLogoPath': ?instance.clearLogoPath, + 'backgroundSquarePath': ?instance.backgroundSquarePath, + 'durationMs': ?instance.durationMs, + 'viewOffsetMs': ?instance.viewOffsetMs, + 'viewCount': ?instance.viewCount, + 'lastViewedAt': ?instance.lastViewedAt, + 'leafCount': ?instance.leafCount, + 'viewedLeafCount': ?instance.viewedLeafCount, + 'childCount': ?instance.childCount, + 'addedAt': ?instance.addedAt, + 'updatedAt': ?instance.updatedAt, + 'rating': ?instance.rating, + 'userRating': ?instance.userRating, + 'genres': ?instance.genres, + 'directors': ?instance.directors, + 'writers': ?instance.writers, + 'producers': ?instance.producers, + 'countries': ?instance.countries, + 'collections': ?instance.collections, + 'labels': ?instance.labels, + 'styles': ?instance.styles, + 'moods': ?instance.moods, + 'roles': ?instance.roles?.map((e) => e.toJson()).toList(), + 'mediaVersions': ?instance.mediaVersions?.map((e) => e.toJson()).toList(), + 'libraryId': ?instance.libraryId, + 'libraryTitle': ?instance.libraryTitle, + 'audioLanguage': ?instance.audioLanguage, + 'playlistItemId': ?instance.playlistItemId, + 'serverId': ?instance.serverId, + 'serverName': ?instance.serverName, + 'raw': ?instance.raw, + }; diff --git a/lib/media/media_item/base.dart b/lib/media/media_item/base.dart deleted file mode 100644 index 86e46595..00000000 --- a/lib/media/media_item/base.dart +++ /dev/null @@ -1,682 +0,0 @@ -part of '../media_item.dart'; - -/// Backend-neutral media item — the central domain type the app's UI, -/// providers, and persistence layer operate on. Each backend's adapter is -/// responsible for mapping its native representation (Plex `Metadata`, -/// Jellyfin `BaseItemDto`) into this shape. -/// -/// Sealed root with two concrete subclasses: [PlexMediaItem] (carries -/// Plex-only fields like `trailerKey`, `playQueueItemId`, `audienceRating`) -/// and [JellyfinMediaItem] (only the backend-neutral fields). Read sites -/// that need a Plex-only field type-narrow with -/// `case PlexMediaItem(:final trailerKey?)` or -/// `if (item is PlexMediaItem) item.trailerKey`. -sealed class MediaItem { - /// Backend-opaque identifier (Plex `ratingKey`, Jellyfin `Id`). - final String id; - final MediaBackend backend; - final MediaKind kind; - - /// Stable cross-backend identifier (Plex `guid`, Jellyfin `Id` URI). Used - /// for matching across servers and for Trakt-style external lookups. - final String? guid; - - final String? title; - final String? titleSort; - final String? summary; - final String? tagline; - final String? originalTitle; - final String? studio; - final int? year; - - /// Original release date (`YYYY-MM-DD`). - final String? originallyAvailableAt; - final String? contentRating; - - final String? parentId; - final String? parentTitle; - final String? parentThumbPath; - final int? parentIndex; - final int? index; - final String? grandparentId; - final String? grandparentTitle; - final String? grandparentThumbPath; - final String? grandparentArtPath; - - final String? thumbPath; - final String? artPath; - final String? clearLogoPath; - final String? backgroundSquarePath; - - final int? durationMs; - - /// Resume position in ms. - final int? viewOffsetMs; - final int? viewCount; - final int? lastViewedAt; - - /// Total leaf items (episodes in a show/season, items in a collection). - final int? leafCount; - - /// Watched leaf items. - final int? viewedLeafCount; - - /// Direct children count (e.g. seasons in a show). - final int? childCount; - - final int? addedAt; - final int? updatedAt; - - final double? rating; - final double? userRating; - - final List? genres; - final List? directors; - final List? writers; - final List? producers; - final List? countries; - final List? collections; - final List? labels; - final List? styles; - final List? moods; - final List? roles; - - final List? mediaVersions; - - /// Backend-opaque library/section id this item belongs to. - final String? libraryId; - final String? libraryTitle; - - /// Preferred audio language for this item — used by track-selection - /// fallback (Priority 3) on both backends. Plex persists changes via - /// [PlexClient.setMetadataPreferences]; Jellyfin populates it from the - /// per-user `PreferredMetadataLanguage` field but has no per-item write - /// endpoint, so the value is read-only there. - final String? audioLanguage; - - final String? serverId; - final String? serverName; - - /// Untyped fall-through for backend-specific fields not yet mapped onto a - /// typed accessor. Use sparingly; promote to typed fields when stable. - final Map? raw; - - const MediaItem._({ - required this.id, - required this.backend, - required this.kind, - this.guid, - this.title, - this.titleSort, - this.summary, - this.tagline, - this.originalTitle, - this.studio, - this.year, - this.originallyAvailableAt, - this.contentRating, - this.parentId, - this.parentTitle, - this.parentThumbPath, - this.parentIndex, - this.index, - this.grandparentId, - this.grandparentTitle, - this.grandparentThumbPath, - this.grandparentArtPath, - this.thumbPath, - this.artPath, - this.clearLogoPath, - this.backgroundSquarePath, - this.durationMs, - this.viewOffsetMs, - this.viewCount, - this.lastViewedAt, - this.leafCount, - this.viewedLeafCount, - this.childCount, - this.addedAt, - this.updatedAt, - this.rating, - this.userRating, - this.genres, - this.directors, - this.writers, - this.producers, - this.countries, - this.collections, - this.labels, - this.styles, - this.moods, - this.roles, - this.mediaVersions, - this.libraryId, - this.libraryTitle, - this.audioLanguage, - this.serverId, - this.serverName, - this.raw, - }); - - /// Backend-dispatching factory: constructs the right concrete subclass - /// for the given [backend]. - factory MediaItem({ - required String id, - required MediaBackend backend, - required MediaKind kind, - String? guid, - String? title, - String? titleSort, - String? summary, - String? tagline, - String? originalTitle, - String? studio, - int? year, - String? originallyAvailableAt, - String? contentRating, - String? parentId, - String? parentTitle, - String? parentThumbPath, - int? parentIndex, - int? index, - String? grandparentId, - String? grandparentTitle, - String? grandparentThumbPath, - String? grandparentArtPath, - String? thumbPath, - String? artPath, - String? clearLogoPath, - String? backgroundSquarePath, - int? durationMs, - int? viewOffsetMs, - int? viewCount, - int? lastViewedAt, - int? leafCount, - int? viewedLeafCount, - int? childCount, - int? addedAt, - int? updatedAt, - double? rating, - double? userRating, - List? genres, - List? directors, - List? writers, - List? producers, - List? countries, - List? collections, - List? labels, - List? styles, - List? moods, - List? roles, - List? mediaVersions, - String? libraryId, - String? libraryTitle, - String? audioLanguage, - - /// Plex-only — silently ignored when [backend] is Jellyfin (Jellyfin has - /// no per-item subtitle preference write endpoint). Forwarded to - /// [PlexMediaItem] only. - String? subtitleLanguage, - int? subtitleMode, - String? serverId, - String? serverName, - Map? raw, - }) { - return switch (backend) { - MediaBackend.plex => PlexMediaItem( - id: id, - kind: kind, - guid: guid, - title: title, - titleSort: titleSort, - summary: summary, - tagline: tagline, - originalTitle: originalTitle, - studio: studio, - year: year, - originallyAvailableAt: originallyAvailableAt, - contentRating: contentRating, - parentId: parentId, - parentTitle: parentTitle, - parentThumbPath: parentThumbPath, - parentIndex: parentIndex, - index: index, - grandparentId: grandparentId, - grandparentTitle: grandparentTitle, - grandparentThumbPath: grandparentThumbPath, - grandparentArtPath: grandparentArtPath, - thumbPath: thumbPath, - artPath: artPath, - clearLogoPath: clearLogoPath, - backgroundSquarePath: backgroundSquarePath, - durationMs: durationMs, - viewOffsetMs: viewOffsetMs, - viewCount: viewCount, - lastViewedAt: lastViewedAt, - leafCount: leafCount, - viewedLeafCount: viewedLeafCount, - childCount: childCount, - addedAt: addedAt, - updatedAt: updatedAt, - rating: rating, - userRating: userRating, - genres: genres, - directors: directors, - writers: writers, - producers: producers, - countries: countries, - collections: collections, - labels: labels, - styles: styles, - moods: moods, - roles: roles, - mediaVersions: mediaVersions, - libraryId: libraryId, - libraryTitle: libraryTitle, - audioLanguage: audioLanguage, - subtitleLanguage: subtitleLanguage, - subtitleMode: subtitleMode, - serverId: serverId, - serverName: serverName, - raw: raw, - ), - MediaBackend.jellyfin => JellyfinMediaItem( - id: id, - kind: kind, - guid: guid, - title: title, - titleSort: titleSort, - summary: summary, - tagline: tagline, - originalTitle: originalTitle, - studio: studio, - year: year, - originallyAvailableAt: originallyAvailableAt, - contentRating: contentRating, - parentId: parentId, - parentTitle: parentTitle, - parentThumbPath: parentThumbPath, - parentIndex: parentIndex, - index: index, - grandparentId: grandparentId, - grandparentTitle: grandparentTitle, - grandparentThumbPath: grandparentThumbPath, - grandparentArtPath: grandparentArtPath, - thumbPath: thumbPath, - artPath: artPath, - clearLogoPath: clearLogoPath, - backgroundSquarePath: backgroundSquarePath, - durationMs: durationMs, - viewOffsetMs: viewOffsetMs, - viewCount: viewCount, - lastViewedAt: lastViewedAt, - leafCount: leafCount, - viewedLeafCount: viewedLeafCount, - childCount: childCount, - addedAt: addedAt, - updatedAt: updatedAt, - rating: rating, - userRating: userRating, - genres: genres, - directors: directors, - writers: writers, - producers: producers, - countries: countries, - collections: collections, - labels: labels, - styles: styles, - moods: moods, - roles: roles, - mediaVersions: mediaVersions, - libraryId: libraryId, - libraryTitle: libraryTitle, - audioLanguage: audioLanguage, - serverId: serverId, - serverName: serverName, - raw: raw, - ), - }; - } - - /// Global unique identifier across all servers (`serverId:id`). Falls back - /// to bare [id] if [serverId] is missing. - String get globalKey => serverId != null ? buildGlobalKey(serverId!, id) : id; - - /// Global unique identifier of this item's library section. - String? get libraryGlobalKey => serverId != null && libraryId != null ? buildGlobalKey(serverId!, libraryId!) : null; - - /// Parent rating keys for hierarchical invalidation. For an episode: - /// `[seasonId, showId]`. For a season: `[showId]`. For a movie: `[]`. - List get parentChain => [?parentId, ?grandparentId]; - - /// Whether this item has started but not finished playback. - bool get hasActiveProgress { - if (durationMs == null || viewOffsetMs == null) return false; - return viewOffsetMs! > 0 && viewOffsetMs! < durationMs!; - } - - /// Whether this container (show/season) has some but not all leaves watched. - bool get isPartiallyWatched => - viewedLeafCount != null && leafCount != null && viewedLeafCount! > 0 && viewedLeafCount! < leafCount!; - - /// Whether the item is fully watched. Series/seasons consult leaf counts; - /// individual movies/episodes use [viewCount]. - bool get isWatched { - if (leafCount != null && viewedLeafCount != null) { - return viewedLeafCount! >= leafCount!; - } - return viewCount != null && viewCount! > 0; - } - - /// Display-friendly title that prefers the show name for episodes/seasons. - String get displayTitle { - if ((kind == MediaKind.episode || kind == MediaKind.season) && grandparentTitle != null) { - return grandparentTitle!; - } - if (kind == MediaKind.season && parentTitle != null) { - return parentTitle!; - } - return title ?? ''; - } - - /// Subtitle line shown below [displayTitle] for episodes/seasons. - String? get displaySubtitle { - if (kind == MediaKind.episode || kind == MediaKind.season) { - if (grandparentTitle != null || (kind == MediaKind.season && parentTitle != null)) { - return title; - } - } - return null; - } - - /// Plex-only edition label (e.g. "Director's Cut"). Returns null on - /// backends that don't model editions; lets callers avoid type-narrowing - /// to [PlexMediaItem] just to read this field. - String? get editionTitle => null; - - /// Returns the appropriate poster path based on episode poster mode. - /// - /// For episodes: - /// - `seriesPoster`: grandparentThumb (series poster) - /// - `seasonPoster`: parentThumb (season poster) - /// - `episodeThumbnail`: thumb (16:9 episode still) - /// - /// For seasons: returns grandparentThumb (series poster), or art/thumb in - /// mixed hub context. - /// For movies/shows in mixed hub context with episode-thumbnail mode: - /// returns art (16:9 background). - /// For other types: returns thumb. - String? posterThumb({EpisodePosterMode mode = EpisodePosterMode.seriesPoster, bool mixedHubContext = false}) { - if (kind == MediaKind.episode) { - switch (mode) { - case EpisodePosterMode.episodeThumbnail: - return thumbPath; - case EpisodePosterMode.seasonPoster: - return parentThumbPath ?? grandparentThumbPath ?? thumbPath; - case EpisodePosterMode.seriesPoster: - return grandparentThumbPath ?? thumbPath; - } - } else if (kind == MediaKind.season) { - if (mixedHubContext && mode == EpisodePosterMode.episodeThumbnail) { - return artPath ?? thumbPath; - } - if (grandparentThumbPath != null) { - return grandparentThumbPath; - } - } - - if (mixedHubContext && - mode == EpisodePosterMode.episodeThumbnail && - (kind == MediaKind.movie || kind == MediaKind.show)) { - return artPath ?? thumbPath; - } - - return thumbPath; - } - - /// Secondary poster path to try when [posterThumb] returns an image URL that - /// exists syntactically but the server cannot serve it. - String? posterThumbFallback({EpisodePosterMode mode = EpisodePosterMode.seriesPoster, bool mixedHubContext = false}) { - if (kind != MediaKind.episode || mode != EpisodePosterMode.seasonPoster) return null; - final fallback = grandparentThumbPath ?? thumbPath; - return fallback != null && fallback != posterThumb(mode: mode, mixedHubContext: mixedHubContext) ? fallback : null; - } - - /// True when the item should render in 16:9. - /// - Clips are always 16:9. - /// - Episodes are 16:9 in `episodeThumbnail` mode. - /// - Movies/shows/seasons are 16:9 in mixed-hub `episodeThumbnail` context. - bool usesWideAspectRatio(EpisodePosterMode mode, {bool mixedHubContext = false}) { - if (kind == MediaKind.clip) return true; - if (kind == MediaKind.episode && mode == EpisodePosterMode.episodeThumbnail) { - return true; - } - if (mixedHubContext && - mode == EpisodePosterMode.episodeThumbnail && - (kind == MediaKind.movie || kind == MediaKind.show || kind == MediaKind.season)) { - return true; - } - return false; - } - - /// Returns the best hero art path based on the container's aspect ratio. - /// Uses backgroundSquare when the container is closer to 1:1 than 16:9. - String? heroArt({required double containerAspectRatio}) { - final candidates = heroArtCandidates(containerAspectRatio: containerAspectRatio); - if (candidates.isEmpty) return null; - return candidates.first; - } - - /// Returns hero art candidates in display-preference order. - /// Near-square containers prefer square art, then fall back to wide cover art. - List heroArtCandidates({required double containerAspectRatio}) { - // Threshold = midpoint of 1:1 (1.0) and 16:9 (~1.78) ≈ 1.39 - final preferred = containerAspectRatio < 1.39 ? [backgroundSquarePath, artPath] : [artPath, backgroundSquarePath]; - - final candidates = []; - for (final path in preferred) { - if (path == null || path.isEmpty || candidates.contains(path)) continue; - candidates.add(path); - } - return candidates; - } - - MediaItem copyWith({ - String? id, - MediaBackend? backend, - MediaKind? kind, - String? guid, - String? title, - String? titleSort, - String? summary, - String? tagline, - String? originalTitle, - String? studio, - int? year, - String? originallyAvailableAt, - String? contentRating, - String? parentId, - String? parentTitle, - String? parentThumbPath, - int? parentIndex, - int? index, - String? grandparentId, - String? grandparentTitle, - String? grandparentThumbPath, - String? grandparentArtPath, - String? thumbPath, - String? artPath, - String? clearLogoPath, - String? backgroundSquarePath, - int? durationMs, - int? viewOffsetMs, - int? viewCount, - int? lastViewedAt, - int? leafCount, - int? viewedLeafCount, - int? childCount, - int? addedAt, - int? updatedAt, - double? rating, - double? userRating, - List? genres, - List? directors, - List? writers, - List? producers, - List? countries, - List? collections, - List? labels, - List? styles, - List? moods, - List? roles, - List? mediaVersions, - String? libraryId, - String? libraryTitle, - String? audioLanguage, - - /// Plex-only — forwarded only when this item is a [PlexMediaItem]. - String? subtitleLanguage, - int? subtitleMode, - String? serverId, - String? serverName, - Map? raw, - }) { - return MediaItem( - id: id ?? this.id, - backend: backend ?? this.backend, - kind: kind ?? this.kind, - guid: guid ?? this.guid, - title: title ?? this.title, - titleSort: titleSort ?? this.titleSort, - summary: summary ?? this.summary, - tagline: tagline ?? this.tagline, - originalTitle: originalTitle ?? this.originalTitle, - studio: studio ?? this.studio, - year: year ?? this.year, - originallyAvailableAt: originallyAvailableAt ?? this.originallyAvailableAt, - contentRating: contentRating ?? this.contentRating, - parentId: parentId ?? this.parentId, - parentTitle: parentTitle ?? this.parentTitle, - parentThumbPath: parentThumbPath ?? this.parentThumbPath, - parentIndex: parentIndex ?? this.parentIndex, - index: index ?? this.index, - grandparentId: grandparentId ?? this.grandparentId, - grandparentTitle: grandparentTitle ?? this.grandparentTitle, - grandparentThumbPath: grandparentThumbPath ?? this.grandparentThumbPath, - grandparentArtPath: grandparentArtPath ?? this.grandparentArtPath, - thumbPath: thumbPath ?? this.thumbPath, - artPath: artPath ?? this.artPath, - clearLogoPath: clearLogoPath ?? this.clearLogoPath, - backgroundSquarePath: backgroundSquarePath ?? this.backgroundSquarePath, - durationMs: durationMs ?? this.durationMs, - viewOffsetMs: viewOffsetMs ?? this.viewOffsetMs, - viewCount: viewCount ?? this.viewCount, - lastViewedAt: lastViewedAt ?? this.lastViewedAt, - leafCount: leafCount ?? this.leafCount, - viewedLeafCount: viewedLeafCount ?? this.viewedLeafCount, - childCount: childCount ?? this.childCount, - addedAt: addedAt ?? this.addedAt, - updatedAt: updatedAt ?? this.updatedAt, - rating: rating ?? this.rating, - userRating: userRating ?? this.userRating, - genres: genres ?? this.genres, - directors: directors ?? this.directors, - writers: writers ?? this.writers, - producers: producers ?? this.producers, - countries: countries ?? this.countries, - collections: collections ?? this.collections, - labels: labels ?? this.labels, - styles: styles ?? this.styles, - moods: moods ?? this.moods, - roles: roles ?? this.roles, - mediaVersions: mediaVersions ?? this.mediaVersions, - libraryId: libraryId ?? this.libraryId, - libraryTitle: libraryTitle ?? this.libraryTitle, - audioLanguage: audioLanguage ?? this.audioLanguage, - // [subtitleLanguage] / [subtitleMode] are Plex-only fields. Base - // [MediaItem] doesn't carry them; [PlexMediaItem.copyWith] overrides - // this method and forwards its own copies. For Jellyfin items the - // params are silently dropped. - subtitleLanguage: subtitleLanguage, - subtitleMode: subtitleMode, - serverId: serverId ?? this.serverId, - serverName: serverName ?? this.serverName, - raw: raw ?? this.raw, - ); - } - - /// Serialize to a backend-neutral JSON map. Used by the offline cache so - /// downloads retain their metadata without round-tripping through a - /// backend-specific shape. - /// - /// Subclasses extend this with their own backend-specific keys - /// ([PlexMediaItem.toJson] adds the Plex-only fields). - Map toJson() { - return { - 'id': id, - 'backend': backend.id, - 'kind': kind.id, - if (guid != null) 'guid': guid, - if (title != null) 'title': title, - if (titleSort != null) 'titleSort': titleSort, - if (summary != null) 'summary': summary, - if (tagline != null) 'tagline': tagline, - if (originalTitle != null) 'originalTitle': originalTitle, - if (studio != null) 'studio': studio, - if (year != null) 'year': year, - if (originallyAvailableAt != null) 'originallyAvailableAt': originallyAvailableAt, - if (contentRating != null) 'contentRating': contentRating, - if (parentId != null) 'parentId': parentId, - if (parentTitle != null) 'parentTitle': parentTitle, - if (parentThumbPath != null) 'parentThumbPath': parentThumbPath, - if (parentIndex != null) 'parentIndex': parentIndex, - if (index != null) 'index': index, - if (grandparentId != null) 'grandparentId': grandparentId, - if (grandparentTitle != null) 'grandparentTitle': grandparentTitle, - if (grandparentThumbPath != null) 'grandparentThumbPath': grandparentThumbPath, - if (grandparentArtPath != null) 'grandparentArtPath': grandparentArtPath, - if (thumbPath != null) 'thumbPath': thumbPath, - if (artPath != null) 'artPath': artPath, - if (clearLogoPath != null) 'clearLogoPath': clearLogoPath, - if (backgroundSquarePath != null) 'backgroundSquarePath': backgroundSquarePath, - if (durationMs != null) 'durationMs': durationMs, - if (viewOffsetMs != null) 'viewOffsetMs': viewOffsetMs, - if (viewCount != null) 'viewCount': viewCount, - if (lastViewedAt != null) 'lastViewedAt': lastViewedAt, - if (leafCount != null) 'leafCount': leafCount, - if (viewedLeafCount != null) 'viewedLeafCount': viewedLeafCount, - if (childCount != null) 'childCount': childCount, - if (addedAt != null) 'addedAt': addedAt, - if (updatedAt != null) 'updatedAt': updatedAt, - if (rating != null) 'rating': rating, - if (userRating != null) 'userRating': userRating, - if (genres != null) 'genres': genres, - if (directors != null) 'directors': directors, - if (writers != null) 'writers': writers, - if (producers != null) 'producers': producers, - if (countries != null) 'countries': countries, - if (collections != null) 'collections': collections, - if (labels != null) 'labels': labels, - if (styles != null) 'styles': styles, - if (moods != null) 'moods': moods, - if (roles != null) 'roles': [for (final r in roles!) _roleToJson(r)], - if (mediaVersions != null) 'mediaVersions': [for (final v in mediaVersions!) _versionToJson(v)], - if (libraryId != null) 'libraryId': libraryId, - if (libraryTitle != null) 'libraryTitle': libraryTitle, - if (audioLanguage != null) 'audioLanguage': audioLanguage, - if (serverId != null) 'serverId': serverId, - if (serverName != null) 'serverName': serverName, - if (raw != null) 'raw': raw, - }; - } - - /// Restore a [MediaItem] from a [toJson] payload. Dispatches to - /// [PlexMediaItem.fromJson] when the payload's `backend` tag is Plex so - /// the Plex-only fields round-trip correctly. Unknown shapes degrade to a - /// minimal item carrying just `id` so cache misses don't crash. - factory MediaItem.fromJson(Map json) { - final backend = MediaBackend.fromString(json['backend'] as String?); - if (backend == MediaBackend.plex) return PlexMediaItem.fromJson(json); - return JellyfinMediaItem.fromJson(json); - } -} diff --git a/lib/media/media_item/jellyfin.dart b/lib/media/media_item/jellyfin.dart deleted file mode 100644 index f7ab3c65..00000000 --- a/lib/media/media_item/jellyfin.dart +++ /dev/null @@ -1,258 +0,0 @@ -part of '../media_item.dart'; - -/// Backend-tagged concrete subclass for items sourced from a Jellyfin -/// server. Carries only the backend-neutral fields — Plex-only fields -/// (trailerKey, audienceRating, etc.) live on [PlexMediaItem] instead. -final class JellyfinMediaItem extends MediaItem { - /// Jellyfin per-playlist item id — only set when the item came out of - /// `/Playlists/{id}/Items`. Used as the `entryIds` / move-target id for - /// the playlist write endpoints. Null outside playlist contexts. - final String? playlistItemId; - - const JellyfinMediaItem({ - required super.id, - required super.kind, - super.guid, - super.title, - super.titleSort, - super.summary, - super.tagline, - super.originalTitle, - super.studio, - super.year, - super.originallyAvailableAt, - super.contentRating, - super.parentId, - super.parentTitle, - super.parentThumbPath, - super.parentIndex, - super.index, - super.grandparentId, - super.grandparentTitle, - super.grandparentThumbPath, - super.grandparentArtPath, - super.thumbPath, - super.artPath, - super.clearLogoPath, - super.backgroundSquarePath, - super.durationMs, - super.viewOffsetMs, - super.viewCount, - super.lastViewedAt, - super.leafCount, - super.viewedLeafCount, - super.childCount, - super.addedAt, - super.updatedAt, - super.rating, - super.userRating, - super.genres, - super.directors, - super.writers, - super.producers, - super.countries, - super.collections, - super.labels, - super.styles, - super.moods, - super.roles, - super.mediaVersions, - super.libraryId, - super.libraryTitle, - super.audioLanguage, - this.playlistItemId, - super.serverId, - super.serverName, - super.raw, - }) : super._(backend: MediaBackend.jellyfin); - - /// Override the base [MediaItem.copyWith] so [playlistItemId] survives - /// round-trips through the absolutizer (which calls copyWith to rewrite - /// image paths). Without this, every Jellyfin playlist item came out with - /// `playlistItemId == null` after mapping, making the move/remove endpoints - /// silently no-op. - @override - JellyfinMediaItem copyWith({ - String? id, - MediaBackend? backend, - MediaKind? kind, - String? guid, - String? title, - String? titleSort, - String? summary, - String? tagline, - String? originalTitle, - String? studio, - int? year, - String? originallyAvailableAt, - String? contentRating, - String? parentId, - String? parentTitle, - String? parentThumbPath, - int? parentIndex, - int? index, - String? grandparentId, - String? grandparentTitle, - String? grandparentThumbPath, - String? grandparentArtPath, - String? thumbPath, - String? artPath, - String? clearLogoPath, - String? backgroundSquarePath, - int? durationMs, - int? viewOffsetMs, - int? viewCount, - int? lastViewedAt, - int? leafCount, - int? viewedLeafCount, - int? childCount, - int? addedAt, - int? updatedAt, - double? rating, - double? userRating, - List? genres, - List? directors, - List? writers, - List? producers, - List? countries, - List? collections, - List? labels, - List? styles, - List? moods, - List? roles, - List? mediaVersions, - String? libraryId, - String? libraryTitle, - String? audioLanguage, - String? subtitleLanguage, - int? subtitleMode, - String? playlistItemId, - String? serverId, - String? serverName, - Map? raw, - }) { - return JellyfinMediaItem( - id: id ?? this.id, - kind: kind ?? this.kind, - guid: guid ?? this.guid, - title: title ?? this.title, - titleSort: titleSort ?? this.titleSort, - summary: summary ?? this.summary, - tagline: tagline ?? this.tagline, - originalTitle: originalTitle ?? this.originalTitle, - studio: studio ?? this.studio, - year: year ?? this.year, - originallyAvailableAt: originallyAvailableAt ?? this.originallyAvailableAt, - contentRating: contentRating ?? this.contentRating, - parentId: parentId ?? this.parentId, - parentTitle: parentTitle ?? this.parentTitle, - parentThumbPath: parentThumbPath ?? this.parentThumbPath, - parentIndex: parentIndex ?? this.parentIndex, - index: index ?? this.index, - grandparentId: grandparentId ?? this.grandparentId, - grandparentTitle: grandparentTitle ?? this.grandparentTitle, - grandparentThumbPath: grandparentThumbPath ?? this.grandparentThumbPath, - grandparentArtPath: grandparentArtPath ?? this.grandparentArtPath, - thumbPath: thumbPath ?? this.thumbPath, - artPath: artPath ?? this.artPath, - clearLogoPath: clearLogoPath ?? this.clearLogoPath, - backgroundSquarePath: backgroundSquarePath ?? this.backgroundSquarePath, - durationMs: durationMs ?? this.durationMs, - viewOffsetMs: viewOffsetMs ?? this.viewOffsetMs, - viewCount: viewCount ?? this.viewCount, - lastViewedAt: lastViewedAt ?? this.lastViewedAt, - leafCount: leafCount ?? this.leafCount, - viewedLeafCount: viewedLeafCount ?? this.viewedLeafCount, - childCount: childCount ?? this.childCount, - addedAt: addedAt ?? this.addedAt, - updatedAt: updatedAt ?? this.updatedAt, - rating: rating ?? this.rating, - userRating: userRating ?? this.userRating, - genres: genres ?? this.genres, - directors: directors ?? this.directors, - writers: writers ?? this.writers, - producers: producers ?? this.producers, - countries: countries ?? this.countries, - collections: collections ?? this.collections, - labels: labels ?? this.labels, - styles: styles ?? this.styles, - moods: moods ?? this.moods, - roles: roles ?? this.roles, - mediaVersions: mediaVersions ?? this.mediaVersions, - libraryId: libraryId ?? this.libraryId, - libraryTitle: libraryTitle ?? this.libraryTitle, - audioLanguage: audioLanguage ?? this.audioLanguage, - playlistItemId: playlistItemId ?? this.playlistItemId, - serverId: serverId ?? this.serverId, - serverName: serverName ?? this.serverName, - raw: raw ?? this.raw, - ); - } - - @override - Map toJson() { - return {...super.toJson(), if (playlistItemId != null) 'playlistItemId': playlistItemId}; - } - - /// Restore a [JellyfinMediaItem] from a [toJson] payload. Used as the - /// non-Plex fallback by [MediaItem.fromJson]. - factory JellyfinMediaItem.fromJson(Map json) { - final base = _parseBaseFields(json); - return JellyfinMediaItem( - id: base.id, - kind: base.kind, - guid: base.guid, - title: base.title, - titleSort: base.titleSort, - summary: base.summary, - tagline: base.tagline, - originalTitle: base.originalTitle, - studio: base.studio, - year: base.year, - originallyAvailableAt: base.originallyAvailableAt, - contentRating: base.contentRating, - parentId: base.parentId, - parentTitle: base.parentTitle, - parentThumbPath: base.parentThumbPath, - parentIndex: base.parentIndex, - index: base.index, - grandparentId: base.grandparentId, - grandparentTitle: base.grandparentTitle, - grandparentThumbPath: base.grandparentThumbPath, - grandparentArtPath: base.grandparentArtPath, - thumbPath: base.thumbPath, - artPath: base.artPath, - clearLogoPath: base.clearLogoPath, - backgroundSquarePath: base.backgroundSquarePath, - durationMs: base.durationMs, - viewOffsetMs: base.viewOffsetMs, - viewCount: base.viewCount, - lastViewedAt: base.lastViewedAt, - leafCount: base.leafCount, - viewedLeafCount: base.viewedLeafCount, - childCount: base.childCount, - addedAt: base.addedAt, - updatedAt: base.updatedAt, - rating: base.rating, - userRating: base.userRating, - genres: base.genres, - directors: base.directors, - writers: base.writers, - producers: base.producers, - countries: base.countries, - collections: base.collections, - labels: base.labels, - styles: base.styles, - moods: base.moods, - roles: base.roles, - mediaVersions: base.mediaVersions, - libraryId: base.libraryId, - libraryTitle: base.libraryTitle, - audioLanguage: base.audioLanguage, - playlistItemId: json['playlistItemId'] as String?, - serverId: base.serverId, - serverName: base.serverName, - raw: base.raw, - ); - } -} diff --git a/lib/media/media_item/json.dart b/lib/media/media_item/json.dart deleted file mode 100644 index ce6ae18a..00000000 --- a/lib/media/media_item/json.dart +++ /dev/null @@ -1,200 +0,0 @@ -part of '../media_item.dart'; - -/// Shared parsing of the backend-neutral fields. Returns a typed record -/// consumed by both [JellyfinMediaItem.fromJson] and -/// [PlexMediaItem.fromJson] (which layers the Plex-only fields on top). -typedef _BaseFields = ({ - String id, - MediaKind kind, - String? guid, - String? title, - String? titleSort, - String? summary, - String? tagline, - String? originalTitle, - String? studio, - int? year, - String? originallyAvailableAt, - String? contentRating, - String? parentId, - String? parentTitle, - String? parentThumbPath, - int? parentIndex, - int? index, - String? grandparentId, - String? grandparentTitle, - String? grandparentThumbPath, - String? grandparentArtPath, - String? thumbPath, - String? artPath, - String? clearLogoPath, - String? backgroundSquarePath, - int? durationMs, - int? viewOffsetMs, - int? viewCount, - int? lastViewedAt, - int? leafCount, - int? viewedLeafCount, - int? childCount, - int? addedAt, - int? updatedAt, - double? rating, - double? userRating, - List? genres, - List? directors, - List? writers, - List? producers, - List? countries, - List? collections, - List? labels, - List? styles, - List? moods, - List? roles, - List? mediaVersions, - String? libraryId, - String? libraryTitle, - String? audioLanguage, - String? serverId, - String? serverName, - Map? raw, -}); - -_BaseFields _parseBaseFields(Map json) { - final rolesRaw = json['roles']; - final versionsRaw = json['mediaVersions']; - return ( - id: (json['id'] ?? '').toString(), - kind: MediaKind.fromString(json['kind'] as String?), - guid: json['guid'] as String?, - title: json['title'] as String?, - titleSort: json['titleSort'] as String?, - summary: json['summary'] as String?, - tagline: json['tagline'] as String?, - originalTitle: json['originalTitle'] as String?, - studio: json['studio'] as String?, - year: flexibleInt(json['year']), - originallyAvailableAt: json['originallyAvailableAt'] as String?, - contentRating: json['contentRating'] as String?, - parentId: json['parentId'] as String?, - parentTitle: json['parentTitle'] as String?, - parentThumbPath: json['parentThumbPath'] as String?, - parentIndex: flexibleInt(json['parentIndex']), - index: flexibleInt(json['index']), - grandparentId: json['grandparentId'] as String?, - grandparentTitle: json['grandparentTitle'] as String?, - grandparentThumbPath: json['grandparentThumbPath'] as String?, - grandparentArtPath: json['grandparentArtPath'] as String?, - thumbPath: json['thumbPath'] as String?, - artPath: json['artPath'] as String?, - clearLogoPath: json['clearLogoPath'] as String?, - backgroundSquarePath: json['backgroundSquarePath'] as String?, - durationMs: flexibleInt(json['durationMs']), - viewOffsetMs: flexibleInt(json['viewOffsetMs']), - viewCount: flexibleInt(json['viewCount']), - lastViewedAt: flexibleInt(json['lastViewedAt']), - leafCount: flexibleInt(json['leafCount']), - viewedLeafCount: flexibleInt(json['viewedLeafCount']), - childCount: flexibleInt(json['childCount']), - addedAt: flexibleInt(json['addedAt']), - updatedAt: flexibleInt(json['updatedAt']), - rating: flexibleDouble(json['rating']), - userRating: flexibleDouble(json['userRating']), - genres: _stringList(json['genres']), - directors: _stringList(json['directors']), - writers: _stringList(json['writers']), - producers: _stringList(json['producers']), - countries: _stringList(json['countries']), - collections: _stringList(json['collections']), - labels: _stringList(json['labels']), - styles: _stringList(json['styles']), - moods: _stringList(json['moods']), - roles: rolesRaw is List - ? [ - for (final r in rolesRaw) - if (r is Map) _roleFromJson(r), - ] - : null, - mediaVersions: versionsRaw is List - ? [ - for (final v in versionsRaw) - if (v is Map) _versionFromJson(v), - ] - : null, - libraryId: json['libraryId'] as String?, - libraryTitle: json['libraryTitle'] as String?, - audioLanguage: json['audioLanguage'] as String?, - serverId: json['serverId'] as String?, - serverName: json['serverName'] as String?, - raw: json['raw'] is Map ? Map.from(json['raw'] as Map) : null, - ); -} - -List? _stringList(Object? raw) { - return stringListFromRaw(raw, stringify: true); -} - -Map _roleToJson(MediaRole role) => { - if (role.id != null) 'id': role.id, - 'tag': role.tag, - if (role.role != null) 'role': role.role, - if (role.thumbPath != null) 'thumbPath': role.thumbPath, -}; - -MediaRole _roleFromJson(Map json) => MediaRole( - id: json['id'] as String?, - tag: (json['tag'] ?? '').toString(), - role: json['role'] as String?, - thumbPath: json['thumbPath'] as String?, -); - -Map _versionToJson(MediaVersion v) => { - 'id': v.id, - if (v.width != null) 'width': v.width, - if (v.height != null) 'height': v.height, - if (v.videoResolution != null) 'videoResolution': v.videoResolution, - if (v.videoCodec != null) 'videoCodec': v.videoCodec, - if (v.bitrate != null) 'bitrate': v.bitrate, - if (v.container != null) 'container': v.container, - if (v.name != null) 'name': v.name, - 'parts': [ - for (final p in v.parts) - { - 'id': p.id, - if (p.streamPath != null) 'streamPath': p.streamPath, - if (p.sizeBytes != null) 'sizeBytes': p.sizeBytes, - if (p.container != null) 'container': p.container, - if (p.durationMs != null) 'durationMs': p.durationMs, - if (p.accessible != null) 'accessible': p.accessible, - if (p.exists != null) 'exists': p.exists, - }, - ], -}; - -MediaVersion _versionFromJson(Map json) { - final partsRaw = json['parts']; - return MediaVersion( - id: (json['id'] ?? '').toString(), - width: flexibleInt(json['width']), - height: flexibleInt(json['height']), - videoResolution: json['videoResolution'] as String?, - videoCodec: json['videoCodec'] as String?, - bitrate: flexibleInt(json['bitrate']), - container: json['container'] as String?, - name: json['name'] as String?, - parts: partsRaw is List - ? [ - for (final p in partsRaw) - if (p is Map) - MediaPart( - id: (p['id'] ?? '').toString(), - streamPath: p['streamPath'] as String?, - sizeBytes: flexibleInt(p['sizeBytes']), - container: p['container'] as String?, - durationMs: flexibleInt(p['durationMs']), - accessible: p['accessible'] as bool?, - exists: p['exists'] as bool?, - ), - ] - : const [], - ); -} diff --git a/lib/media/media_item/plex.dart b/lib/media/media_item/plex.dart deleted file mode 100644 index cf54a1c2..00000000 --- a/lib/media/media_item/plex.dart +++ /dev/null @@ -1,351 +0,0 @@ -part of '../media_item.dart'; - -/// Backend-tagged concrete subclass for items sourced from a Plex server. -/// Carries the Plex-only fields that have no Jellyfin equivalent -/// (trailerKey, playlistItemId, playQueueItemId, subtype, extraType, -/// ratingImage, audienceRating, audienceRatingImage, editionTitle). -/// Read sites that need these fields type-narrow with -/// `case PlexMediaItem(:final trailerKey?)` or -/// `if (item is PlexMediaItem) item.trailerKey`. -final class PlexMediaItem extends MediaItem { - /// Plex `editionTitle` — secondary title that distinguishes editions of - /// the same movie ("Director's Cut", "Theatrical"). Jellyfin has no - /// equivalent metadata field today. - @override - final String? editionTitle; - - /// Plex `audienceRating` (e.g. Rotten Tomatoes audience score). Jellyfin's - /// `CommunityRating` lives on [rating]; there's no separate audience field. - final double? audienceRating; - - /// Plex `ratingImage` URI ("rottentomatoes://image.rating.ripe"). Used by - /// the rating chip to pick an icon. Jellyfin doesn't expose - /// rating-source attribution. - final String? ratingImage; - - /// Plex `audienceRatingImage` URI — companion to [ratingImage] for the - /// audience score icon. - final String? audienceRatingImage; - - /// Plex per-item subtitle language preference — persisted server-side via - /// [PlexClient.setMetadataPreferences]. Jellyfin has no equivalent - /// per-item write endpoint, so the field lives here rather than on the - /// neutral [MediaItem] base. - final String? subtitleLanguage; - - /// Plex per-item subtitle mode (`0` = manual, `1` = always on, `2` = match - /// audio). Jellyfin doesn't expose a comparable knob. - final int? subtitleMode; - - /// Plex `primaryExtraKey` — points at the main trailer extra. Jellyfin - /// stores trailers separately via `RemoteTrailers`; not yet wired. - final String? trailerKey; - - /// Plex playlist item id — only set when the item came out of a - /// server-side playlist. Jellyfin has no per-playlist-item id. - final int? playlistItemId; - - /// Plex play-queue item id — set when the item is part of a server-side - /// `PlayQueue`. Jellyfin uses client-side queues; [PlaybackStateProvider] - /// tracks synthetic IDs in a parallel map for those. - final int? playQueueItemId; - - /// Plex clip subtype: `trailer`, `behindTheScenes`, `deleted`, etc. - final String? subtype; - - /// Plex numeric extra type identifier. - final int? extraType; - - const PlexMediaItem({ - required super.id, - required super.kind, - super.guid, - super.title, - super.titleSort, - super.summary, - super.tagline, - super.originalTitle, - this.editionTitle, - super.studio, - super.year, - super.originallyAvailableAt, - super.contentRating, - super.parentId, - super.parentTitle, - super.parentThumbPath, - super.parentIndex, - super.index, - super.grandparentId, - super.grandparentTitle, - super.grandparentThumbPath, - super.grandparentArtPath, - super.thumbPath, - super.artPath, - super.clearLogoPath, - super.backgroundSquarePath, - super.durationMs, - super.viewOffsetMs, - super.viewCount, - super.lastViewedAt, - super.leafCount, - super.viewedLeafCount, - super.childCount, - super.addedAt, - super.updatedAt, - super.rating, - this.audienceRating, - super.userRating, - this.ratingImage, - this.audienceRatingImage, - super.genres, - super.directors, - super.writers, - super.producers, - super.countries, - super.collections, - super.labels, - super.styles, - super.moods, - super.roles, - super.mediaVersions, - super.libraryId, - super.libraryTitle, - super.audioLanguage, - this.subtitleLanguage, - this.subtitleMode, - this.trailerKey, - this.playlistItemId, - this.playQueueItemId, - this.subtype, - this.extraType, - super.serverId, - super.serverName, - super.raw, - }) : super._(backend: MediaBackend.plex); - - @override - PlexMediaItem copyWith({ - String? id, - MediaBackend? backend, - MediaKind? kind, - String? guid, - String? title, - String? titleSort, - String? summary, - String? tagline, - String? originalTitle, - String? editionTitle, - String? studio, - int? year, - String? originallyAvailableAt, - String? contentRating, - String? parentId, - String? parentTitle, - String? parentThumbPath, - int? parentIndex, - int? index, - String? grandparentId, - String? grandparentTitle, - String? grandparentThumbPath, - String? grandparentArtPath, - String? thumbPath, - String? artPath, - String? clearLogoPath, - String? backgroundSquarePath, - int? durationMs, - int? viewOffsetMs, - int? viewCount, - int? lastViewedAt, - int? leafCount, - int? viewedLeafCount, - int? childCount, - int? addedAt, - int? updatedAt, - double? rating, - double? audienceRating, - double? userRating, - String? ratingImage, - String? audienceRatingImage, - List? genres, - List? directors, - List? writers, - List? producers, - List? countries, - List? collections, - List? labels, - List? styles, - List? moods, - List? roles, - List? mediaVersions, - String? libraryId, - String? libraryTitle, - String? audioLanguage, - String? subtitleLanguage, - int? subtitleMode, - String? trailerKey, - int? playlistItemId, - int? playQueueItemId, - String? subtype, - int? extraType, - String? serverId, - String? serverName, - Map? raw, - }) { - return PlexMediaItem( - id: id ?? this.id, - kind: kind ?? this.kind, - guid: guid ?? this.guid, - title: title ?? this.title, - titleSort: titleSort ?? this.titleSort, - summary: summary ?? this.summary, - tagline: tagline ?? this.tagline, - originalTitle: originalTitle ?? this.originalTitle, - editionTitle: editionTitle ?? this.editionTitle, - studio: studio ?? this.studio, - year: year ?? this.year, - originallyAvailableAt: originallyAvailableAt ?? this.originallyAvailableAt, - contentRating: contentRating ?? this.contentRating, - parentId: parentId ?? this.parentId, - parentTitle: parentTitle ?? this.parentTitle, - parentThumbPath: parentThumbPath ?? this.parentThumbPath, - parentIndex: parentIndex ?? this.parentIndex, - index: index ?? this.index, - grandparentId: grandparentId ?? this.grandparentId, - grandparentTitle: grandparentTitle ?? this.grandparentTitle, - grandparentThumbPath: grandparentThumbPath ?? this.grandparentThumbPath, - grandparentArtPath: grandparentArtPath ?? this.grandparentArtPath, - thumbPath: thumbPath ?? this.thumbPath, - artPath: artPath ?? this.artPath, - clearLogoPath: clearLogoPath ?? this.clearLogoPath, - backgroundSquarePath: backgroundSquarePath ?? this.backgroundSquarePath, - durationMs: durationMs ?? this.durationMs, - viewOffsetMs: viewOffsetMs ?? this.viewOffsetMs, - viewCount: viewCount ?? this.viewCount, - lastViewedAt: lastViewedAt ?? this.lastViewedAt, - leafCount: leafCount ?? this.leafCount, - viewedLeafCount: viewedLeafCount ?? this.viewedLeafCount, - childCount: childCount ?? this.childCount, - addedAt: addedAt ?? this.addedAt, - updatedAt: updatedAt ?? this.updatedAt, - rating: rating ?? this.rating, - audienceRating: audienceRating ?? this.audienceRating, - userRating: userRating ?? this.userRating, - ratingImage: ratingImage ?? this.ratingImage, - audienceRatingImage: audienceRatingImage ?? this.audienceRatingImage, - genres: genres ?? this.genres, - directors: directors ?? this.directors, - writers: writers ?? this.writers, - producers: producers ?? this.producers, - countries: countries ?? this.countries, - collections: collections ?? this.collections, - labels: labels ?? this.labels, - styles: styles ?? this.styles, - moods: moods ?? this.moods, - roles: roles ?? this.roles, - mediaVersions: mediaVersions ?? this.mediaVersions, - libraryId: libraryId ?? this.libraryId, - libraryTitle: libraryTitle ?? this.libraryTitle, - audioLanguage: audioLanguage ?? this.audioLanguage, - subtitleLanguage: subtitleLanguage ?? this.subtitleLanguage, - subtitleMode: subtitleMode ?? this.subtitleMode, - trailerKey: trailerKey ?? this.trailerKey, - playlistItemId: playlistItemId ?? this.playlistItemId, - playQueueItemId: playQueueItemId ?? this.playQueueItemId, - subtype: subtype ?? this.subtype, - extraType: extraType ?? this.extraType, - serverId: serverId ?? this.serverId, - serverName: serverName ?? this.serverName, - raw: raw ?? this.raw, - ); - } - - @override - Map toJson() { - return { - ...super.toJson(), - if (editionTitle != null) 'editionTitle': editionTitle, - if (audienceRating != null) 'audienceRating': audienceRating, - if (ratingImage != null) 'ratingImage': ratingImage, - if (audienceRatingImage != null) 'audienceRatingImage': audienceRatingImage, - if (subtitleLanguage != null) 'subtitleLanguage': subtitleLanguage, - if (subtitleMode != null) 'subtitleMode': subtitleMode, - if (trailerKey != null) 'trailerKey': trailerKey, - if (playlistItemId != null) 'playlistItemId': playlistItemId, - if (playQueueItemId != null) 'playQueueItemId': playQueueItemId, - if (subtype != null) 'subtype': subtype, - if (extraType != null) 'extraType': extraType, - }; - } - - /// Restore a [PlexMediaItem] from a [toJson] payload. Reads the Plex-only - /// keys on top of the backend-neutral fields parsed by [_parseBaseFields]. - factory PlexMediaItem.fromJson(Map json) { - final base = _parseBaseFields(json); - return PlexMediaItem( - id: base.id, - kind: base.kind, - guid: base.guid, - title: base.title, - titleSort: base.titleSort, - summary: base.summary, - tagline: base.tagline, - originalTitle: base.originalTitle, - editionTitle: json['editionTitle'] as String?, - studio: base.studio, - year: base.year, - originallyAvailableAt: base.originallyAvailableAt, - contentRating: base.contentRating, - parentId: base.parentId, - parentTitle: base.parentTitle, - parentThumbPath: base.parentThumbPath, - parentIndex: base.parentIndex, - index: base.index, - grandparentId: base.grandparentId, - grandparentTitle: base.grandparentTitle, - grandparentThumbPath: base.grandparentThumbPath, - grandparentArtPath: base.grandparentArtPath, - thumbPath: base.thumbPath, - artPath: base.artPath, - clearLogoPath: base.clearLogoPath, - backgroundSquarePath: base.backgroundSquarePath, - durationMs: base.durationMs, - viewOffsetMs: base.viewOffsetMs, - viewCount: base.viewCount, - lastViewedAt: base.lastViewedAt, - leafCount: base.leafCount, - viewedLeafCount: base.viewedLeafCount, - childCount: base.childCount, - addedAt: base.addedAt, - updatedAt: base.updatedAt, - rating: base.rating, - audienceRating: flexibleDouble(json['audienceRating']), - userRating: base.userRating, - ratingImage: json['ratingImage'] as String?, - audienceRatingImage: json['audienceRatingImage'] as String?, - genres: base.genres, - directors: base.directors, - writers: base.writers, - producers: base.producers, - countries: base.countries, - collections: base.collections, - labels: base.labels, - styles: base.styles, - moods: base.moods, - roles: base.roles, - mediaVersions: base.mediaVersions, - libraryId: base.libraryId, - libraryTitle: base.libraryTitle, - audioLanguage: base.audioLanguage, - subtitleLanguage: json['subtitleLanguage'] as String?, - subtitleMode: flexibleInt(json['subtitleMode']), - trailerKey: json['trailerKey'] as String?, - playlistItemId: flexibleInt(json['playlistItemId']), - playQueueItemId: flexibleInt(json['playQueueItemId']), - subtype: json['subtype'] as String?, - extraType: flexibleInt(json['extraType']), - serverId: base.serverId, - serverName: base.serverName, - raw: base.raw, - ); - } -} diff --git a/lib/media/media_part.dart b/lib/media/media_part.dart index 86e1b3c9..5afeb531 100644 --- a/lib/media/media_part.dart +++ b/lib/media/media_part.dart @@ -1,10 +1,17 @@ +import 'package:json_annotation/json_annotation.dart'; + +import '../utils/json_utils.dart'; import 'media_stream.dart'; +part 'media_part.g.dart'; + /// One physical file part of a [MediaVersion]. A movie typically has a single /// part; some Plex multi-part files (CD1/CD2) and DVD/BluRay rips can have /// several. Jellyfin items always map to a single part per media source. +@JsonSerializable(includeIfNull: false) class MediaPart { /// Backend-opaque part identifier. + @JsonKey(fromJson: _stringFromJson) final String id; /// Backend-specific path used to construct a direct stream URL — e.g. Plex's @@ -13,11 +20,14 @@ class MediaPart { /// appending auth. final String? streamPath; + @JsonKey(fromJson: flexibleInt) final int? sizeBytes; final String? container; + @JsonKey(fromJson: flexibleInt) final int? durationMs; final bool? accessible; final bool? exists; + @JsonKey(includeFromJson: false, includeToJson: false) final List streams; const MediaPart({ @@ -31,7 +41,13 @@ class MediaPart { this.streams = const [], }); + factory MediaPart.fromJson(Map json) => _$MediaPartFromJson(json); + + Map toJson() => _$MediaPartToJson(this); + /// Defaults to true when fields are absent. Plex sets these only when the /// metadata request includes `checkFiles=1`. bool get isPlayable => accessible != false && exists != false; } + +String _stringFromJson(Object? raw) => (raw ?? '').toString(); diff --git a/lib/media/media_part.g.dart b/lib/media/media_part.g.dart new file mode 100644 index 00000000..94a796b8 --- /dev/null +++ b/lib/media/media_part.g.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'media_part.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MediaPart _$MediaPartFromJson(Map json) => MediaPart( + id: _stringFromJson(json['id']), + streamPath: json['streamPath'] as String?, + sizeBytes: flexibleInt(json['sizeBytes']), + container: json['container'] as String?, + durationMs: flexibleInt(json['durationMs']), + accessible: json['accessible'] as bool?, + exists: json['exists'] as bool?, +); + +Map _$MediaPartToJson(MediaPart instance) => { + 'id': instance.id, + 'streamPath': ?instance.streamPath, + 'sizeBytes': ?instance.sizeBytes, + 'container': ?instance.container, + 'durationMs': ?instance.durationMs, + 'accessible': ?instance.accessible, + 'exists': ?instance.exists, +}; diff --git a/lib/media/media_role.dart b/lib/media/media_role.dart index 57c69a29..7e0ec8a2 100644 --- a/lib/media/media_role.dart +++ b/lib/media/media_role.dart @@ -1,9 +1,21 @@ +import 'package:json_annotation/json_annotation.dart'; + +part 'media_role.g.dart'; + /// A cast or crew member attached to a media item. +@JsonSerializable(includeIfNull: false) class MediaRole { final String? id; + @JsonKey(fromJson: _stringFromJson) final String tag; final String? role; final String? thumbPath; const MediaRole({this.id, required this.tag, this.role, this.thumbPath}); + + factory MediaRole.fromJson(Map json) => _$MediaRoleFromJson(json); + + Map toJson() => _$MediaRoleToJson(this); } + +String _stringFromJson(Object? raw) => (raw ?? '').toString(); diff --git a/lib/media/media_role.g.dart b/lib/media/media_role.g.dart new file mode 100644 index 00000000..8a87d731 --- /dev/null +++ b/lib/media/media_role.g.dart @@ -0,0 +1,21 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'media_role.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MediaRole _$MediaRoleFromJson(Map json) => MediaRole( + id: json['id'] as String?, + tag: _stringFromJson(json['tag']), + role: json['role'] as String?, + thumbPath: json['thumbPath'] as String?, +); + +Map _$MediaRoleToJson(MediaRole instance) => { + 'id': ?instance.id, + 'tag': instance.tag, + 'role': ?instance.role, + 'thumbPath': ?instance.thumbPath, +}; diff --git a/lib/media/media_version.dart b/lib/media/media_version.dart index bfd45ee2..0c36daa0 100644 --- a/lib/media/media_version.dart +++ b/lib/media/media_version.dart @@ -1,7 +1,12 @@ +import 'package:json_annotation/json_annotation.dart'; + import '../utils/codec_utils.dart'; import '../utils/formatters.dart'; +import '../utils/json_utils.dart'; import 'media_part.dart'; +part 'media_version.g.dart'; + /// Convert backend bitrates reported in bits-per-second to app-standard kbps. int? bitrateKbpsFromBps(int? bps) { if (bps == null || bps <= 0) return null; @@ -19,15 +24,21 @@ String _videoResolutionDisplayLabel(String resolution) { /// A single media variant available for an item — represents one quality level /// or transcode profile of the underlying file. An item with multiple versions /// (e.g. 4K + 1080p re-encode) exposes one [MediaVersion] per option. +@JsonSerializable(includeIfNull: false, explicitToJson: true) class MediaVersion { /// Backend-opaque version identifier. + @JsonKey(fromJson: _stringFromJson) final String id; + @JsonKey(fromJson: flexibleInt) final int? width; + @JsonKey(fromJson: flexibleInt) final int? height; final String? videoResolution; // "1080", "4k", "sd" final String? videoCodec; + @JsonKey(fromJson: flexibleInt) final int? bitrate; final String? container; + @JsonKey(fromJson: _partsFromJson, toJson: _partsToJson) final List parts; /// Human-readable name for this version (e.g. "Director's Cut"). @@ -48,6 +59,10 @@ class MediaVersion { this.name, }); + factory MediaVersion.fromJson(Map json) => _$MediaVersionFromJson(json); + + Map toJson() => _$MediaVersionToJson(this); + /// Defaults to true when file-access fields are absent. Plex only populates /// them when metadata is fetched with `checkFiles=1`. bool get isPlayable => parts.isEmpty || parts.first.isPlayable; @@ -123,3 +138,16 @@ class MediaVersion { return null; } } + +String _stringFromJson(Object? raw) => (raw ?? '').toString(); + +List _partsFromJson(Object? raw) { + return raw is List + ? [ + for (final part in raw) + if (part is Map) MediaPart.fromJson(part), + ] + : const []; +} + +List> _partsToJson(List parts) => [for (final part in parts) part.toJson()]; diff --git a/lib/media/media_version.g.dart b/lib/media/media_version.g.dart new file mode 100644 index 00000000..d09885d2 --- /dev/null +++ b/lib/media/media_version.g.dart @@ -0,0 +1,32 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'media_version.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +MediaVersion _$MediaVersionFromJson(Map json) => MediaVersion( + id: _stringFromJson(json['id']), + width: flexibleInt(json['width']), + height: flexibleInt(json['height']), + videoResolution: json['videoResolution'] as String?, + videoCodec: json['videoCodec'] as String?, + bitrate: flexibleInt(json['bitrate']), + container: json['container'] as String?, + parts: json['parts'] == null ? const [] : _partsFromJson(json['parts']), + name: json['name'] as String?, +); + +Map _$MediaVersionToJson(MediaVersion instance) => + { + 'id': instance.id, + 'width': ?instance.width, + 'height': ?instance.height, + 'videoResolution': ?instance.videoResolution, + 'videoCodec': ?instance.videoCodec, + 'bitrate': ?instance.bitrate, + 'container': ?instance.container, + 'parts': _partsToJson(instance.parts), + 'name': ?instance.name, + }; diff --git a/lib/models/companion_remote/remote_session.g.dart b/lib/models/companion_remote/remote_session.g.dart index ca1084a8..ee6f3c4e 100644 --- a/lib/models/companion_remote/remote_session.g.dart +++ b/lib/models/companion_remote/remote_session.g.dart @@ -10,43 +10,61 @@ RemoteDevice _$RemoteDeviceFromJson(Map json) => RemoteDevice( id: json['id'] as String, name: json['name'] as String, platform: json['platform'] as String, - connectedAt: json['connectedAt'] == null ? null : DateTime.parse(json['connectedAt'] as String), - capabilities: (json['capabilities'] as Map?)?.map((k, e) => MapEntry(k, e as bool)), -); - -Map _$RemoteDeviceToJson(RemoteDevice instance) => { - 'id': instance.id, - 'name': instance.name, - 'platform': instance.platform, - 'connectedAt': instance.connectedAt.toIso8601String(), - 'capabilities': instance.capabilities, -}; - -RemoteSession _$RemoteSessionFromJson(Map json) => RemoteSession( - role: $enumDecode(_$RemoteSessionRoleEnumMap, json['role'], unknownValue: RemoteSessionRole.remote), - status: - $enumDecodeNullable( - _$RemoteSessionStatusEnumMap, - json['status'], - unknownValue: RemoteSessionStatus.disconnected, - ) ?? - RemoteSessionStatus.disconnected, - connectedDevice: json['connectedDevice'] == null + connectedAt: json['connectedAt'] == null ? null - : RemoteDevice.fromJson(json['connectedDevice'] as Map), - createdAt: json['createdAt'] == null ? null : DateTime.parse(json['createdAt'] as String), - errorMessage: json['errorMessage'] as String?, + : DateTime.parse(json['connectedAt'] as String), + capabilities: (json['capabilities'] as Map?)?.map( + (k, e) => MapEntry(k, e as bool), + ), ); -Map _$RemoteSessionToJson(RemoteSession instance) => { - 'role': _$RemoteSessionRoleEnumMap[instance.role]!, - 'status': _$RemoteSessionStatusEnumMap[instance.status]!, - 'connectedDevice': instance.connectedDevice, - 'createdAt': instance.createdAt.toIso8601String(), - 'errorMessage': instance.errorMessage, -}; +Map _$RemoteDeviceToJson(RemoteDevice instance) => + { + 'id': instance.id, + 'name': instance.name, + 'platform': instance.platform, + 'connectedAt': instance.connectedAt.toIso8601String(), + 'capabilities': instance.capabilities, + }; -const _$RemoteSessionRoleEnumMap = {RemoteSessionRole.host: 'host', RemoteSessionRole.remote: 'remote'}; +RemoteSession _$RemoteSessionFromJson(Map json) => + RemoteSession( + role: $enumDecode( + _$RemoteSessionRoleEnumMap, + json['role'], + unknownValue: RemoteSessionRole.remote, + ), + status: + $enumDecodeNullable( + _$RemoteSessionStatusEnumMap, + json['status'], + unknownValue: RemoteSessionStatus.disconnected, + ) ?? + RemoteSessionStatus.disconnected, + connectedDevice: json['connectedDevice'] == null + ? null + : RemoteDevice.fromJson( + json['connectedDevice'] as Map, + ), + createdAt: json['createdAt'] == null + ? null + : DateTime.parse(json['createdAt'] as String), + errorMessage: json['errorMessage'] as String?, + ); + +Map _$RemoteSessionToJson(RemoteSession instance) => + { + 'role': _$RemoteSessionRoleEnumMap[instance.role]!, + 'status': _$RemoteSessionStatusEnumMap[instance.status]!, + 'connectedDevice': instance.connectedDevice, + 'createdAt': instance.createdAt.toIso8601String(), + 'errorMessage': instance.errorMessage, + }; + +const _$RemoteSessionRoleEnumMap = { + RemoteSessionRole.host: 'host', + RemoteSessionRole.remote: 'remote', +}; const _$RemoteSessionStatusEnumMap = { RemoteSessionStatus.disconnected: 'disconnected', diff --git a/lib/models/livetv_channel.g.dart b/lib/models/livetv_channel.g.dart index d391a94c..69c9a811 100644 --- a/lib/models/livetv_channel.g.dart +++ b/lib/models/livetv_channel.g.dart @@ -6,24 +6,26 @@ part of 'livetv_channel.dart'; // JsonSerializableGenerator // ************************************************************************** -LiveTvChannel _$LiveTvChannelFromJson(Map json) => LiveTvChannel( - key: _readChannelKey(json, 'key') as String, - identifier: _readChannelIdentifier(json, 'identifier') as String?, - callSign: json['callSign'] as String?, - title: _readChannelTitle(json, 'title') as String?, - thumb: json['thumb'] as String?, - art: json['art'] as String?, - number: _readChannelNumber(json, 'number') as String?, - hd: json['hd'] == null ? false : flexibleBool(json['hd']), - lineup: json['lineup'] as String?, - slug: json['slug'] as String?, - drm: flexibleBool(json['drm']), -); +LiveTvChannel _$LiveTvChannelFromJson(Map json) => + LiveTvChannel( + key: _readChannelKey(json, 'key') as String, + identifier: _readChannelIdentifier(json, 'identifier') as String?, + callSign: json['callSign'] as String?, + title: _readChannelTitle(json, 'title') as String?, + thumb: json['thumb'] as String?, + art: json['art'] as String?, + number: _readChannelNumber(json, 'number') as String?, + hd: json['hd'] == null ? false : flexibleBool(json['hd']), + lineup: json['lineup'] as String?, + slug: json['slug'] as String?, + drm: flexibleBool(json['drm']), + ); -FavoriteChannel _$FavoriteChannelFromJson(Map json) => FavoriteChannel( - source: json['source'] as String? ?? '', - id: _readFavoriteChannelId(json, 'id') as String, - title: json['title'] as String?, - thumb: json['thumb'] as String?, - vcn: json['vcn'] as String?, -); +FavoriteChannel _$FavoriteChannelFromJson(Map json) => + FavoriteChannel( + source: json['source'] as String? ?? '', + id: _readFavoriteChannelId(json, 'id') as String, + title: json['title'] as String?, + thumb: json['thumb'] as String?, + vcn: json['vcn'] as String?, + ); diff --git a/lib/models/livetv_dvr.g.dart b/lib/models/livetv_dvr.g.dart index 61d1d330..fd49b467 100644 --- a/lib/models/livetv_dvr.g.dart +++ b/lib/models/livetv_dvr.g.dart @@ -25,14 +25,19 @@ LiveTvDvr _$LiveTvDvrFromJson(Map json) => LiveTvDvr( sources: json['sources'] as String?, uri: json['uri'] as String?, lastSeenAt: flexibleInt(json['lastSeenAt']), - channelMappings: json['ChannelMapping'] == null ? const [] : _parseChannelMappings(json['ChannelMapping']), - settings: json['Setting'] == null ? const [] : _parseSettings(json['Setting']), + channelMappings: json['ChannelMapping'] == null + ? const [] + : _parseChannelMappings(json['ChannelMapping']), + settings: json['Setting'] == null + ? const [] + : _parseSettings(json['Setting']), devices: json['Device'] == null ? const [] : _parseRawMaps(json['Device']), ); -ChannelMapping _$ChannelMappingFromJson(Map json) => ChannelMapping( - channelKey: json['channelKey'] as String?, - deviceIdentifier: json['deviceIdentifier'] as String?, - enabled: flexibleBool(json['enabled']), - lineupIdentifier: json['lineupIdentifier'] as String?, -); +ChannelMapping _$ChannelMappingFromJson(Map json) => + ChannelMapping( + channelKey: json['channelKey'] as String?, + deviceIdentifier: json['deviceIdentifier'] as String?, + enabled: flexibleBool(json['enabled']), + lineupIdentifier: json['lineupIdentifier'] as String?, + ); diff --git a/lib/models/livetv_lineup.g.dart b/lib/models/livetv_lineup.g.dart index f034eddd..f2c3920b 100644 --- a/lib/models/livetv_lineup.g.dart +++ b/lib/models/livetv_lineup.g.dart @@ -6,19 +6,23 @@ part of 'livetv_lineup.dart'; // JsonSerializableGenerator // ************************************************************************** -LiveTvCountry _$LiveTvCountryFromJson(Map json) => LiveTvCountry( - key: json['key'] as String?, - type: json['type'] as String?, - title: json['title'] as String? ?? '', - code: json['code'] as String? ?? '', - language: json['language'] as String?, - languageTitle: json['languageTitle'] as String?, - example: json['example'] as String?, - flavor: flexibleInt(json['flavor']), -); +LiveTvCountry _$LiveTvCountryFromJson(Map json) => + LiveTvCountry( + key: json['key'] as String?, + type: json['type'] as String?, + title: json['title'] as String? ?? '', + code: json['code'] as String? ?? '', + language: json['language'] as String?, + languageTitle: json['languageTitle'] as String?, + example: json['example'] as String?, + flavor: flexibleInt(json['flavor']), + ); LiveTvLanguage _$LiveTvLanguageFromJson(Map json) => - LiveTvLanguage(code: json['code'] as String? ?? '', title: json['title'] as String? ?? ''); + LiveTvLanguage( + code: json['code'] as String? ?? '', + title: json['title'] as String? ?? '', + ); LiveTvRegion _$LiveTvRegionFromJson(Map json) => LiveTvRegion( key: json['key'] as String? ?? '', @@ -32,5 +36,7 @@ LiveTvLineup _$LiveTvLineupFromJson(Map json) => LiveTvLineup( title: json['title'] as String?, lineupType: flexibleInt(json['lineupType']), location: json['location'] as String?, - channels: json['Channel'] == null ? const [] : _parseChannels(json['Channel']), + channels: json['Channel'] == null + ? const [] + : _parseChannels(json['Channel']), ); diff --git a/lib/models/livetv_server_status.g.dart b/lib/models/livetv_server_status.g.dart index a37e94dd..bcdd4431 100644 --- a/lib/models/livetv_server_status.g.dart +++ b/lib/models/livetv_server_status.g.dart @@ -6,8 +6,9 @@ part of 'livetv_server_status.dart'; // JsonSerializableGenerator // ************************************************************************** -LiveTvServerStatus _$LiveTvServerStatusFromJson(Map json) => LiveTvServerStatus( - liveTvCount: flexibleInt(json['livetv']), - allowTuners: flexibleBoolNullable(json['allowTuners']), - ownerFeatures: json['ownerFeatures'] as String?, -); +LiveTvServerStatus _$LiveTvServerStatusFromJson(Map json) => + LiveTvServerStatus( + liveTvCount: flexibleInt(json['livetv']), + allowTuners: flexibleBoolNullable(json['allowTuners']), + ownerFeatures: json['ownerFeatures'] as String?, + ); diff --git a/lib/models/livetv_session.g.dart b/lib/models/livetv_session.g.dart index 53fbf184..415cc09b 100644 --- a/lib/models/livetv_session.g.dart +++ b/lib/models/livetv_session.g.dart @@ -6,19 +6,20 @@ part of 'livetv_session.dart'; // JsonSerializableGenerator // ************************************************************************** -LiveTvSession _$LiveTvSessionFromJson(Map json) => LiveTvSession( - sessionID: readStringField(json, 'sessionID') as String? ?? '', - dvrID: readStringField(json, 'dvrID') as String?, - channelIdentifier: json['channelIdentifier'] as String?, - channelCallSign: json['channelCallSign'] as String?, - channelTitle: json['channelTitle'] as String?, - activityUUID: json['activityUUID'] as String?, - currentPosition: flexibleInt(json['currentPosition']), - nextPosition: flexibleInt(json['nextPosition']), - startedAt: flexibleInt(json['startedAt']), - captureBuffer: _captureBufferFromRaw(json['CaptureBuffer']), - grabOperation: _grabOperationFromRaw(json['MediaGrabOperation']), - timeline: _firstMap(json['Timeline']), - airingMetadataItem: _programFromRaw(json['AiringMetadataItem']), - upNextMetadataItem: _programFromRaw(json['UpNextMetadataItem']), -); +LiveTvSession _$LiveTvSessionFromJson(Map json) => + LiveTvSession( + sessionID: readStringField(json, 'sessionID') as String? ?? '', + dvrID: readStringField(json, 'dvrID') as String?, + channelIdentifier: json['channelIdentifier'] as String?, + channelCallSign: json['channelCallSign'] as String?, + channelTitle: json['channelTitle'] as String?, + activityUUID: json['activityUUID'] as String?, + currentPosition: flexibleInt(json['currentPosition']), + nextPosition: flexibleInt(json['nextPosition']), + startedAt: flexibleInt(json['startedAt']), + captureBuffer: _captureBufferFromRaw(json['CaptureBuffer']), + grabOperation: _grabOperationFromRaw(json['MediaGrabOperation']), + timeline: _firstMap(json['Timeline']), + airingMetadataItem: _programFromRaw(json['AiringMetadataItem']), + upNextMetadataItem: _programFromRaw(json['UpNextMetadataItem']), + ); diff --git a/lib/models/media_grab_operation.g.dart b/lib/models/media_grab_operation.g.dart index 5068fbde..7706a846 100644 --- a/lib/models/media_grab_operation.g.dart +++ b/lib/models/media_grab_operation.g.dart @@ -6,19 +6,20 @@ part of 'media_grab_operation.dart'; // JsonSerializableGenerator // ************************************************************************** -MediaGrabOperation _$MediaGrabOperationFromJson(Map json) => MediaGrabOperation( - mediaSubscriptionID: flexibleInt(json['mediaSubscriptionID']), - mediaIndex: flexibleInt(json['mediaIndex']), - id: json['id'] as String? ?? '', - key: json['key'] as String?, - grabberIdentifier: json['grabberIdentifier'] as String?, - grabberProtocol: json['grabberProtocol'] as String?, - percent: flexibleDouble(json['percent']), - currentSize: flexibleInt(json['currentSize']), - status: json['status'] as String?, - provider: json['provider'] as String?, - rolling: flexibleBoolNullable(json['rolling']), - error: json['error'] as String?, - linkedKey: json['linkedKey'] as String?, - metadata: _metadataFromJson(json['Metadata']), -); +MediaGrabOperation _$MediaGrabOperationFromJson(Map json) => + MediaGrabOperation( + mediaSubscriptionID: flexibleInt(json['mediaSubscriptionID']), + mediaIndex: flexibleInt(json['mediaIndex']), + id: json['id'] as String? ?? '', + key: json['key'] as String?, + grabberIdentifier: json['grabberIdentifier'] as String?, + grabberProtocol: json['grabberProtocol'] as String?, + percent: flexibleDouble(json['percent']), + currentSize: flexibleInt(json['currentSize']), + status: json['status'] as String?, + provider: json['provider'] as String?, + rolling: flexibleBoolNullable(json['rolling']), + error: json['error'] as String?, + linkedKey: json['linkedKey'] as String?, + metadata: _metadataFromJson(json['Metadata']), + ); diff --git a/lib/models/media_grabber_device.g.dart b/lib/models/media_grabber_device.g.dart index d87956cd..fff4efb0 100644 --- a/lib/models/media_grabber_device.g.dart +++ b/lib/models/media_grabber_device.g.dart @@ -12,26 +12,33 @@ MediaGrabber _$MediaGrabberFromJson(Map json) => MediaGrabber( title: json['title'] as String?, ); -MediaGrabberDevice _$MediaGrabberDeviceFromJson(Map json) => MediaGrabberDevice( - key: json['key'] as String? ?? '', - uuid: json['uuid'] as String? ?? '', - uri: json['uri'] as String?, - protocol: json['protocol'] as String?, - title: json['title'] as String?, - make: json['make'] as String?, - model: json['model'] as String?, - modelNumber: json['modelNumber'] as String?, - firmware: json['firmware'] as String?, - tuners: flexibleInt(json['tuners']), - sources: json['sources'] as String?, - status: flexibleInt(json['status']), - state: flexibleInt(json['state']), - lastSeenAt: flexibleInt(json['lastSeenAt']), - channelMappings: json['ChannelMapping'] == null ? const [] : _parseChannelMappings(json['ChannelMapping']), - settings: json['Setting'] == null ? const [] : _parseSettings(json['Setting']), -); +MediaGrabberDevice _$MediaGrabberDeviceFromJson(Map json) => + MediaGrabberDevice( + key: json['key'] as String? ?? '', + uuid: json['uuid'] as String? ?? '', + uri: json['uri'] as String?, + protocol: json['protocol'] as String?, + title: json['title'] as String?, + make: json['make'] as String?, + model: json['model'] as String?, + modelNumber: json['modelNumber'] as String?, + firmware: json['firmware'] as String?, + tuners: flexibleInt(json['tuners']), + sources: json['sources'] as String?, + status: flexibleInt(json['status']), + state: flexibleInt(json['state']), + lastSeenAt: flexibleInt(json['lastSeenAt']), + channelMappings: json['ChannelMapping'] == null + ? const [] + : _parseChannelMappings(json['ChannelMapping']), + settings: json['Setting'] == null + ? const [] + : _parseSettings(json['Setting']), + ); -MediaGrabberDeviceChannel _$MediaGrabberDeviceChannelFromJson(Map json) => MediaGrabberDeviceChannel( +MediaGrabberDeviceChannel _$MediaGrabberDeviceChannelFromJson( + Map json, +) => MediaGrabberDeviceChannel( identifier: readStringField(json, 'identifier') as String? ?? '', key: readStringField(json, 'key') as String?, name: readStringField(json, 'name') as String?, diff --git a/lib/models/media_provider_info.g.dart b/lib/models/media_provider_info.g.dart index 8b8e91d7..de23170f 100644 --- a/lib/models/media_provider_info.g.dart +++ b/lib/models/media_provider_info.g.dart @@ -6,26 +6,33 @@ part of 'media_provider_info.dart'; // JsonSerializableGenerator // ************************************************************************** -MediaProviderInfo _$MediaProviderInfoFromJson(Map json) => MediaProviderInfo( - id: flexibleInt(json['id']), - parentID: flexibleInt(json['parentID']), - identifier: json['identifier'] as String? ?? '', - providerIdentifier: json['providerIdentifier'] as String?, - title: json['title'] as String?, - types: json['types'] as String?, - protocols: json['protocols'] as String?, - epgSource: json['epgSource'] as String?, - friendlyName: json['friendlyName'] as String?, - features: json['Feature'] == null ? const [] : _parseFeatures(json['Feature']), -); +MediaProviderInfo _$MediaProviderInfoFromJson(Map json) => + MediaProviderInfo( + id: flexibleInt(json['id']), + parentID: flexibleInt(json['parentID']), + identifier: json['identifier'] as String? ?? '', + providerIdentifier: json['providerIdentifier'] as String?, + title: json['title'] as String?, + types: json['types'] as String?, + protocols: json['protocols'] as String?, + epgSource: json['epgSource'] as String?, + friendlyName: json['friendlyName'] as String?, + features: json['Feature'] == null + ? const [] + : _parseFeatures(json['Feature']), + ); -MediaProviderFeature _$MediaProviderFeatureFromJson(Map json) => MediaProviderFeature( +MediaProviderFeature _$MediaProviderFeatureFromJson( + Map json, +) => MediaProviderFeature( key: json['key'] as String?, type: json['type'] as String? ?? '', flavor: json['flavor'] as String?, scrobbleKey: json['scrobbleKey'] as String?, unscrobbleKey: json['unscrobbleKey'] as String?, - directories: json['Directory'] == null ? const [] : _parseRawMaps(json['Directory']), + directories: json['Directory'] == null + ? const [] + : _parseRawMaps(json['Directory']), actions: json['Action'] == null ? const [] : _parseRawMaps(json['Action']), pivots: json['Pivot'] == null ? const [] : _parseRawMaps(json['Pivot']), ); diff --git a/lib/models/media_subscription.g.dart b/lib/models/media_subscription.g.dart index 95d22c55..074c30d6 100644 --- a/lib/models/media_subscription.g.dart +++ b/lib/models/media_subscription.g.dart @@ -6,41 +6,53 @@ part of 'media_subscription.dart'; // JsonSerializableGenerator // ************************************************************************** -SubscriptionTemplate _$SubscriptionTemplateFromJson(Map json) => SubscriptionTemplate( - subscriptions: json['MediaSubscription'] == null ? const [] : _parseSubscriptions(json['MediaSubscription']), +SubscriptionTemplate _$SubscriptionTemplateFromJson( + Map json, +) => SubscriptionTemplate( + subscriptions: json['MediaSubscription'] == null + ? const [] + : _parseSubscriptions(json['MediaSubscription']), ); -MediaSubscription _$MediaSubscriptionFromJson(Map json) => MediaSubscription( - key: json['key'] as String? ?? '', - type: flexibleInt(json['type']), - provider: json['provider'] as String?, - targetLibrarySectionID: flexibleInt(json['targetLibrarySectionID']), - targetSectionLocationID: flexibleInt(json['targetSectionLocationID']), - title: json['title'] as String?, - selected: flexibleBoolNullable(json['selected']), - parameters: json['parameters'] as String?, - createdAt: flexibleInt(json['createdAt']), - storageTotal: flexibleInt(json['storageTotal']), - durationTotal: flexibleInt(json['durationTotal']), - airingsType: json['airingsType'] as String?, - librarySectionTitle: json['librarySectionTitle'] as String?, - locationPath: json['locationPath'] as String?, - video: _mapFromJson(json['Video']), - directory: _mapFromJson(json['Directory']), - playlist: _mapFromJson(json['Playlist']), - settings: json['Setting'] == null ? const [] : _parseSettings(json['Setting']), - grabOperations: json['MediaGrabOperation'] == null ? const [] : _parseGrabOperations(json['MediaGrabOperation']), -); +MediaSubscription _$MediaSubscriptionFromJson(Map json) => + MediaSubscription( + key: json['key'] as String? ?? '', + type: flexibleInt(json['type']), + provider: json['provider'] as String?, + targetLibrarySectionID: flexibleInt(json['targetLibrarySectionID']), + targetSectionLocationID: flexibleInt(json['targetSectionLocationID']), + title: json['title'] as String?, + selected: flexibleBoolNullable(json['selected']), + parameters: json['parameters'] as String?, + createdAt: flexibleInt(json['createdAt']), + storageTotal: flexibleInt(json['storageTotal']), + durationTotal: flexibleInt(json['durationTotal']), + airingsType: json['airingsType'] as String?, + librarySectionTitle: json['librarySectionTitle'] as String?, + locationPath: json['locationPath'] as String?, + video: _mapFromJson(json['Video']), + directory: _mapFromJson(json['Directory']), + playlist: _mapFromJson(json['Playlist']), + settings: json['Setting'] == null + ? const [] + : _parseSettings(json['Setting']), + grabOperations: json['MediaGrabOperation'] == null + ? const [] + : _parseGrabOperations(json['MediaGrabOperation']), + ); -SubscriptionSetting _$SubscriptionSettingFromJson(Map json) => SubscriptionSetting( - id: json['id'] as String? ?? '', - label: json['label'] as String?, - summary: json['summary'] as String?, - type: json['type'] as String?, - defaultValue: json['default'], - value: json['value'], - hidden: json['hidden'] == null ? false : flexibleBool(json['hidden']), - advanced: json['advanced'] == null ? false : flexibleBool(json['advanced']), - group: json['group'] as String?, - enumValues: json['enumValues'] as String?, -); +SubscriptionSetting _$SubscriptionSettingFromJson(Map json) => + SubscriptionSetting( + id: json['id'] as String? ?? '', + label: json['label'] as String?, + summary: json['summary'] as String?, + type: json['type'] as String?, + defaultValue: json['default'], + value: json['value'], + hidden: json['hidden'] == null ? false : flexibleBool(json['hidden']), + advanced: json['advanced'] == null + ? false + : flexibleBool(json['advanced']), + group: json['group'] as String?, + enumValues: json['enumValues'] as String?, + ); diff --git a/lib/models/plex/plex_home.g.dart b/lib/models/plex/plex_home.g.dart index 2bbb85d8..d9c51148 100644 --- a/lib/models/plex/plex_home.g.dart +++ b/lib/models/plex/plex_home.g.dart @@ -13,7 +13,11 @@ PlexHome _$PlexHomeFromJson(Map json) => PlexHome( guestUserUUID: json['guestUserUUID'] as String? ?? '', guestEnabled: json['guestEnabled'] as bool? ?? false, subscription: json['subscription'] as bool? ?? false, - users: (json['users'] as List?)?.map((e) => PlexHomeUser.fromJson(e as Map)).toList() ?? [], + users: + (json['users'] as List?) + ?.map((e) => PlexHomeUser.fromJson(e as Map)) + .toList() ?? + [], ); Map _$PlexHomeToJson(PlexHome instance) => { diff --git a/lib/models/plex/plex_home_user.g.dart b/lib/models/plex/plex_home_user.g.dart index 5d68af50..56d5e7d6 100644 --- a/lib/models/plex/plex_home_user.g.dart +++ b/lib/models/plex/plex_home_user.g.dart @@ -22,18 +22,19 @@ PlexHomeUser _$PlexHomeUserFromJson(Map json) => PlexHomeUser( protected: json['protected'] as bool? ?? false, ); -Map _$PlexHomeUserToJson(PlexHomeUser instance) => { - 'id': instance.id, - 'uuid': instance.uuid, - 'title': instance.title, - 'username': instance.username, - 'email': instance.email, - 'friendlyName': instance.friendlyName, - 'thumb': instance.thumb, - 'hasPassword': instance.hasPassword, - 'restricted': instance.restricted, - 'updatedAt': instance.updatedAt, - 'admin': instance.admin, - 'guest': instance.guest, - 'protected': instance.protected, -}; +Map _$PlexHomeUserToJson(PlexHomeUser instance) => + { + 'id': instance.id, + 'uuid': instance.uuid, + 'title': instance.title, + 'username': instance.username, + 'email': instance.email, + 'friendlyName': instance.friendlyName, + 'thumb': instance.thumb, + 'hasPassword': instance.hasPassword, + 'restricted': instance.restricted, + 'updatedAt': instance.updatedAt, + 'admin': instance.admin, + 'guest': instance.guest, + 'protected': instance.protected, + }; diff --git a/lib/models/plex/plex_match_result.g.dart b/lib/models/plex/plex_match_result.g.dart index d840331e..37514316 100644 --- a/lib/models/plex/plex_match_result.g.dart +++ b/lib/models/plex/plex_match_result.g.dart @@ -6,24 +6,26 @@ part of 'plex_match_result.dart'; // JsonSerializableGenerator // ************************************************************************** -PlexMatchResult _$PlexMatchResultFromJson(Map json) => PlexMatchResult( - guid: readStringField(json, 'guid') as String? ?? '', - name: readStringField(json, 'name') as String? ?? '', - year: flexibleInt(json['year']), - score: flexibleInt(json['score']), - thumb: readStringField(json, 'thumb') as String?, - summary: readStringField(json, 'summary') as String?, - type: readStringField(json, 'type') as String?, - matched: json['matched'] == null ? false : flexibleBool(json['matched']), -); +PlexMatchResult _$PlexMatchResultFromJson(Map json) => + PlexMatchResult( + guid: readStringField(json, 'guid') as String? ?? '', + name: readStringField(json, 'name') as String? ?? '', + year: flexibleInt(json['year']), + score: flexibleInt(json['score']), + thumb: readStringField(json, 'thumb') as String?, + summary: readStringField(json, 'summary') as String?, + type: readStringField(json, 'type') as String?, + matched: json['matched'] == null ? false : flexibleBool(json['matched']), + ); -Map _$PlexMatchResultToJson(PlexMatchResult instance) => { - 'guid': instance.guid, - 'name': instance.name, - 'year': instance.year, - 'score': instance.score, - 'thumb': instance.thumb, - 'summary': instance.summary, - 'type': instance.type, - 'matched': instance.matched, -}; +Map _$PlexMatchResultToJson(PlexMatchResult instance) => + { + 'guid': instance.guid, + 'name': instance.name, + 'year': instance.year, + 'score': instance.score, + 'thumb': instance.thumb, + 'summary': instance.summary, + 'type': instance.type, + 'matched': instance.matched, + }; diff --git a/lib/models/plex/plex_subtitle_search_result.g.dart b/lib/models/plex/plex_subtitle_search_result.g.dart index 0b47238a..20fd2b45 100644 --- a/lib/models/plex/plex_subtitle_search_result.g.dart +++ b/lib/models/plex/plex_subtitle_search_result.g.dart @@ -6,7 +6,9 @@ part of 'plex_subtitle_search_result.dart'; // JsonSerializableGenerator // ************************************************************************** -PlexSubtitleSearchResult _$PlexSubtitleSearchResultFromJson(Map json) => PlexSubtitleSearchResult( +PlexSubtitleSearchResult _$PlexSubtitleSearchResultFromJson( + Map json, +) => PlexSubtitleSearchResult( id: _flexibleIntOrZero(json['id']), key: readStringField(json, 'key') as String? ?? '', codec: readStringField(json, 'codec') as String?, @@ -16,13 +18,21 @@ PlexSubtitleSearchResult _$PlexSubtitleSearchResultFromJson(Map providerTitle: readStringField(json, 'providerTitle') as String?, title: readStringField(json, 'title') as String?, displayTitle: readStringField(json, 'displayTitle') as String?, - hearingImpaired: json['hearingImpaired'] == null ? false : flexibleBool(json['hearingImpaired']), - perfectMatch: json['perfectMatch'] == null ? false : flexibleBool(json['perfectMatch']), - downloaded: json['downloaded'] == null ? false : flexibleBool(json['downloaded']), + hearingImpaired: json['hearingImpaired'] == null + ? false + : flexibleBool(json['hearingImpaired']), + perfectMatch: json['perfectMatch'] == null + ? false + : flexibleBool(json['perfectMatch']), + downloaded: json['downloaded'] == null + ? false + : flexibleBool(json['downloaded']), forced: json['forced'] == null ? false : flexibleBool(json['forced']), ); -Map _$PlexSubtitleSearchResultToJson(PlexSubtitleSearchResult instance) => { +Map _$PlexSubtitleSearchResultToJson( + PlexSubtitleSearchResult instance, +) => { 'id': instance.id, 'key': instance.key, 'codec': instance.codec, diff --git a/lib/models/plex/plex_user_profile.g.dart b/lib/models/plex/plex_user_profile.g.dart index 208b5e0a..bdba7d4a 100644 --- a/lib/models/plex/plex_user_profile.g.dart +++ b/lib/models/plex/plex_user_profile.g.dart @@ -6,32 +6,44 @@ part of 'plex_user_profile.dart'; // JsonSerializableGenerator // ************************************************************************** -PlexUserProfile _$PlexUserProfileFromJson(Map json) => PlexUserProfile( +PlexUserProfile _$PlexUserProfileFromJson( + Map json, +) => PlexUserProfile( autoSelectAudio: json['autoSelectAudio'] as bool? ?? true, - defaultAudioAccessibility: (json['defaultAudioAccessibility'] as num?)?.toInt() ?? 0, + defaultAudioAccessibility: + (json['defaultAudioAccessibility'] as num?)?.toInt() ?? 0, defaultAudioLanguage: json['defaultAudioLanguage'] as String?, - defaultAudioLanguages: (json['defaultAudioLanguages'] as List?)?.map((e) => e as String).toList(), + defaultAudioLanguages: (json['defaultAudioLanguages'] as List?) + ?.map((e) => e as String) + .toList(), defaultSubtitleLanguage: json['defaultSubtitleLanguage'] as String?, - defaultSubtitleLanguages: (json['defaultSubtitleLanguages'] as List?)?.map((e) => e as String).toList(), + defaultSubtitleLanguages: (json['defaultSubtitleLanguages'] as List?) + ?.map((e) => e as String) + .toList(), autoSelectSubtitle: (json['autoSelectSubtitle'] as num?)?.toInt() ?? 0, - defaultSubtitleAccessibility: (json['defaultSubtitleAccessibility'] as num?)?.toInt() ?? 0, + defaultSubtitleAccessibility: + (json['defaultSubtitleAccessibility'] as num?)?.toInt() ?? 0, defaultSubtitleForced: (json['defaultSubtitleForced'] as num?)?.toInt() ?? 1, watchedIndicator: (json['watchedIndicator'] as num?)?.toInt() ?? 1, - mediaReviewsVisibility: (json['mediaReviewsVisibility'] as num?)?.toInt() ?? 0, - mediaReviewsLanguages: (json['mediaReviewsLanguages'] as List?)?.map((e) => e as String).toList(), + mediaReviewsVisibility: + (json['mediaReviewsVisibility'] as num?)?.toInt() ?? 0, + mediaReviewsLanguages: (json['mediaReviewsLanguages'] as List?) + ?.map((e) => e as String) + .toList(), ); -Map _$PlexUserProfileToJson(PlexUserProfile instance) => { - 'autoSelectAudio': instance.autoSelectAudio, - 'defaultAudioAccessibility': instance.defaultAudioAccessibility, - 'defaultAudioLanguage': instance.defaultAudioLanguage, - 'defaultAudioLanguages': instance.defaultAudioLanguages, - 'defaultSubtitleLanguage': instance.defaultSubtitleLanguage, - 'defaultSubtitleLanguages': instance.defaultSubtitleLanguages, - 'autoSelectSubtitle': instance.autoSelectSubtitle, - 'defaultSubtitleAccessibility': instance.defaultSubtitleAccessibility, - 'defaultSubtitleForced': instance.defaultSubtitleForced, - 'watchedIndicator': instance.watchedIndicator, - 'mediaReviewsVisibility': instance.mediaReviewsVisibility, - 'mediaReviewsLanguages': instance.mediaReviewsLanguages, -}; +Map _$PlexUserProfileToJson(PlexUserProfile instance) => + { + 'autoSelectAudio': instance.autoSelectAudio, + 'defaultAudioAccessibility': instance.defaultAudioAccessibility, + 'defaultAudioLanguage': instance.defaultAudioLanguage, + 'defaultAudioLanguages': instance.defaultAudioLanguages, + 'defaultSubtitleLanguage': instance.defaultSubtitleLanguage, + 'defaultSubtitleLanguages': instance.defaultSubtitleLanguages, + 'autoSelectSubtitle': instance.autoSelectSubtitle, + 'defaultSubtitleAccessibility': instance.defaultSubtitleAccessibility, + 'defaultSubtitleForced': instance.defaultSubtitleForced, + 'watchedIndicator': instance.watchedIndicator, + 'mediaReviewsVisibility': instance.mediaReviewsVisibility, + 'mediaReviewsLanguages': instance.mediaReviewsLanguages, + }; diff --git a/lib/providers/download_provider.dart b/lib/providers/download_provider.dart index 2ff6e2bf..24c2f47a 100644 --- a/lib/providers/download_provider.dart +++ b/lib/providers/download_provider.dart @@ -1019,7 +1019,10 @@ class DownloadProvider extends ChangeNotifier with DisposableChangeNotifierMixin try { final fullMetadata = await client.fetchItem(metadata.id); if (fullMetadata != null) { - metadataToStore = fullMetadata.copyWith(serverId: metadata.serverId, serverName: metadata.serverName); + metadataToStore = fullMetadata.copyWith( + serverId: metadata.serverId ?? fullMetadata.serverId, + serverName: metadata.serverName ?? fullMetadata.serverName, + ); } } catch (e) { appLogger.w('Failed to fetch full metadata for ${metadata.id}, using partial', error: e); diff --git a/lib/providers/watch_state_overlay_provider.dart b/lib/providers/watch_state_overlay_provider.dart index 014514e8..dc94315d 100644 --- a/lib/providers/watch_state_overlay_provider.dart +++ b/lib/providers/watch_state_overlay_provider.dart @@ -50,10 +50,15 @@ class WatchStateOverlayProvider extends ChangeNotifier with DisposableChangeNoti static MediaItem applyPatch(MediaItem item, WatchStateOverlayPatch? patch) { if (patch == null) return item; - return item.copyWith( - viewCount: patch.isWatched == null ? null : (patch.isWatched! ? 1 : 0), - viewOffsetMs: patch.hasViewOffsetMs ? patch.viewOffsetMs : null, - ); + var updated = item; + final isWatched = patch.isWatched; + if (isWatched != null) { + updated = updated.copyWith(viewCount: isWatched ? 1 : 0); + } + if (patch.hasViewOffsetMs) { + updated = updated.copyWith(viewOffsetMs: patch.viewOffsetMs); + } + return updated; } void setActiveProfileId(String? profileId) { diff --git a/lib/screens/media_detail_screen.dart b/lib/screens/media_detail_screen.dart index 45ca7cfd..feecc543 100644 --- a/lib/screens/media_detail_screen.dart +++ b/lib/screens/media_detail_screen.dart @@ -229,19 +229,24 @@ class _MediaDetailScreenState extends State final isWatched = event.isNowWatched; if (isWatched == null) return; final viewOffsetMs = isWatched && !clearWatchedProgress ? null : 0; + MediaItem patchItem(MediaItem item) { + final updated = item.copyWith(viewCount: isWatched ? 1 : 0); + return viewOffsetMs == null ? updated : updated.copyWith(viewOffsetMs: viewOffsetMs); + } + setStateIfMounted(() { final base = _fullMetadata ?? widget.metadata; if (base.id == event.itemId) { - _fullMetadata = base.copyWith(viewCount: isWatched ? 1 : 0, viewOffsetMs: viewOffsetMs); + _fullMetadata = patchItem(base); } final onDeckEpisode = _onDeckEpisode; if (onDeckEpisode != null && onDeckEpisode.id == event.itemId) { - _onDeckEpisode = onDeckEpisode.copyWith(viewCount: isWatched ? 1 : 0, viewOffsetMs: viewOffsetMs); + _onDeckEpisode = patchItem(onDeckEpisode); } if (epIndex != -1) { - final updated = _episodes[epIndex].copyWith(viewCount: isWatched ? 1 : 0, viewOffsetMs: viewOffsetMs); + final updated = patchItem(_episodes[epIndex]); _episodes[epIndex] = updated; _syncEpisodeToCache(epIndex, updated); } @@ -272,7 +277,7 @@ class _MediaDetailScreenState extends State MediaItem _applyLocalProgress(MediaItem item) { if (!_localProgressById.containsKey(item.id)) return item; - return item.copyWith(viewOffsetMs: _localProgressById[item.id]); + return item.copyWith(viewOffsetMs: _localProgressById[item.id]!); } @override @@ -395,10 +400,14 @@ class _MediaDetailScreenState extends State final onDeckEpisode = result.onDeckEpisode; if (metadata != null) { setStateIfMounted(() { - _fullMetadata = _applyLocalProgress(metadata.copyWith(serverId: serverId, serverName: serverName)); + _fullMetadata = _applyLocalProgress( + metadata.copyWith(serverId: serverId, serverName: serverName ?? metadata.serverName), + ); _onDeckEpisode = onDeckEpisode == null ? null - : _applyLocalProgress(onDeckEpisode.copyWith(serverId: serverId, serverName: serverName)); + : _applyLocalProgress( + onDeckEpisode.copyWith(serverId: serverId, serverName: serverName ?? onDeckEpisode.serverName), + ); }); } @@ -406,7 +415,9 @@ class _MediaDetailScreenState extends State final seasons = await mediaClient.fetchChildren(_metadata.id); _episodeCache.clear(); setStateIfMounted(() { - _seasons = seasons.map((s) => s.copyWith(serverId: serverId, serverName: serverName)).toList(); + _seasons = seasons + .map((s) => s.copyWith(serverId: serverId, serverName: serverName ?? s.serverName)) + .toList(); }); if (_showEpisodesDirectly) { await _fetchAllEpisodes(); @@ -992,10 +1003,18 @@ class _MediaDetailScreenState extends State // Preserve serverId from original metadata final serverId = _metadata.serverId; final serverName = _metadata.serverName; - final base = _applyLocalProgress((metadata ?? _metadata).copyWith(serverId: serverId, serverName: serverName)); + final source = metadata ?? _metadata; + final base = _applyLocalProgress( + source.copyWith(serverId: serverId ?? source.serverId, serverName: serverName ?? source.serverName), + ); final onDeckWithServerId = onDeckEpisode == null ? null - : _applyLocalProgress(onDeckEpisode.copyWith(serverId: serverId, serverName: serverName)); + : _applyLocalProgress( + onDeckEpisode.copyWith( + serverId: serverId ?? onDeckEpisode.serverId, + serverName: serverName ?? onDeckEpisode.serverName, + ), + ); setState(() { _fullMetadata = base; @@ -1065,7 +1084,7 @@ class _MediaDetailScreenState extends State // Preserve serverId for each season. final seasonsWithServerId = seasons - .map((season) => season.copyWith(serverId: serverId, serverName: _metadata.serverName)) + .map((season) => season.copyWith(serverId: serverId, serverName: _metadata.serverName ?? season.serverName)) .toList(); // Plex's flattenSeasons modes: 1 = always, 2 = single-season only. @@ -1257,10 +1276,10 @@ class _MediaDetailScreenState extends State final episodesWithServerId = episodes .map( (e) => e.copyWith( - serverId: _metadata.serverId, - serverName: _metadata.serverName, + serverId: _metadata.serverId ?? e.serverId, + serverName: _metadata.serverName ?? e.serverName, grandparentId: _metadata.id, - grandparentTitle: _metadata.title, + grandparentTitle: _metadata.title ?? e.grandparentTitle, ), ) .map(_applyLocalProgress) @@ -1301,7 +1320,12 @@ class _MediaDetailScreenState extends State // Preserve serverId for each extra (needed for multi-server setups). final extrasWithServerId = extras - .map((extra) => extra.copyWith(serverId: _metadata.serverId, serverName: _metadata.serverName)) + .map( + (extra) => extra.copyWith( + serverId: _metadata.serverId ?? extra.serverId, + serverName: _metadata.serverName ?? extra.serverName, + ), + ) .toList(); setStateIfMounted(() { @@ -1985,7 +2009,7 @@ class _MediaDetailScreenState extends State .map( (e) => e.copyWith( serverId: serverId, - serverName: _metadata.serverName, + serverName: _metadata.serverName ?? e.serverName, grandparentId: e.grandparentId ?? fallbackGrandparentId, grandparentTitle: e.grandparentTitle ?? fallbackGrandparentTitle, ), @@ -2070,7 +2094,10 @@ class _MediaDetailScreenState extends State // Play the first episode final firstEpisode = episodes.first; // Preserve serverId for the episode - final episodeWithServerId = firstEpisode.copyWith(serverId: _metadata.serverId, serverName: _metadata.serverName); + final episodeWithServerId = firstEpisode.copyWith( + serverId: _metadata.serverId ?? firstEpisode.serverId, + serverName: _metadata.serverName ?? firstEpisode.serverName, + ); if (mounted) { appLogger.d('Playing first episode: ${episodeWithServerId.title}'); await navigateToVideoPlayerWithRefresh( diff --git a/lib/services/jellyfin_sequential_launcher.dart b/lib/services/jellyfin_sequential_launcher.dart index 1f4c6021..23bb5e39 100644 --- a/lib/services/jellyfin_sequential_launcher.dart +++ b/lib/services/jellyfin_sequential_launcher.dart @@ -162,7 +162,9 @@ class JellyfinSequentialLauncher extends MediaListPlaybackLauncher { if (raw == null || raw.isEmpty) return const PlayQueueEmpty(); final shuffled = List.of(raw)..shuffle(Random()); - final items = shuffled.map((e) => e.copyWith(serverId: serverId, serverName: metadata.serverName)).toList(); + final items = shuffled + .map((e) => e.copyWith(serverId: serverId, serverName: metadata.serverName ?? e.serverName)) + .toList(); await dismissLoading(); if (!context.mounted && navigateForTesting == null) { diff --git a/lib/services/play_queue_launcher.dart b/lib/services/play_queue_launcher.dart index 8ea5194e..6402b1ce 100644 --- a/lib/services/play_queue_launcher.dart +++ b/lib/services/play_queue_launcher.dart @@ -286,7 +286,7 @@ class PlexPlayQueueLauncher extends MediaListPlaybackLauncher { var itemToPlay = selectedItem ?? playQueue.items!.first; if (copyServerInfo && serverId != null) { - itemToPlay = itemToPlay.copyWith(serverId: serverId, serverName: serverName); + itemToPlay = itemToPlay.copyWith(serverId: serverId, serverName: serverName ?? itemToPlay.serverName); } await navigateToVideoPlayer(context, metadata: itemToPlay); diff --git a/lib/services/plex_mappers.g.dart b/lib/services/plex_mappers.g.dart index ec5fa61f..21be3f4b 100644 --- a/lib/services/plex_mappers.g.dart +++ b/lib/services/plex_mappers.g.dart @@ -16,51 +16,54 @@ PlexRoleDto _$PlexRoleDtoFromJson(Map json) => PlexRoleDto( count: flexibleInt(json['count']), ); -PlexMediaVersionDto _$PlexMediaVersionDtoFromJson(Map json) => PlexMediaVersionDto( - id: _flexibleIntOrZero(json['id']), - videoResolution: readStringField(json, 'videoResolution') as String?, - videoCodec: readStringField(json, 'videoCodec') as String?, - bitrate: flexibleInt(json['bitrate']), - width: flexibleInt(json['width']), - height: flexibleInt(json['height']), - container: readStringField(json, 'container') as String?, - partKey: _readPartKey(json, 'partKey') as String, - accessible: _readPartAccessible(json, 'accessible') as bool?, - exists: _readPartExists(json, 'exists') as bool?, -); +PlexMediaVersionDto _$PlexMediaVersionDtoFromJson(Map json) => + PlexMediaVersionDto( + id: _flexibleIntOrZero(json['id']), + videoResolution: readStringField(json, 'videoResolution') as String?, + videoCodec: readStringField(json, 'videoCodec') as String?, + bitrate: flexibleInt(json['bitrate']), + width: flexibleInt(json['width']), + height: flexibleInt(json['height']), + container: readStringField(json, 'container') as String?, + partKey: _readPartKey(json, 'partKey') as String, + accessible: _readPartAccessible(json, 'accessible') as bool?, + exists: _readPartExists(json, 'exists') as bool?, + ); -PlexLibraryDto _$PlexLibraryDtoFromJson(Map json) => PlexLibraryDto( - key: readStringField(json, 'key') as String? ?? '', - title: json['title'] as String? ?? '', - type: json['type'] as String? ?? '', - agent: json['agent'] as String?, - scanner: json['scanner'] as String?, - language: json['language'] as String?, - uuid: json['uuid'] as String?, - updatedAt: flexibleInt(json['updatedAt']), - createdAt: flexibleInt(json['createdAt']), - hidden: flexibleInt(json['hidden']), -); +PlexLibraryDto _$PlexLibraryDtoFromJson(Map json) => + PlexLibraryDto( + key: readStringField(json, 'key') as String? ?? '', + title: json['title'] as String? ?? '', + type: json['type'] as String? ?? '', + agent: json['agent'] as String?, + scanner: json['scanner'] as String?, + language: json['language'] as String?, + uuid: json['uuid'] as String?, + updatedAt: flexibleInt(json['updatedAt']), + createdAt: flexibleInt(json['createdAt']), + hidden: flexibleInt(json['hidden']), + ); -PlexPlaylistDto _$PlexPlaylistDtoFromJson(Map json) => PlexPlaylistDto( - ratingKey: readStringField(json, 'ratingKey') as String? ?? '', - key: json['key'] as String? ?? '', - type: json['type'] as String? ?? '', - title: json['title'] as String? ?? '', - summary: json['summary'] as String?, - smart: json['smart'] as bool? ?? false, - playlistType: json['playlistType'] as String? ?? '', - duration: flexibleInt(json['duration']), - leafCount: flexibleInt(json['leafCount']), - composite: json['composite'] as String?, - addedAt: flexibleInt(json['addedAt']), - updatedAt: flexibleInt(json['updatedAt']), - lastViewedAt: flexibleInt(json['lastViewedAt']), - viewCount: flexibleInt(json['viewCount']), - content: json['content'] as String?, - guid: json['guid'] as String?, - thumb: json['thumb'] as String?, -); +PlexPlaylistDto _$PlexPlaylistDtoFromJson(Map json) => + PlexPlaylistDto( + ratingKey: readStringField(json, 'ratingKey') as String? ?? '', + key: json['key'] as String? ?? '', + type: json['type'] as String? ?? '', + title: json['title'] as String? ?? '', + summary: json['summary'] as String?, + smart: json['smart'] as bool? ?? false, + playlistType: json['playlistType'] as String? ?? '', + duration: flexibleInt(json['duration']), + leafCount: flexibleInt(json['leafCount']), + composite: json['composite'] as String?, + addedAt: flexibleInt(json['addedAt']), + updatedAt: flexibleInt(json['updatedAt']), + lastViewedAt: flexibleInt(json['lastViewedAt']), + viewCount: flexibleInt(json['viewCount']), + content: json['content'] as String?, + guid: json['guid'] as String?, + thumb: json['thumb'] as String?, + ); PlexHubDto _$PlexHubDtoFromJson(Map json) => PlexHubDto( hubKey: readStringField(json, 'key') as String? ?? '', @@ -72,125 +75,130 @@ PlexHubDto _$PlexHubDtoFromJson(Map json) => PlexHubDto( items: _hubItemsFromJson(_readHubItems(json, 'items')), ); -PlexMetadataDto _$PlexMetadataDtoFromJson(Map json) => PlexMetadataDto( - ratingKey: _readMetadataRatingKey(json, 'ratingKey') as String? ?? '', - key: json['key'] as String?, - guid: json['guid'] as String?, - studio: json['studio'] as String?, - type: json['type'] as String?, - title: json['title'] as String?, - titleSort: json['titleSort'] as String?, - contentRating: json['contentRating'] as String?, - summary: json['summary'] as String?, - rating: (json['rating'] as num?)?.toDouble(), - audienceRating: (json['audienceRating'] as num?)?.toDouble(), - userRating: (json['userRating'] as num?)?.toDouble(), - year: flexibleInt(json['year']), - originallyAvailableAt: json['originallyAvailableAt'] as String?, - thumb: json['thumb'] as String?, - art: json['art'] as String?, - duration: flexibleInt(json['duration']), - addedAt: flexibleInt(json['addedAt']), - updatedAt: flexibleInt(json['updatedAt']), - lastViewedAt: flexibleInt(json['lastViewedAt']), - grandparentTitle: json['grandparentTitle'] as String?, - grandparentThumb: json['grandparentThumb'] as String?, - grandparentArt: json['grandparentArt'] as String?, - grandparentRatingKey: readStringField(json, 'grandparentRatingKey') as String?, - parentTitle: json['parentTitle'] as String?, - parentThumb: json['parentThumb'] as String?, - parentRatingKey: readStringField(json, 'parentRatingKey') as String?, - parentIndex: flexibleInt(json['parentIndex']), - index: flexibleInt(json['index']), - grandparentTheme: json['grandparentTheme'] as String?, - viewOffset: flexibleInt(json['viewOffset']), - viewCount: flexibleInt(json['viewCount']), - leafCount: flexibleInt(json['leafCount']), - viewedLeafCount: flexibleInt(json['viewedLeafCount']), - childCount: flexibleInt(json['childCount']), - role: (json['Role'] as List?)?.map((e) => PlexRoleDto.fromJson(e as Map)).toList(), - mediaVersions: (json['Media'] as List?) - ?.map((e) => PlexMediaVersionDto.fromJson(e as Map)) - .toList(), - genre: _tagListFromJson(json['Genre']), - director: _tagListFromJson(json['Director']), - writer: _tagListFromJson(json['Writer']), - producer: _tagListFromJson(json['Producer']), - country: _tagListFromJson(json['Country']), - collection: _tagListFromJson(json['Collection']), - label: _tagListFromJson(json['Label']), - style: _tagListFromJson(json['Style']), - mood: _tagListFromJson(json['Mood']), - audioLanguage: json['audioLanguage'] as String?, - subtitleLanguage: json['subtitleLanguage'] as String?, - subtitleMode: flexibleInt(json['subtitleMode']), - playlistItemID: flexibleInt(json['playlistItemID']), - playQueueItemID: flexibleInt(json['playQueueItemID']), - librarySectionID: flexibleInt(json['librarySectionID']), - librarySectionTitle: json['librarySectionTitle'] as String?, - ratingImage: json['ratingImage'] as String?, - audienceRatingImage: json['audienceRatingImage'] as String?, - tagline: json['tagline'] as String?, - originalTitle: json['originalTitle'] as String?, - editionTitle: json['editionTitle'] as String?, - subtype: json['subtype'] as String?, - extraType: flexibleInt(json['extraType']), - primaryExtraKey: json['primaryExtraKey'] as String?, - clearLogo: json['clearLogo'] as String?, - backgroundSquare: json['backgroundSquare'] as String?, -); +PlexMetadataDto _$PlexMetadataDtoFromJson(Map json) => + PlexMetadataDto( + ratingKey: _readMetadataRatingKey(json, 'ratingKey') as String? ?? '', + key: json['key'] as String?, + guid: json['guid'] as String?, + studio: json['studio'] as String?, + type: json['type'] as String?, + title: json['title'] as String?, + titleSort: json['titleSort'] as String?, + contentRating: json['contentRating'] as String?, + summary: json['summary'] as String?, + rating: (json['rating'] as num?)?.toDouble(), + audienceRating: (json['audienceRating'] as num?)?.toDouble(), + userRating: (json['userRating'] as num?)?.toDouble(), + year: flexibleInt(json['year']), + originallyAvailableAt: json['originallyAvailableAt'] as String?, + thumb: json['thumb'] as String?, + art: json['art'] as String?, + duration: flexibleInt(json['duration']), + addedAt: flexibleInt(json['addedAt']), + updatedAt: flexibleInt(json['updatedAt']), + lastViewedAt: flexibleInt(json['lastViewedAt']), + grandparentTitle: json['grandparentTitle'] as String?, + grandparentThumb: json['grandparentThumb'] as String?, + grandparentArt: json['grandparentArt'] as String?, + grandparentRatingKey: + readStringField(json, 'grandparentRatingKey') as String?, + parentTitle: json['parentTitle'] as String?, + parentThumb: json['parentThumb'] as String?, + parentRatingKey: readStringField(json, 'parentRatingKey') as String?, + parentIndex: flexibleInt(json['parentIndex']), + index: flexibleInt(json['index']), + grandparentTheme: json['grandparentTheme'] as String?, + viewOffset: flexibleInt(json['viewOffset']), + viewCount: flexibleInt(json['viewCount']), + leafCount: flexibleInt(json['leafCount']), + viewedLeafCount: flexibleInt(json['viewedLeafCount']), + childCount: flexibleInt(json['childCount']), + role: (json['Role'] as List?) + ?.map((e) => PlexRoleDto.fromJson(e as Map)) + .toList(), + mediaVersions: (json['Media'] as List?) + ?.map((e) => PlexMediaVersionDto.fromJson(e as Map)) + .toList(), + genre: _tagListFromJson(json['Genre']), + director: _tagListFromJson(json['Director']), + writer: _tagListFromJson(json['Writer']), + producer: _tagListFromJson(json['Producer']), + country: _tagListFromJson(json['Country']), + collection: _tagListFromJson(json['Collection']), + label: _tagListFromJson(json['Label']), + style: _tagListFromJson(json['Style']), + mood: _tagListFromJson(json['Mood']), + audioLanguage: json['audioLanguage'] as String?, + subtitleLanguage: json['subtitleLanguage'] as String?, + subtitleMode: flexibleInt(json['subtitleMode']), + playlistItemID: flexibleInt(json['playlistItemID']), + playQueueItemID: flexibleInt(json['playQueueItemID']), + librarySectionID: flexibleInt(json['librarySectionID']), + librarySectionTitle: json['librarySectionTitle'] as String?, + ratingImage: json['ratingImage'] as String?, + audienceRatingImage: json['audienceRatingImage'] as String?, + tagline: json['tagline'] as String?, + originalTitle: json['originalTitle'] as String?, + editionTitle: json['editionTitle'] as String?, + subtype: json['subtype'] as String?, + extraType: flexibleInt(json['extraType']), + primaryExtraKey: json['primaryExtraKey'] as String?, + clearLogo: json['clearLogo'] as String?, + backgroundSquare: json['backgroundSquare'] as String?, + ); -Map _$PlexMetadataDtoToJson(PlexMetadataDto instance) => { - 'ratingKey': instance.ratingKey, - 'key': ?instance.key, - 'guid': ?instance.guid, - 'studio': ?instance.studio, - 'type': ?instance.type, - 'title': ?instance.title, - 'titleSort': ?instance.titleSort, - 'contentRating': ?instance.contentRating, - 'summary': ?instance.summary, - 'rating': ?instance.rating, - 'audienceRating': ?instance.audienceRating, - 'userRating': ?instance.userRating, - 'year': ?instance.year, - 'originallyAvailableAt': ?instance.originallyAvailableAt, - 'thumb': ?instance.thumb, - 'art': ?instance.art, - 'duration': ?instance.duration, - 'addedAt': ?instance.addedAt, - 'updatedAt': ?instance.updatedAt, - 'lastViewedAt': ?instance.lastViewedAt, - 'grandparentTitle': ?instance.grandparentTitle, - 'grandparentThumb': ?instance.grandparentThumb, - 'grandparentArt': ?instance.grandparentArt, - 'grandparentRatingKey': ?instance.grandparentRatingKey, - 'parentTitle': ?instance.parentTitle, - 'parentThumb': ?instance.parentThumb, - 'parentRatingKey': ?instance.parentRatingKey, - 'parentIndex': ?instance.parentIndex, - 'index': ?instance.index, - 'grandparentTheme': ?instance.grandparentTheme, - 'viewOffset': ?instance.viewOffset, - 'viewCount': ?instance.viewCount, - 'leafCount': ?instance.leafCount, - 'viewedLeafCount': ?instance.viewedLeafCount, - 'childCount': ?instance.childCount, - 'audioLanguage': ?instance.audioLanguage, - 'subtitleLanguage': ?instance.subtitleLanguage, - 'subtitleMode': ?instance.subtitleMode, - 'playlistItemID': ?instance.playlistItemID, - 'playQueueItemID': ?instance.playQueueItemID, - 'librarySectionID': ?instance.librarySectionID, - 'librarySectionTitle': ?instance.librarySectionTitle, - 'ratingImage': ?instance.ratingImage, - 'audienceRatingImage': ?instance.audienceRatingImage, - 'tagline': ?instance.tagline, - 'originalTitle': ?instance.originalTitle, - 'editionTitle': ?instance.editionTitle, - 'subtype': ?instance.subtype, - 'extraType': ?instance.extraType, - 'primaryExtraKey': ?instance.primaryExtraKey, - 'clearLogo': ?instance.clearLogo, - 'backgroundSquare': ?instance.backgroundSquare, -}; +Map _$PlexMetadataDtoToJson(PlexMetadataDto instance) => + { + 'ratingKey': instance.ratingKey, + 'key': ?instance.key, + 'guid': ?instance.guid, + 'studio': ?instance.studio, + 'type': ?instance.type, + 'title': ?instance.title, + 'titleSort': ?instance.titleSort, + 'contentRating': ?instance.contentRating, + 'summary': ?instance.summary, + 'rating': ?instance.rating, + 'audienceRating': ?instance.audienceRating, + 'userRating': ?instance.userRating, + 'year': ?instance.year, + 'originallyAvailableAt': ?instance.originallyAvailableAt, + 'thumb': ?instance.thumb, + 'art': ?instance.art, + 'duration': ?instance.duration, + 'addedAt': ?instance.addedAt, + 'updatedAt': ?instance.updatedAt, + 'lastViewedAt': ?instance.lastViewedAt, + 'grandparentTitle': ?instance.grandparentTitle, + 'grandparentThumb': ?instance.grandparentThumb, + 'grandparentArt': ?instance.grandparentArt, + 'grandparentRatingKey': ?instance.grandparentRatingKey, + 'parentTitle': ?instance.parentTitle, + 'parentThumb': ?instance.parentThumb, + 'parentRatingKey': ?instance.parentRatingKey, + 'parentIndex': ?instance.parentIndex, + 'index': ?instance.index, + 'grandparentTheme': ?instance.grandparentTheme, + 'viewOffset': ?instance.viewOffset, + 'viewCount': ?instance.viewCount, + 'leafCount': ?instance.leafCount, + 'viewedLeafCount': ?instance.viewedLeafCount, + 'childCount': ?instance.childCount, + 'audioLanguage': ?instance.audioLanguage, + 'subtitleLanguage': ?instance.subtitleLanguage, + 'subtitleMode': ?instance.subtitleMode, + 'playlistItemID': ?instance.playlistItemID, + 'playQueueItemID': ?instance.playQueueItemID, + 'librarySectionID': ?instance.librarySectionID, + 'librarySectionTitle': ?instance.librarySectionTitle, + 'ratingImage': ?instance.ratingImage, + 'audienceRatingImage': ?instance.audienceRatingImage, + 'tagline': ?instance.tagline, + 'originalTitle': ?instance.originalTitle, + 'editionTitle': ?instance.editionTitle, + 'subtype': ?instance.subtype, + 'extraType': ?instance.extraType, + 'primaryExtraKey': ?instance.primaryExtraKey, + 'clearLogo': ?instance.clearLogo, + 'backgroundSquare': ?instance.backgroundSquare, + }; diff --git a/lib/services/trackers/anilist/anilist_session.g.dart b/lib/services/trackers/anilist/anilist_session.g.dart index b46c1683..e7b6289c 100644 --- a/lib/services/trackers/anilist/anilist_session.g.dart +++ b/lib/services/trackers/anilist/anilist_session.g.dart @@ -6,16 +6,18 @@ part of 'anilist_session.dart'; // JsonSerializableGenerator // ************************************************************************** -AnilistSession _$AnilistSessionFromJson(Map json) => AnilistSession( - accessToken: json['access_token'] as String, - expiresAt: (json['expires_at'] as num).toInt(), - createdAt: (json['created_at'] as num).toInt(), - username: json['username'] as String?, -); +AnilistSession _$AnilistSessionFromJson(Map json) => + AnilistSession( + accessToken: json['access_token'] as String, + expiresAt: (json['expires_at'] as num).toInt(), + createdAt: (json['created_at'] as num).toInt(), + username: json['username'] as String?, + ); -Map _$AnilistSessionToJson(AnilistSession instance) => { - 'access_token': instance.accessToken, - 'expires_at': instance.expiresAt, - 'username': instance.username, - 'created_at': instance.createdAt, -}; +Map _$AnilistSessionToJson(AnilistSession instance) => + { + 'access_token': instance.accessToken, + 'expires_at': instance.expiresAt, + 'username': instance.username, + 'created_at': instance.createdAt, + }; diff --git a/lib/services/trackers/mal/mal_session.g.dart b/lib/services/trackers/mal/mal_session.g.dart index e680644b..0132f72f 100644 --- a/lib/services/trackers/mal/mal_session.g.dart +++ b/lib/services/trackers/mal/mal_session.g.dart @@ -14,10 +14,11 @@ MalSession _$MalSessionFromJson(Map json) => MalSession( username: json['username'] as String?, ); -Map _$MalSessionToJson(MalSession instance) => { - 'access_token': instance.accessToken, - 'refresh_token': instance.refreshToken, - 'expires_at': instance.expiresAt, - 'username': instance.username, - 'created_at': instance.createdAt, -}; +Map _$MalSessionToJson(MalSession instance) => + { + 'access_token': instance.accessToken, + 'refresh_token': instance.refreshToken, + 'expires_at': instance.expiresAt, + 'username': instance.username, + 'created_at': instance.createdAt, + }; diff --git a/lib/services/trackers/simkl/simkl_session.g.dart b/lib/services/trackers/simkl/simkl_session.g.dart index 8b7f9d15..2ff10578 100644 --- a/lib/services/trackers/simkl/simkl_session.g.dart +++ b/lib/services/trackers/simkl/simkl_session.g.dart @@ -12,8 +12,9 @@ SimklSession _$SimklSessionFromJson(Map json) => SimklSession( username: json['username'] as String?, ); -Map _$SimklSessionToJson(SimklSession instance) => { - 'access_token': instance.accessToken, - 'username': instance.username, - 'created_at': instance.createdAt, -}; +Map _$SimklSessionToJson(SimklSession instance) => + { + 'access_token': instance.accessToken, + 'username': instance.username, + 'created_at': instance.createdAt, + }; diff --git a/lib/services/trakt/trakt_session.g.dart b/lib/services/trakt/trakt_session.g.dart index 8b376535..b6ae43c4 100644 --- a/lib/services/trakt/trakt_session.g.dart +++ b/lib/services/trakt/trakt_session.g.dart @@ -15,11 +15,12 @@ TraktSession _$TraktSessionFromJson(Map json) => TraktSession( username: json['username'] as String?, ); -Map _$TraktSessionToJson(TraktSession instance) => { - 'access_token': instance.accessToken, - 'refresh_token': instance.refreshToken, - 'expires_at': instance.expiresAt, - 'username': instance.username, - 'scope': instance.scope, - 'created_at': instance.createdAt, -}; +Map _$TraktSessionToJson(TraktSession instance) => + { + 'access_token': instance.accessToken, + 'refresh_token': instance.refreshToken, + 'expires_at': instance.expiresAt, + 'username': instance.username, + 'scope': instance.scope, + 'created_at': instance.createdAt, + }; diff --git a/lib/watch_together/services/recent_rooms_service.g.dart b/lib/watch_together/services/recent_rooms_service.g.dart index 8da02fde..118a5f89 100644 --- a/lib/watch_together/services/recent_rooms_service.g.dart +++ b/lib/watch_together/services/recent_rooms_service.g.dart @@ -13,9 +13,10 @@ RecentRoom _$RecentRoomFromJson(Map json) => RecentRoom( controlMode: _controlModeFromIndex((json['controlMode'] as num?)?.toInt()), ); -Map _$RecentRoomToJson(RecentRoom instance) => { - 'code': instance.code, - 'name': ?instance.name, - 'lastUsed': _dateTimeToMillis(instance.lastUsed), - 'controlMode': ?_controlModeToIndex(instance.controlMode), -}; +Map _$RecentRoomToJson(RecentRoom instance) => + { + 'code': instance.code, + 'name': ?instance.name, + 'lastUsed': _dateTimeToMillis(instance.lastUsed), + 'controlMode': ?_controlModeToIndex(instance.controlMode), + }; diff --git a/pubspec.lock b/pubspec.lock index e5120c6f..14fb511e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -482,6 +482,22 @@ packages: description: flutter source: sdk version: "0.0.0" + freezed: + dependency: "direct dev" + description: + name: freezed + sha256: f23ea33b3863f119b58ed1b586e881a46bd28715ddcc4dbc33104524e3434131 + url: "https://pub.dev" + source: hosted + version: "3.2.5" + freezed_annotation: + dependency: "direct main" + description: + name: freezed_annotation + sha256: "7294967ff0a6d98638e7acb774aac3af2550777accd8149c90af5b014e6d44d8" + url: "https://pub.dev" + source: hosted + version: "3.1.0" glob: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 29614746..274a5083 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -70,6 +70,7 @@ dependencies: cronet_http: ^1.6.0 win_http: ^0.2.0 collection: ^1.18.0 + freezed_annotation: ^3.1.0 dev_dependencies: flutter_test: @@ -83,6 +84,7 @@ dev_dependencies: shared_preferences_platform_interface: ^2.4.0 path_provider_platform_interface: ^2.1.0 plugin_platform_interface: ^2.1.0 + freezed: ^3.2.5 dependency_overrides: auto_updater_platform_interface: diff --git a/test/media/media_item_test.dart b/test/media/media_item_test.dart index da677fc7..a8649fd6 100644 --- a/test/media/media_item_test.dart +++ b/test/media/media_item_test.dart @@ -2,6 +2,9 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:plezy/media/media_backend.dart'; import 'package:plezy/media/media_item.dart'; import 'package:plezy/media/media_kind.dart'; +import 'package:plezy/media/media_part.dart'; +import 'package:plezy/media/media_role.dart'; +import 'package:plezy/media/media_version.dart'; /// Backend-agnostic [MediaItem] tests. Existing coverage is split between /// `plex_mappers_test` and `jellyfin_mappers_test` — those exercise the @@ -187,6 +190,137 @@ void main() { expect(original.copyWith(title: 'New').backend, backend, reason: 'copyWith must preserve backend'); } }); + + test('preserves Plex-only fields when omitted', () { + const original = PlexMediaItem( + id: 'p1', + kind: MediaKind.movie, + title: 'Old', + editionTitle: 'Director Cut', + audienceRating: 8.9, + ratingImage: 'rottentomatoes://rating', + audienceRatingImage: 'rottentomatoes://audience', + subtitleLanguage: 'eng', + subtitleMode: 1, + trailerKey: '/library/metadata/1', + playlistItemId: 42, + playQueueItemId: 7, + subtype: 'trailer', + extraType: 1, + ); + + final copy = original.copyWith(title: 'New'); + + expect(copy.title, 'New'); + expect(copy.editionTitle, 'Director Cut'); + expect(copy.audienceRating, 8.9); + expect(copy.ratingImage, 'rottentomatoes://rating'); + expect(copy.audienceRatingImage, 'rottentomatoes://audience'); + expect(copy.subtitleLanguage, 'eng'); + expect(copy.subtitleMode, 1); + expect(copy.trailerKey, '/library/metadata/1'); + expect(copy.playlistItemId, 42); + expect(copy.playQueueItemId, 7); + expect(copy.subtype, 'trailer'); + expect(copy.extraType, 1); + }); + + test('preserves Jellyfin playlist item id when omitted', () { + const original = JellyfinMediaItem( + id: 'j1', + kind: MediaKind.movie, + title: 'Old', + playlistItemId: 'playlist-entry-1', + ); + + final copy = original.copyWith(title: 'New'); + + expect(copy.title, 'New'); + expect(copy.playlistItemId, 'playlist-entry-1'); + }); + + test('can clear nullable fields explicitly', () { + final original = _movie(title: 'Movie', viewCount: 1, durationMs: 1000, viewOffsetMs: 500); + + final copy = original.copyWith(title: null, viewOffsetMs: null); + + expect(copy.title, isNull); + expect(copy.viewOffsetMs, isNull); + expect(copy.viewCount, 1); + }); + }); + + group('MediaItem JSON', () { + test('round-trips Plex-only fields', () { + const original = PlexMediaItem( + id: 'p1', + kind: MediaKind.movie, + title: 'Movie', + editionTitle: 'Theatrical', + audienceRating: 9.1, + ratingImage: 'rottentomatoes://rating', + audienceRatingImage: 'rottentomatoes://audience', + genres: ['Drama'], + roles: [MediaRole(id: '1', tag: 'Actor', role: 'Lead', thumbPath: '/photo')], + mediaVersions: [ + MediaVersion( + id: 'v1', + width: 1920, + height: 1080, + parts: [MediaPart(id: 'part1', streamPath: '/stream', sizeBytes: 1000)], + ), + ], + subtitleLanguage: 'eng', + subtitleMode: 2, + trailerKey: '/trailer', + playlistItemId: 4, + playQueueItemId: 5, + subtype: 'trailer', + extraType: 9, + ); + + final json = original.toJson(); + final decoded = MediaItem.fromJson(json); + + expect(json['backend'], 'plex'); + expect(json.containsKey('summary'), isFalse); + expect(decoded, isA()); + final plex = decoded as PlexMediaItem; + expect(plex.editionTitle, 'Theatrical'); + expect(plex.audienceRating, 9.1); + expect(plex.ratingImage, 'rottentomatoes://rating'); + expect(plex.audienceRatingImage, 'rottentomatoes://audience'); + expect(plex.genres, ['Drama']); + expect(plex.roles?.single.tag, 'Actor'); + expect(plex.mediaVersions?.single.parts.single.streamPath, '/stream'); + expect(plex.subtitleLanguage, 'eng'); + expect(plex.subtitleMode, 2); + expect(plex.trailerKey, '/trailer'); + expect(plex.playlistItemId, 4); + expect(plex.playQueueItemId, 5); + expect(plex.subtype, 'trailer'); + expect(plex.extraType, 9); + }); + + test('round-trips Jellyfin playlist item id', () { + const original = JellyfinMediaItem(id: 'j1', kind: MediaKind.movie, title: 'Movie', playlistItemId: 'entry-1'); + + final json = original.toJson(); + final decoded = MediaItem.fromJson(json); + + expect(json['backend'], 'jellyfin'); + expect(decoded, isA()); + expect((decoded as JellyfinMediaItem).playlistItemId, 'entry-1'); + }); + + test('missing backend keeps legacy Plex fallback', () { + final decoded = MediaItem.fromJson({'id': 'legacy', 'kind': 'movie'}); + + expect(decoded, isA()); + expect(decoded.backend, MediaBackend.plex); + expect(decoded.id, 'legacy'); + expect(decoded.kind, MediaKind.movie); + }); }); group('MediaItem.displayTitle', () {