diff --git a/lib/app/screens/album_screen.dart b/lib/app/screens/album_screen.dart index 1b7fb5a..43f20b8 100644 --- a/lib/app/screens/album_screen.dart +++ b/lib/app/screens/album_screen.dart @@ -1,14 +1,16 @@ -import 'dart:async'; - +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import '../../database/query.dart'; import '../../l10n/generated/app_localizations.dart'; import '../state/database.dart'; import '../state/source.dart'; import '../ui/cover_art_theme.dart'; -import '../ui/images.dart'; +import '../ui/gradient.dart'; +import '../ui/lists/header.dart'; +import '../ui/lists/songs_list.dart'; class AlbumScreen extends HookConsumerWidget { const AlbumScreen({ @@ -34,111 +36,35 @@ class AlbumScreen extends HookConsumerWidget { return Container(); } + final query = SongsQuery( + sourceId: sourceId, + filter: IList([SongsFilter.albumId(album.id)]), + sort: IList([ + SongsSortingTerm(dir: SortDirection.asc, by: SongsColumn.disc), + SongsSortingTerm(dir: SortDirection.asc, by: SongsColumn.track), + SongsSortingTerm(dir: SortDirection.asc, by: SongsColumn.title), + ]), + ); + return CoverArtTheme( coverArt: album.coverArt, child: Scaffold( - body: Center( - child: CustomScrollView( - slivers: [ - SliverToBoxAdapter( - child: SafeArea( - child: Padding( - padding: EdgeInsetsGeometry.symmetric(horizontal: 16), - child: _Header( - title: album.name, - subtitle: album.albumArtist, - coverArt: album.coverArt, - playText: l.resourcesAlbumActionsPlay, - onPlay: () {}, - onMore: () {}, - ), - ), - ), + body: GradientScrollView( + slivers: [ + SliverToBoxAdapter( + child: SongsListHeader( + title: album.name, + subtitle: album.albumArtist, + coverArt: album.coverArt, + playText: l.resourcesAlbumActionsPlay, + onPlay: () {}, + onMore: () {}, ), - ], - ), + ), + SongsList(query: query), + ], ), ), ); } } - -class _Header extends HookConsumerWidget { - const _Header({ - required this.title, - this.subtitle, - this.coverArt, - this.playText, - this.onPlay, - this.onMore, - // required this.downloadActions, - }); - - final String title; - final String? subtitle; - final String? coverArt; - final String? playText; - final void Function()? onPlay; - final FutureOr Function()? onMore; - // final List downloadActions; - - @override - Widget build(BuildContext context, WidgetRef ref) { - // final inheritedStyle = DefaultTextStyle.of(context).style; - final theme = Theme.of(context); - - return Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 16), - CoverArtImage( - height: 300, - thumbnail: false, - coverArt: coverArt, - fit: BoxFit.contain, - ), - const SizedBox(height: 20), - Column( - children: [ - Text( - title, - style: theme.textTheme.headlineMedium, - textAlign: TextAlign.center, - ), - Text( - subtitle ?? '', - style: theme.textTheme.headlineSmall, - textAlign: TextAlign.center, - ), - ], - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - IconButton( - onPressed: () {}, - icon: const Icon(Icons.download_done_rounded), - ), - if (onPlay != null) - FilledButton.icon( - onPressed: onPlay, - icon: const Icon(Icons.play_arrow_rounded), - label: Text( - playText ?? '', - // style: theme.textTheme.bodyLarge?.copyWith( - // color: theme.colorScheme.onPrimary, - // ), - ), - ), - if (onMore != null) - IconButton( - onPressed: onMore, - icon: const Icon(Icons.more_horiz), - ), - ], - ), - ], - ); - } -} diff --git a/lib/app/screens/library_screen.dart b/lib/app/screens/library_screen.dart index 87581f4..563132c 100644 --- a/lib/app/screens/library_screen.dart +++ b/lib/app/screens/library_screen.dart @@ -5,9 +5,9 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:material_symbols_icons/symbols.dart'; import '../../l10n/generated/app_localizations.dart'; -import '../lists/albums_grid.dart'; -import '../lists/artists_list.dart'; import '../state/services.dart'; +import '../ui/lists/albums_grid.dart'; +import '../ui/lists/artists_list.dart'; import '../util/custom_scroll_fix.dart'; const kIconSize = 26.0; diff --git a/lib/app/ui/gradient.dart b/lib/app/ui/gradient.dart new file mode 100644 index 0000000..c1a3635 --- /dev/null +++ b/lib/app/ui/gradient.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:sliver_tools/sliver_tools.dart'; + +class ThemedGradient extends LinearGradient { + const ThemedGradient({ + required super.colors, + super.begin, + super.end, + }); + + factory ThemedGradient.of( + BuildContext context, { + AlignmentGeometry begin = Alignment.topCenter, + AlignmentGeometry end = Alignment.bottomCenter, + }) { + final colorScheme = Theme.of(context).colorScheme; + + return ThemedGradient( + begin: begin, + end: end, + colors: [ + colorScheme.primaryContainer, + colorScheme.surface, + ], + ); + } +} + +class GradientScrollView extends HookConsumerWidget { + const GradientScrollView({ + super.key, + required this.slivers, + }); + + final List slivers; + + @override + Widget build(BuildContext context, WidgetRef ref) { + return CustomScrollView( + slivers: [ + SliverStack( + children: [ + SliverPositioned.directional( + textDirection: TextDirection.ltr, + start: 0, + end: 0, + top: 0, + child: Ink( + width: double.infinity, + height: MediaQuery.heightOf(context), + decoration: BoxDecoration( + gradient: ThemedGradient.of(context), + ), + ), + ), + MultiSliver(children: slivers), + ], + ), + ], + ); + } +} diff --git a/lib/app/lists/albums_grid.dart b/lib/app/ui/lists/albums_grid.dart similarity index 69% rename from lib/app/lists/albums_grid.dart rename to lib/app/ui/lists/albums_grid.dart index 1526287..2cac710 100644 --- a/lib/app/lists/albums_grid.dart +++ b/lib/app/ui/lists/albums_grid.dart @@ -1,14 +1,16 @@ +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; -import '../../sources/models.dart'; -import '../hooks/use_on_source.dart'; -import '../hooks/use_paging_controller.dart'; -import '../state/database.dart'; -import '../state/source.dart'; -import 'list_items.dart'; +import '../../../database/query.dart'; +import '../../../sources/models.dart'; +import '../../hooks/use_on_source.dart'; +import '../../hooks/use_paging_controller.dart'; +import '../../state/database.dart'; +import '../../state/source.dart'; +import 'items.dart'; const kPageSize = 60; @@ -22,9 +24,17 @@ class AlbumsGrid extends HookConsumerWidget { getNextPageKey: (state) => state.lastPageIsEmpty ? null : state.nextIntPageKey, fetchPage: (pageKey) => db.libraryDao.listAlbums( - sourceId: ref.read(sourceIdProvider), - limit: kPageSize, - offset: (pageKey - 1) * kPageSize, + AlbumsQuery( + sourceId: ref.read(sourceIdProvider), + sort: IList([ + AlbumsSortingTerm( + dir: SortDirection.desc, + by: AlbumsColumn.created, + ), + ]), + limit: kPageSize, + offset: (pageKey - 1) * kPageSize, + ), ), ); diff --git a/lib/app/lists/artists_list.dart b/lib/app/ui/lists/artists_list.dart similarity index 68% rename from lib/app/lists/artists_list.dart rename to lib/app/ui/lists/artists_list.dart index 793cc22..7b3e9b3 100644 --- a/lib/app/lists/artists_list.dart +++ b/lib/app/ui/lists/artists_list.dart @@ -1,14 +1,16 @@ +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; -import '../../database/dao/library_dao.dart'; -import '../hooks/use_on_source.dart'; -import '../hooks/use_paging_controller.dart'; -import '../state/database.dart'; -import '../state/source.dart'; -import 'list_items.dart'; +import '../../../database/dao/library_dao.dart'; +import '../../../database/query.dart'; +import '../../hooks/use_on_source.dart'; +import '../../hooks/use_paging_controller.dart'; +import '../../state/database.dart'; +import '../../state/source.dart'; +import 'items.dart'; const kPageSize = 30; @@ -22,9 +24,17 @@ class ArtistsList extends HookConsumerWidget { getNextPageKey: (state) => state.lastPageIsEmpty ? null : state.nextIntPageKey, fetchPage: (pageKey) => db.libraryDao.listArtists( - sourceId: ref.read(sourceIdProvider), - limit: kPageSize, - offset: (pageKey - 1) * kPageSize, + ArtistsQuery( + sourceId: ref.read(sourceIdProvider), + sort: IList([ + ArtistsSortingTerm( + dir: SortDirection.asc, + by: ArtistsColumn.name, + ), + ]), + limit: kPageSize, + offset: (pageKey - 1) * kPageSize, + ), ), ); diff --git a/lib/app/ui/lists/header.dart b/lib/app/ui/lists/header.dart new file mode 100644 index 0000000..671ba25 --- /dev/null +++ b/lib/app/ui/lists/header.dart @@ -0,0 +1,103 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; + +import '../images.dart'; + +class SongsListHeader extends HookConsumerWidget { + const SongsListHeader({ + super.key, + required this.title, + this.subtitle, + this.coverArt, + this.playText, + this.onPlay, + this.onMore, + // required this.downloadActions, + }); + + final String title; + final String? subtitle; + final String? coverArt; + final String? playText; + final void Function()? onPlay; + final FutureOr Function()? onMore; + // final List downloadActions; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final theme = Theme.of(context); + + return SafeArea( + minimum: EdgeInsets.symmetric(horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 24), + Container( + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + blurRadius: 20, + blurStyle: BlurStyle.normal, + color: Colors.black.withAlpha(100), + offset: Offset.zero, + spreadRadius: 2, + ), + ], + ), + child: CoverArtImage( + height: 300, + thumbnail: false, + coverArt: coverArt, + fit: BoxFit.contain, + ), + ), + const SizedBox(height: 20), + Column( + children: [ + Text( + title, + style: theme.textTheme.headlineMedium, + textAlign: TextAlign.center, + ), + Text( + subtitle ?? '', + style: theme.textTheme.headlineSmall, + textAlign: TextAlign.center, + ), + ], + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + IconButton( + onPressed: () {}, + icon: const Icon(Icons.download_done_rounded), + ), + if (onPlay != null) + FilledButton.icon( + onPressed: onPlay, + icon: const Icon(Icons.play_arrow_rounded), + label: Text( + playText ?? '', + // style: theme.textTheme.bodyLarge?.copyWith( + // color: theme.colorScheme.onPrimary, + // ), + ), + ), + if (onMore != null) + IconButton( + onPressed: onMore, + icon: const Icon(Icons.more_horiz), + ), + ], + ), + const SizedBox(height: 24), + ], + ), + ); + } +} diff --git a/lib/app/lists/list_items.dart b/lib/app/ui/lists/items.dart similarity index 78% rename from lib/app/lists/list_items.dart rename to lib/app/ui/lists/items.dart index e0782d2..9ba01a9 100644 --- a/lib/app/lists/list_items.dart +++ b/lib/app/ui/lists/items.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import '../../sources/models.dart'; -import '../ui/images.dart'; -import '../util/clip.dart'; +import '../../../sources/models.dart'; +import '../../util/clip.dart'; +import '../images.dart'; class AlbumGridTile extends HookConsumerWidget { const AlbumGridTile({ @@ -62,6 +62,30 @@ class ArtistListTile extends StatelessWidget { } } +class SongListTile extends StatelessWidget { + const SongListTile({ + super.key, + required this.song, + this.onTap, + }); + + final Song song; + final void Function()? onTap; + + @override + Widget build(BuildContext context) { + return ListTile( + // leading: CoverArtImage( + // coverArt: song.coverArt, + // thumbnail: true, + // ), + title: Text(song.title), + subtitle: Text(song.artist ?? ''), + onTap: onTap, + ); + } +} + class ImageCard extends StatelessWidget { const ImageCard({ super.key, diff --git a/lib/app/ui/lists/songs_list.dart b/lib/app/ui/lists/songs_list.dart new file mode 100644 index 0000000..5eb3740 --- /dev/null +++ b/lib/app/ui/lists/songs_list.dart @@ -0,0 +1,57 @@ +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; + +import '../../../database/query.dart'; +import '../../../sources/models.dart'; +import '../../hooks/use_on_source.dart'; +import '../../hooks/use_paging_controller.dart'; +import '../../state/database.dart'; +import 'items.dart'; + +const kPageSize = 30; + +class SongsList extends HookConsumerWidget { + const SongsList({ + super.key, + required this.query, + }); + + final SongsQuery query; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final db = ref.watch(databaseProvider); + final controller = usePagingController( + getNextPageKey: (state) => + state.lastPageIsEmpty ? null : state.nextIntPageKey, + fetchPage: (pageKey) => db.libraryDao.listSongs( + query.copyWith( + limit: kPageSize, + offset: (pageKey - 1) * kPageSize, + ), + ), + ); + + useOnSourceChange(ref, (_) => controller.refresh()); + useOnSourceSync(ref, controller.refresh); + + return PagingListener( + controller: controller, + builder: (context, state, fetchNextPage) { + return PagedSliverList( + state: state, + fetchNextPage: fetchNextPage, + builderDelegate: PagedChildBuilderDelegate( + itemBuilder: (context, item, index) { + return SongListTile( + song: item, + onTap: () async {}, + ); + }, + ), + ); + }, + ); + } +} diff --git a/lib/database/dao/library_dao.dart b/lib/database/dao/library_dao.dart index 7ba86e4..5545649 100644 --- a/lib/database/dao/library_dao.dart +++ b/lib/database/dao/library_dao.dart @@ -2,37 +2,78 @@ import 'package:drift/drift.dart'; import '../../sources/models.dart' as models; import '../database.dart'; +import '../query.dart'; part 'library_dao.g.dart'; typedef AristListItem = ({models.Artist artist, int? albumCount}); +extension on SortDirection { + OrderingMode toMode() => switch (this) { + SortDirection.asc => OrderingMode.asc, + SortDirection.desc => OrderingMode.desc, + }; +} + @DriftAccessor(include: {'../tables.drift'}) class LibraryDao extends DatabaseAccessor with _$LibraryDaoMixin { LibraryDao(super.db); - Future> listAlbums({ - required int sourceId, - required int limit, - required int offset, - }) { + Future> listAlbums(AlbumsQuery q) { final query = albums.select() - ..where( - (f) => f.sourceId.equals(sourceId), - ) - ..limit(limit, offset: offset); + ..where((albums) { + var filter = albums.sourceId.equals(q.sourceId); + for (final queryFilter in q.filter) { + filter &= switch (queryFilter) { + AlbumsFilterArtistId(:final artistId) => albums.artistId.equals( + artistId, + ), + AlbumsFilterYearEquals(:final year) => albums.year.equals(year), + _ => CustomExpression(''), + }; + } + + return filter; + }) + ..orderBy( + q.sort + .map( + (sort) => + (albums) => OrderingTerm( + expression: switch (sort.by) { + AlbumsColumn.name => albums.name, + AlbumsColumn.created => albums.created, + AlbumsColumn.year => albums.year, + AlbumsColumn.starred => albums.starred, + }, + mode: sort.dir.toMode(), + ), + ) + .toList(), + ); + + _limitQuery(query: query, limit: q.limit, offset: q.offset); return query.get(); } - Future> listArtists({ - required int sourceId, - required int limit, - required int offset, - }) async { + Future> listArtists(ArtistsQuery q) { final albumCount = albums.id.count(); + var filter = + artists.sourceId.equals(q.sourceId) & + albums.sourceId.equals(q.sourceId); + + for (final queryFilter in q.filter) { + filter &= switch (queryFilter) { + ArtistsFilterStarred(:final starred) => + starred ? artists.starred.isNotNull() : artists.starred.isNull(), + ArtistsFilterNameSearch() => CustomExpression(''), + _ => CustomExpression(''), + }; + } + final query = artists.select().join([ leftOuterJoin( @@ -41,22 +82,78 @@ class LibraryDao extends DatabaseAccessor ), ]) ..addColumns([albumCount]) - ..where( - artists.sourceId.equals(sourceId) & - albums.sourceId.equals(sourceId), - ) + ..where(filter) ..groupBy([artists.sourceId, artists.id]) - ..orderBy([OrderingTerm.asc(artists.name)]) - ..limit(limit, offset: offset); + ..orderBy( + q.sort + .map( + (sort) => OrderingTerm( + expression: switch (sort.by) { + ArtistsColumn.name => artists.name, + ArtistsColumn.starred => artists.starred, + ArtistsColumn.albumCount => albumCount, + }, + mode: sort.dir.toMode(), + ), + ) + .toList(), + ); - return (await query.get()) + _limitQuery(query: query, limit: q.limit, offset: q.offset); + + return query .map( (row) => ( artist: row.readTable(artists), albumCount: row.read(albumCount) ?? 0, ), ) - .toList(); + .get(); + } + + Future> listSongs(SongsQuery q) { + var joinPlaylistSongs = false; + var filter = songs.sourceId.equals(q.sourceId); + + for (final queryFilter in q.filter) { + switch (queryFilter) { + case SongsFilterAlbumId(:final albumId): + filter &= songs.albumId.equals(albumId); + case SongsFilterPlaylistId(:final playlistId): + joinPlaylistSongs = true; + filter &= playlistSongs.playlistId.equals(playlistId); + } + } + + final query = + songs.select().join([ + if (joinPlaylistSongs) + leftOuterJoin( + playlistSongs, + playlistSongs.sourceId.equals(q.sourceId) & + playlistSongs.songId.equalsExp(songs.id), + ), + ]) + ..where(filter) + ..orderBy( + q.sort + .map( + (sort) => OrderingTerm( + expression: switch (sort.by) { + SongsColumn.title => songs.title, + SongsColumn.starred => songs.starred, + SongsColumn.disc => songs.disc, + SongsColumn.track => songs.track, + }, + mode: sort.dir.toMode(), + ), + ) + .toList(), + ); + + _limitQuery(query: query, limit: q.limit, offset: q.offset); + + return query.map((row) => (row.readTable(songs))).get(); } Selectable getAlbum(int sourceId, String id) { @@ -64,4 +161,14 @@ class LibraryDao extends DatabaseAccessor (f) => f.sourceId.equals(sourceId) & f.id.equals(id), ); } + + void _limitQuery({ + required LimitContainerMixin query, + required int? limit, + required int? offset, + }) { + if (limit != null) { + query.limit(limit, offset: offset); + } + } } diff --git a/lib/database/query.dart b/lib/database/query.dart new file mode 100644 index 0000000..cd3bb6f --- /dev/null +++ b/lib/database/query.dart @@ -0,0 +1,121 @@ +import 'package:fast_immutable_collections/fast_immutable_collections.dart'; +import 'package:freezed_annotation/freezed_annotation.dart'; + +part 'query.freezed.dart'; +part 'query.g.dart'; + +enum SortDirection { + asc, + desc, +} + +enum AlbumsColumn { + name, + created, + year, + starred, +} + +enum ArtistsColumn { + name, + starred, + albumCount, +} + +enum SongsColumn { + title, + starred, + disc, + track, +} + +@freezed +abstract class SortingTerm with _$SortingTerm { + const factory SortingTerm.albums({ + required SortDirection dir, + required AlbumsColumn by, + }) = AlbumsSortingTerm; + + const factory SortingTerm.artists({ + required SortDirection dir, + required ArtistsColumn by, + }) = ArtistsSortingTerm; + + const factory SortingTerm.songs({ + required SortDirection dir, + required SongsColumn by, + }) = SongsSortingTerm; + + factory SortingTerm.fromJson(Map json) => + _$SortingTermFromJson(json); +} + +@freezed +abstract class AlbumsQuery with _$AlbumsQuery { + const factory AlbumsQuery({ + required int sourceId, + @Default(IListConst([])) IList filter, + required IList sort, + int? limit, + int? offset, + }) = _AlbumsQuery; + + factory AlbumsQuery.fromJson(Map json) => + _$AlbumsQueryFromJson(json); +} + +@freezed +abstract class AlbumsFilter with _$AlbumsFilter { + const factory AlbumsFilter.artistId(String artistId) = AlbumsFilterArtistId; + const factory AlbumsFilter.yearEquals(int year) = AlbumsFilterYearEquals; + + factory AlbumsFilter.fromJson(Map json) => + _$AlbumsFilterFromJson(json); +} + +@freezed +abstract class ArtistsQuery with _$ArtistsQuery { + const factory ArtistsQuery({ + required int sourceId, + @Default(IListConst([])) IList filter, + required IList sort, + int? limit, + int? offset, + }) = _ArtistsQuery; + + factory ArtistsQuery.fromJson(Map json) => + _$ArtistsQueryFromJson(json); +} + +@freezed +abstract class ArtistsFilter with _$ArtistsFilter { + const factory ArtistsFilter.nameSearch(String name) = ArtistsFilterNameSearch; + const factory ArtistsFilter.starred(bool starred) = ArtistsFilterStarred; + + factory ArtistsFilter.fromJson(Map json) => + _$ArtistsFilterFromJson(json); +} + +@freezed +abstract class SongsQuery with _$SongsQuery { + const factory SongsQuery({ + required int sourceId, + @Default(IListConst([])) IList filter, + required IList sort, + int? limit, + int? offset, + }) = _SongsQuery; + + factory SongsQuery.fromJson(Map json) => + _$SongsQueryFromJson(json); +} + +@freezed +abstract class SongsFilter with _$SongsFilter { + const factory SongsFilter.albumId(String albumId) = SongsFilterAlbumId; + const factory SongsFilter.playlistId(String playlistId) = + SongsFilterPlaylistId; + + factory SongsFilter.fromJson(Map json) => + _$SongsFilterFromJson(json); +} diff --git a/lib/database/query.freezed.dart b/lib/database/query.freezed.dart new file mode 100644 index 0000000..722aa70 --- /dev/null +++ b/lib/database/query.freezed.dart @@ -0,0 +1,2311 @@ +// 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 'query.dart'; + +// ************************************************************************** +// FreezedGenerator +// ************************************************************************** + +// dart format off +T _$identity(T value) => value; +SortingTerm _$SortingTermFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'albums': + return AlbumsSortingTerm.fromJson( + json + ); + case 'artists': + return ArtistsSortingTerm.fromJson( + json + ); + case 'songs': + return SongsSortingTerm.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SortingTerm', + 'Invalid union type "${json['runtimeType']}"!' +); + } + +} + +/// @nodoc +mixin _$SortingTerm { + + SortDirection get dir; Enum get by; +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SortingTermCopyWith get copyWith => _$SortingTermCopyWithImpl(this as SortingTerm, _$identity); + + /// Serializes this SortingTerm to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SortingTerm&&(identical(other.dir, dir) || other.dir == dir)&&(identical(other.by, by) || other.by == by)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,dir,by); + +@override +String toString() { + return 'SortingTerm(dir: $dir, by: $by)'; +} + + +} + +/// @nodoc +abstract mixin class $SortingTermCopyWith<$Res> { + factory $SortingTermCopyWith(SortingTerm value, $Res Function(SortingTerm) _then) = _$SortingTermCopyWithImpl; +@useResult +$Res call({ + SortDirection dir +}); + + + + +} +/// @nodoc +class _$SortingTermCopyWithImpl<$Res> + implements $SortingTermCopyWith<$Res> { + _$SortingTermCopyWithImpl(this._self, this._then); + + final SortingTerm _self; + final $Res Function(SortingTerm) _then; + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? dir = null,}) { + return _then(_self.copyWith( +dir: null == dir ? _self.dir : dir // ignore: cast_nullable_to_non_nullable +as SortDirection, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SortingTerm]. +extension SortingTermPatterns on SortingTerm { +/// 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( AlbumsSortingTerm value)? albums,TResult Function( ArtistsSortingTerm value)? artists,TResult Function( SongsSortingTerm value)? songs,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case AlbumsSortingTerm() when albums != null: +return albums(_that);case ArtistsSortingTerm() when artists != null: +return artists(_that);case SongsSortingTerm() when songs != null: +return songs(_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( AlbumsSortingTerm value) albums,required TResult Function( ArtistsSortingTerm value) artists,required TResult Function( SongsSortingTerm value) songs,}){ +final _that = this; +switch (_that) { +case AlbumsSortingTerm(): +return albums(_that);case ArtistsSortingTerm(): +return artists(_that);case SongsSortingTerm(): +return songs(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( AlbumsSortingTerm value)? albums,TResult? Function( ArtistsSortingTerm value)? artists,TResult? Function( SongsSortingTerm value)? songs,}){ +final _that = this; +switch (_that) { +case AlbumsSortingTerm() when albums != null: +return albums(_that);case ArtistsSortingTerm() when artists != null: +return artists(_that);case SongsSortingTerm() when songs != null: +return songs(_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( SortDirection dir, AlbumsColumn by)? albums,TResult Function( SortDirection dir, ArtistsColumn by)? artists,TResult Function( SortDirection dir, SongsColumn by)? songs,required TResult orElse(),}) {final _that = this; +switch (_that) { +case AlbumsSortingTerm() when albums != null: +return albums(_that.dir,_that.by);case ArtistsSortingTerm() when artists != null: +return artists(_that.dir,_that.by);case SongsSortingTerm() when songs != null: +return songs(_that.dir,_that.by);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( SortDirection dir, AlbumsColumn by) albums,required TResult Function( SortDirection dir, ArtistsColumn by) artists,required TResult Function( SortDirection dir, SongsColumn by) songs,}) {final _that = this; +switch (_that) { +case AlbumsSortingTerm(): +return albums(_that.dir,_that.by);case ArtistsSortingTerm(): +return artists(_that.dir,_that.by);case SongsSortingTerm(): +return songs(_that.dir,_that.by);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( SortDirection dir, AlbumsColumn by)? albums,TResult? Function( SortDirection dir, ArtistsColumn by)? artists,TResult? Function( SortDirection dir, SongsColumn by)? songs,}) {final _that = this; +switch (_that) { +case AlbumsSortingTerm() when albums != null: +return albums(_that.dir,_that.by);case ArtistsSortingTerm() when artists != null: +return artists(_that.dir,_that.by);case SongsSortingTerm() when songs != null: +return songs(_that.dir,_that.by);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class AlbumsSortingTerm implements SortingTerm { + const AlbumsSortingTerm({required this.dir, required this.by, final String? $type}): $type = $type ?? 'albums'; + factory AlbumsSortingTerm.fromJson(Map json) => _$AlbumsSortingTermFromJson(json); + +@override final SortDirection dir; +@override final AlbumsColumn by; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AlbumsSortingTermCopyWith get copyWith => _$AlbumsSortingTermCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$AlbumsSortingTermToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AlbumsSortingTerm&&(identical(other.dir, dir) || other.dir == dir)&&(identical(other.by, by) || other.by == by)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,dir,by); + +@override +String toString() { + return 'SortingTerm.albums(dir: $dir, by: $by)'; +} + + +} + +/// @nodoc +abstract mixin class $AlbumsSortingTermCopyWith<$Res> implements $SortingTermCopyWith<$Res> { + factory $AlbumsSortingTermCopyWith(AlbumsSortingTerm value, $Res Function(AlbumsSortingTerm) _then) = _$AlbumsSortingTermCopyWithImpl; +@override @useResult +$Res call({ + SortDirection dir, AlbumsColumn by +}); + + + + +} +/// @nodoc +class _$AlbumsSortingTermCopyWithImpl<$Res> + implements $AlbumsSortingTermCopyWith<$Res> { + _$AlbumsSortingTermCopyWithImpl(this._self, this._then); + + final AlbumsSortingTerm _self; + final $Res Function(AlbumsSortingTerm) _then; + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? dir = null,Object? by = null,}) { + return _then(AlbumsSortingTerm( +dir: null == dir ? _self.dir : dir // ignore: cast_nullable_to_non_nullable +as SortDirection,by: null == by ? _self.by : by // ignore: cast_nullable_to_non_nullable +as AlbumsColumn, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class ArtistsSortingTerm implements SortingTerm { + const ArtistsSortingTerm({required this.dir, required this.by, final String? $type}): $type = $type ?? 'artists'; + factory ArtistsSortingTerm.fromJson(Map json) => _$ArtistsSortingTermFromJson(json); + +@override final SortDirection dir; +@override final ArtistsColumn by; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ArtistsSortingTermCopyWith get copyWith => _$ArtistsSortingTermCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$ArtistsSortingTermToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ArtistsSortingTerm&&(identical(other.dir, dir) || other.dir == dir)&&(identical(other.by, by) || other.by == by)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,dir,by); + +@override +String toString() { + return 'SortingTerm.artists(dir: $dir, by: $by)'; +} + + +} + +/// @nodoc +abstract mixin class $ArtistsSortingTermCopyWith<$Res> implements $SortingTermCopyWith<$Res> { + factory $ArtistsSortingTermCopyWith(ArtistsSortingTerm value, $Res Function(ArtistsSortingTerm) _then) = _$ArtistsSortingTermCopyWithImpl; +@override @useResult +$Res call({ + SortDirection dir, ArtistsColumn by +}); + + + + +} +/// @nodoc +class _$ArtistsSortingTermCopyWithImpl<$Res> + implements $ArtistsSortingTermCopyWith<$Res> { + _$ArtistsSortingTermCopyWithImpl(this._self, this._then); + + final ArtistsSortingTerm _self; + final $Res Function(ArtistsSortingTerm) _then; + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? dir = null,Object? by = null,}) { + return _then(ArtistsSortingTerm( +dir: null == dir ? _self.dir : dir // ignore: cast_nullable_to_non_nullable +as SortDirection,by: null == by ? _self.by : by // ignore: cast_nullable_to_non_nullable +as ArtistsColumn, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class SongsSortingTerm implements SortingTerm { + const SongsSortingTerm({required this.dir, required this.by, final String? $type}): $type = $type ?? 'songs'; + factory SongsSortingTerm.fromJson(Map json) => _$SongsSortingTermFromJson(json); + +@override final SortDirection dir; +@override final SongsColumn by; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SongsSortingTermCopyWith get copyWith => _$SongsSortingTermCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$SongsSortingTermToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SongsSortingTerm&&(identical(other.dir, dir) || other.dir == dir)&&(identical(other.by, by) || other.by == by)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,dir,by); + +@override +String toString() { + return 'SortingTerm.songs(dir: $dir, by: $by)'; +} + + +} + +/// @nodoc +abstract mixin class $SongsSortingTermCopyWith<$Res> implements $SortingTermCopyWith<$Res> { + factory $SongsSortingTermCopyWith(SongsSortingTerm value, $Res Function(SongsSortingTerm) _then) = _$SongsSortingTermCopyWithImpl; +@override @useResult +$Res call({ + SortDirection dir, SongsColumn by +}); + + + + +} +/// @nodoc +class _$SongsSortingTermCopyWithImpl<$Res> + implements $SongsSortingTermCopyWith<$Res> { + _$SongsSortingTermCopyWithImpl(this._self, this._then); + + final SongsSortingTerm _self; + final $Res Function(SongsSortingTerm) _then; + +/// Create a copy of SortingTerm +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? dir = null,Object? by = null,}) { + return _then(SongsSortingTerm( +dir: null == dir ? _self.dir : dir // ignore: cast_nullable_to_non_nullable +as SortDirection,by: null == by ? _self.by : by // ignore: cast_nullable_to_non_nullable +as SongsColumn, + )); +} + + +} + + +/// @nodoc +mixin _$AlbumsQuery { + + int get sourceId; IList get filter; IList get sort; int? get limit; int? get offset; +/// Create a copy of AlbumsQuery +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AlbumsQueryCopyWith get copyWith => _$AlbumsQueryCopyWithImpl(this as AlbumsQuery, _$identity); + + /// Serializes this AlbumsQuery to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AlbumsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'AlbumsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class $AlbumsQueryCopyWith<$Res> { + factory $AlbumsQueryCopyWith(AlbumsQuery value, $Res Function(AlbumsQuery) _then) = _$AlbumsQueryCopyWithImpl; +@useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class _$AlbumsQueryCopyWithImpl<$Res> + implements $AlbumsQueryCopyWith<$Res> { + _$AlbumsQueryCopyWithImpl(this._self, this._then); + + final AlbumsQuery _self; + final $Res Function(AlbumsQuery) _then; + +/// Create a copy of AlbumsQuery +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_self.copyWith( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [AlbumsQuery]. +extension AlbumsQueryPatterns on AlbumsQuery { +/// 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( _AlbumsQuery value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _AlbumsQuery() when $default != null: +return $default(_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(TResult Function( _AlbumsQuery value) $default,){ +final _that = this; +switch (_that) { +case _AlbumsQuery(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( _AlbumsQuery value)? $default,){ +final _that = this; +switch (_that) { +case _AlbumsQuery() when $default != null: +return $default(_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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _AlbumsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);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(TResult Function( int sourceId, IList filter, IList sort, int? limit, int? offset) $default,) {final _that = this; +switch (_that) { +case _AlbumsQuery(): +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,) {final _that = this; +switch (_that) { +case _AlbumsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _AlbumsQuery implements AlbumsQuery { + const _AlbumsQuery({required this.sourceId, this.filter = const IListConst([]), required this.sort, this.limit, this.offset}); + factory _AlbumsQuery.fromJson(Map json) => _$AlbumsQueryFromJson(json); + +@override final int sourceId; +@override@JsonKey() final IList filter; +@override final IList sort; +@override final int? limit; +@override final int? offset; + +/// Create a copy of AlbumsQuery +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$AlbumsQueryCopyWith<_AlbumsQuery> get copyWith => __$AlbumsQueryCopyWithImpl<_AlbumsQuery>(this, _$identity); + +@override +Map toJson() { + return _$AlbumsQueryToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _AlbumsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'AlbumsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class _$AlbumsQueryCopyWith<$Res> implements $AlbumsQueryCopyWith<$Res> { + factory _$AlbumsQueryCopyWith(_AlbumsQuery value, $Res Function(_AlbumsQuery) _then) = __$AlbumsQueryCopyWithImpl; +@override @useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class __$AlbumsQueryCopyWithImpl<$Res> + implements _$AlbumsQueryCopyWith<$Res> { + __$AlbumsQueryCopyWithImpl(this._self, this._then); + + final _AlbumsQuery _self; + final $Res Function(_AlbumsQuery) _then; + +/// Create a copy of AlbumsQuery +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_AlbumsQuery( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +AlbumsFilter _$AlbumsFilterFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'artistId': + return AlbumsFilterArtistId.fromJson( + json + ); + case 'yearEquals': + return AlbumsFilterYearEquals.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'AlbumsFilter', + 'Invalid union type "${json['runtimeType']}"!' +); + } + +} + +/// @nodoc +mixin _$AlbumsFilter { + + + + /// Serializes this AlbumsFilter to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AlbumsFilter); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'AlbumsFilter()'; +} + + +} + +/// @nodoc +class $AlbumsFilterCopyWith<$Res> { +$AlbumsFilterCopyWith(AlbumsFilter _, $Res Function(AlbumsFilter) __); +} + + +/// Adds pattern-matching-related methods to [AlbumsFilter]. +extension AlbumsFilterPatterns on AlbumsFilter { +/// 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( AlbumsFilterArtistId value)? artistId,TResult Function( AlbumsFilterYearEquals value)? yearEquals,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case AlbumsFilterArtistId() when artistId != null: +return artistId(_that);case AlbumsFilterYearEquals() when yearEquals != null: +return yearEquals(_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( AlbumsFilterArtistId value) artistId,required TResult Function( AlbumsFilterYearEquals value) yearEquals,}){ +final _that = this; +switch (_that) { +case AlbumsFilterArtistId(): +return artistId(_that);case AlbumsFilterYearEquals(): +return yearEquals(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( AlbumsFilterArtistId value)? artistId,TResult? Function( AlbumsFilterYearEquals value)? yearEquals,}){ +final _that = this; +switch (_that) { +case AlbumsFilterArtistId() when artistId != null: +return artistId(_that);case AlbumsFilterYearEquals() when yearEquals != null: +return yearEquals(_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( String artistId)? artistId,TResult Function( int year)? yearEquals,required TResult orElse(),}) {final _that = this; +switch (_that) { +case AlbumsFilterArtistId() when artistId != null: +return artistId(_that.artistId);case AlbumsFilterYearEquals() when yearEquals != null: +return yearEquals(_that.year);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( String artistId) artistId,required TResult Function( int year) yearEquals,}) {final _that = this; +switch (_that) { +case AlbumsFilterArtistId(): +return artistId(_that.artistId);case AlbumsFilterYearEquals(): +return yearEquals(_that.year);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( String artistId)? artistId,TResult? Function( int year)? yearEquals,}) {final _that = this; +switch (_that) { +case AlbumsFilterArtistId() when artistId != null: +return artistId(_that.artistId);case AlbumsFilterYearEquals() when yearEquals != null: +return yearEquals(_that.year);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class AlbumsFilterArtistId implements AlbumsFilter { + const AlbumsFilterArtistId(this.artistId, {final String? $type}): $type = $type ?? 'artistId'; + factory AlbumsFilterArtistId.fromJson(Map json) => _$AlbumsFilterArtistIdFromJson(json); + + final String artistId; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of AlbumsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AlbumsFilterArtistIdCopyWith get copyWith => _$AlbumsFilterArtistIdCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$AlbumsFilterArtistIdToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AlbumsFilterArtistId&&(identical(other.artistId, artistId) || other.artistId == artistId)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,artistId); + +@override +String toString() { + return 'AlbumsFilter.artistId(artistId: $artistId)'; +} + + +} + +/// @nodoc +abstract mixin class $AlbumsFilterArtistIdCopyWith<$Res> implements $AlbumsFilterCopyWith<$Res> { + factory $AlbumsFilterArtistIdCopyWith(AlbumsFilterArtistId value, $Res Function(AlbumsFilterArtistId) _then) = _$AlbumsFilterArtistIdCopyWithImpl; +@useResult +$Res call({ + String artistId +}); + + + + +} +/// @nodoc +class _$AlbumsFilterArtistIdCopyWithImpl<$Res> + implements $AlbumsFilterArtistIdCopyWith<$Res> { + _$AlbumsFilterArtistIdCopyWithImpl(this._self, this._then); + + final AlbumsFilterArtistId _self; + final $Res Function(AlbumsFilterArtistId) _then; + +/// Create a copy of AlbumsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? artistId = null,}) { + return _then(AlbumsFilterArtistId( +null == artistId ? _self.artistId : artistId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class AlbumsFilterYearEquals implements AlbumsFilter { + const AlbumsFilterYearEquals(this.year, {final String? $type}): $type = $type ?? 'yearEquals'; + factory AlbumsFilterYearEquals.fromJson(Map json) => _$AlbumsFilterYearEqualsFromJson(json); + + final int year; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of AlbumsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$AlbumsFilterYearEqualsCopyWith get copyWith => _$AlbumsFilterYearEqualsCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$AlbumsFilterYearEqualsToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is AlbumsFilterYearEquals&&(identical(other.year, year) || other.year == year)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,year); + +@override +String toString() { + return 'AlbumsFilter.yearEquals(year: $year)'; +} + + +} + +/// @nodoc +abstract mixin class $AlbumsFilterYearEqualsCopyWith<$Res> implements $AlbumsFilterCopyWith<$Res> { + factory $AlbumsFilterYearEqualsCopyWith(AlbumsFilterYearEquals value, $Res Function(AlbumsFilterYearEquals) _then) = _$AlbumsFilterYearEqualsCopyWithImpl; +@useResult +$Res call({ + int year +}); + + + + +} +/// @nodoc +class _$AlbumsFilterYearEqualsCopyWithImpl<$Res> + implements $AlbumsFilterYearEqualsCopyWith<$Res> { + _$AlbumsFilterYearEqualsCopyWithImpl(this._self, this._then); + + final AlbumsFilterYearEquals _self; + final $Res Function(AlbumsFilterYearEquals) _then; + +/// Create a copy of AlbumsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? year = null,}) { + return _then(AlbumsFilterYearEquals( +null == year ? _self.year : year // ignore: cast_nullable_to_non_nullable +as int, + )); +} + + +} + + +/// @nodoc +mixin _$ArtistsQuery { + + int get sourceId; IList get filter; IList get sort; int? get limit; int? get offset; +/// Create a copy of ArtistsQuery +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ArtistsQueryCopyWith get copyWith => _$ArtistsQueryCopyWithImpl(this as ArtistsQuery, _$identity); + + /// Serializes this ArtistsQuery to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ArtistsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'ArtistsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class $ArtistsQueryCopyWith<$Res> { + factory $ArtistsQueryCopyWith(ArtistsQuery value, $Res Function(ArtistsQuery) _then) = _$ArtistsQueryCopyWithImpl; +@useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class _$ArtistsQueryCopyWithImpl<$Res> + implements $ArtistsQueryCopyWith<$Res> { + _$ArtistsQueryCopyWithImpl(this._self, this._then); + + final ArtistsQuery _self; + final $Res Function(ArtistsQuery) _then; + +/// Create a copy of ArtistsQuery +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_self.copyWith( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [ArtistsQuery]. +extension ArtistsQueryPatterns on ArtistsQuery { +/// 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( _ArtistsQuery value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _ArtistsQuery() when $default != null: +return $default(_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(TResult Function( _ArtistsQuery value) $default,){ +final _that = this; +switch (_that) { +case _ArtistsQuery(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( _ArtistsQuery value)? $default,){ +final _that = this; +switch (_that) { +case _ArtistsQuery() when $default != null: +return $default(_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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _ArtistsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);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(TResult Function( int sourceId, IList filter, IList sort, int? limit, int? offset) $default,) {final _that = this; +switch (_that) { +case _ArtistsQuery(): +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,) {final _that = this; +switch (_that) { +case _ArtistsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _ArtistsQuery implements ArtistsQuery { + const _ArtistsQuery({required this.sourceId, this.filter = const IListConst([]), required this.sort, this.limit, this.offset}); + factory _ArtistsQuery.fromJson(Map json) => _$ArtistsQueryFromJson(json); + +@override final int sourceId; +@override@JsonKey() final IList filter; +@override final IList sort; +@override final int? limit; +@override final int? offset; + +/// Create a copy of ArtistsQuery +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$ArtistsQueryCopyWith<_ArtistsQuery> get copyWith => __$ArtistsQueryCopyWithImpl<_ArtistsQuery>(this, _$identity); + +@override +Map toJson() { + return _$ArtistsQueryToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _ArtistsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'ArtistsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class _$ArtistsQueryCopyWith<$Res> implements $ArtistsQueryCopyWith<$Res> { + factory _$ArtistsQueryCopyWith(_ArtistsQuery value, $Res Function(_ArtistsQuery) _then) = __$ArtistsQueryCopyWithImpl; +@override @useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class __$ArtistsQueryCopyWithImpl<$Res> + implements _$ArtistsQueryCopyWith<$Res> { + __$ArtistsQueryCopyWithImpl(this._self, this._then); + + final _ArtistsQuery _self; + final $Res Function(_ArtistsQuery) _then; + +/// Create a copy of ArtistsQuery +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_ArtistsQuery( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +ArtistsFilter _$ArtistsFilterFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'nameSearch': + return ArtistsFilterNameSearch.fromJson( + json + ); + case 'starred': + return ArtistsFilterStarred.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'ArtistsFilter', + 'Invalid union type "${json['runtimeType']}"!' +); + } + +} + +/// @nodoc +mixin _$ArtistsFilter { + + + + /// Serializes this ArtistsFilter to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ArtistsFilter); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'ArtistsFilter()'; +} + + +} + +/// @nodoc +class $ArtistsFilterCopyWith<$Res> { +$ArtistsFilterCopyWith(ArtistsFilter _, $Res Function(ArtistsFilter) __); +} + + +/// Adds pattern-matching-related methods to [ArtistsFilter]. +extension ArtistsFilterPatterns on ArtistsFilter { +/// 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( ArtistsFilterNameSearch value)? nameSearch,TResult Function( ArtistsFilterStarred value)? starred,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case ArtistsFilterNameSearch() when nameSearch != null: +return nameSearch(_that);case ArtistsFilterStarred() when starred != null: +return starred(_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( ArtistsFilterNameSearch value) nameSearch,required TResult Function( ArtistsFilterStarred value) starred,}){ +final _that = this; +switch (_that) { +case ArtistsFilterNameSearch(): +return nameSearch(_that);case ArtistsFilterStarred(): +return starred(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( ArtistsFilterNameSearch value)? nameSearch,TResult? Function( ArtistsFilterStarred value)? starred,}){ +final _that = this; +switch (_that) { +case ArtistsFilterNameSearch() when nameSearch != null: +return nameSearch(_that);case ArtistsFilterStarred() when starred != null: +return starred(_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( String name)? nameSearch,TResult Function( bool starred)? starred,required TResult orElse(),}) {final _that = this; +switch (_that) { +case ArtistsFilterNameSearch() when nameSearch != null: +return nameSearch(_that.name);case ArtistsFilterStarred() when starred != null: +return starred(_that.starred);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( String name) nameSearch,required TResult Function( bool starred) starred,}) {final _that = this; +switch (_that) { +case ArtistsFilterNameSearch(): +return nameSearch(_that.name);case ArtistsFilterStarred(): +return starred(_that.starred);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( String name)? nameSearch,TResult? Function( bool starred)? starred,}) {final _that = this; +switch (_that) { +case ArtistsFilterNameSearch() when nameSearch != null: +return nameSearch(_that.name);case ArtistsFilterStarred() when starred != null: +return starred(_that.starred);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class ArtistsFilterNameSearch implements ArtistsFilter { + const ArtistsFilterNameSearch(this.name, {final String? $type}): $type = $type ?? 'nameSearch'; + factory ArtistsFilterNameSearch.fromJson(Map json) => _$ArtistsFilterNameSearchFromJson(json); + + final String name; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of ArtistsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ArtistsFilterNameSearchCopyWith get copyWith => _$ArtistsFilterNameSearchCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$ArtistsFilterNameSearchToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ArtistsFilterNameSearch&&(identical(other.name, name) || other.name == name)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,name); + +@override +String toString() { + return 'ArtistsFilter.nameSearch(name: $name)'; +} + + +} + +/// @nodoc +abstract mixin class $ArtistsFilterNameSearchCopyWith<$Res> implements $ArtistsFilterCopyWith<$Res> { + factory $ArtistsFilterNameSearchCopyWith(ArtistsFilterNameSearch value, $Res Function(ArtistsFilterNameSearch) _then) = _$ArtistsFilterNameSearchCopyWithImpl; +@useResult +$Res call({ + String name +}); + + + + +} +/// @nodoc +class _$ArtistsFilterNameSearchCopyWithImpl<$Res> + implements $ArtistsFilterNameSearchCopyWith<$Res> { + _$ArtistsFilterNameSearchCopyWithImpl(this._self, this._then); + + final ArtistsFilterNameSearch _self; + final $Res Function(ArtistsFilterNameSearch) _then; + +/// Create a copy of ArtistsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? name = null,}) { + return _then(ArtistsFilterNameSearch( +null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class ArtistsFilterStarred implements ArtistsFilter { + const ArtistsFilterStarred(this.starred, {final String? $type}): $type = $type ?? 'starred'; + factory ArtistsFilterStarred.fromJson(Map json) => _$ArtistsFilterStarredFromJson(json); + + final bool starred; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of ArtistsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$ArtistsFilterStarredCopyWith get copyWith => _$ArtistsFilterStarredCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$ArtistsFilterStarredToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is ArtistsFilterStarred&&(identical(other.starred, starred) || other.starred == starred)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,starred); + +@override +String toString() { + return 'ArtistsFilter.starred(starred: $starred)'; +} + + +} + +/// @nodoc +abstract mixin class $ArtistsFilterStarredCopyWith<$Res> implements $ArtistsFilterCopyWith<$Res> { + factory $ArtistsFilterStarredCopyWith(ArtistsFilterStarred value, $Res Function(ArtistsFilterStarred) _then) = _$ArtistsFilterStarredCopyWithImpl; +@useResult +$Res call({ + bool starred +}); + + + + +} +/// @nodoc +class _$ArtistsFilterStarredCopyWithImpl<$Res> + implements $ArtistsFilterStarredCopyWith<$Res> { + _$ArtistsFilterStarredCopyWithImpl(this._self, this._then); + + final ArtistsFilterStarred _self; + final $Res Function(ArtistsFilterStarred) _then; + +/// Create a copy of ArtistsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? starred = null,}) { + return _then(ArtistsFilterStarred( +null == starred ? _self.starred : starred // ignore: cast_nullable_to_non_nullable +as bool, + )); +} + + +} + + +/// @nodoc +mixin _$SongsQuery { + + int get sourceId; IList get filter; IList get sort; int? get limit; int? get offset; +/// Create a copy of SongsQuery +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SongsQueryCopyWith get copyWith => _$SongsQueryCopyWithImpl(this as SongsQuery, _$identity); + + /// Serializes this SongsQuery to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SongsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'SongsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class $SongsQueryCopyWith<$Res> { + factory $SongsQueryCopyWith(SongsQuery value, $Res Function(SongsQuery) _then) = _$SongsQueryCopyWithImpl; +@useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class _$SongsQueryCopyWithImpl<$Res> + implements $SongsQueryCopyWith<$Res> { + _$SongsQueryCopyWithImpl(this._self, this._then); + + final SongsQuery _self; + final $Res Function(SongsQuery) _then; + +/// Create a copy of SongsQuery +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') @override $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_self.copyWith( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + +} + + +/// Adds pattern-matching-related methods to [SongsQuery]. +extension SongsQueryPatterns on SongsQuery { +/// 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( _SongsQuery value)? $default,{required TResult orElse(),}){ +final _that = this; +switch (_that) { +case _SongsQuery() when $default != null: +return $default(_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(TResult Function( _SongsQuery value) $default,){ +final _that = this; +switch (_that) { +case _SongsQuery(): +return $default(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( _SongsQuery value)? $default,){ +final _that = this; +switch (_that) { +case _SongsQuery() when $default != null: +return $default(_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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,{required TResult orElse(),}) {final _that = this; +switch (_that) { +case _SongsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);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(TResult Function( int sourceId, IList filter, IList sort, int? limit, int? offset) $default,) {final _that = this; +switch (_that) { +case _SongsQuery(): +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( int sourceId, IList filter, IList sort, int? limit, int? offset)? $default,) {final _that = this; +switch (_that) { +case _SongsQuery() when $default != null: +return $default(_that.sourceId,_that.filter,_that.sort,_that.limit,_that.offset);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class _SongsQuery implements SongsQuery { + const _SongsQuery({required this.sourceId, this.filter = const IListConst([]), required this.sort, this.limit, this.offset}); + factory _SongsQuery.fromJson(Map json) => _$SongsQueryFromJson(json); + +@override final int sourceId; +@override@JsonKey() final IList filter; +@override final IList sort; +@override final int? limit; +@override final int? offset; + +/// Create a copy of SongsQuery +/// with the given fields replaced by the non-null parameter values. +@override @JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +_$SongsQueryCopyWith<_SongsQuery> get copyWith => __$SongsQueryCopyWithImpl<_SongsQuery>(this, _$identity); + +@override +Map toJson() { + return _$SongsQueryToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is _SongsQuery&&(identical(other.sourceId, sourceId) || other.sourceId == sourceId)&&const DeepCollectionEquality().equals(other.filter, filter)&&const DeepCollectionEquality().equals(other.sort, sort)&&(identical(other.limit, limit) || other.limit == limit)&&(identical(other.offset, offset) || other.offset == offset)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,sourceId,const DeepCollectionEquality().hash(filter),const DeepCollectionEquality().hash(sort),limit,offset); + +@override +String toString() { + return 'SongsQuery(sourceId: $sourceId, filter: $filter, sort: $sort, limit: $limit, offset: $offset)'; +} + + +} + +/// @nodoc +abstract mixin class _$SongsQueryCopyWith<$Res> implements $SongsQueryCopyWith<$Res> { + factory _$SongsQueryCopyWith(_SongsQuery value, $Res Function(_SongsQuery) _then) = __$SongsQueryCopyWithImpl; +@override @useResult +$Res call({ + int sourceId, IList filter, IList sort, int? limit, int? offset +}); + + + + +} +/// @nodoc +class __$SongsQueryCopyWithImpl<$Res> + implements _$SongsQueryCopyWith<$Res> { + __$SongsQueryCopyWithImpl(this._self, this._then); + + final _SongsQuery _self; + final $Res Function(_SongsQuery) _then; + +/// Create a copy of SongsQuery +/// with the given fields replaced by the non-null parameter values. +@override @pragma('vm:prefer-inline') $Res call({Object? sourceId = null,Object? filter = null,Object? sort = null,Object? limit = freezed,Object? offset = freezed,}) { + return _then(_SongsQuery( +sourceId: null == sourceId ? _self.sourceId : sourceId // ignore: cast_nullable_to_non_nullable +as int,filter: null == filter ? _self.filter : filter // ignore: cast_nullable_to_non_nullable +as IList,sort: null == sort ? _self.sort : sort // ignore: cast_nullable_to_non_nullable +as IList,limit: freezed == limit ? _self.limit : limit // ignore: cast_nullable_to_non_nullable +as int?,offset: freezed == offset ? _self.offset : offset // ignore: cast_nullable_to_non_nullable +as int?, + )); +} + + +} + +SongsFilter _$SongsFilterFromJson( + Map json +) { + switch (json['runtimeType']) { + case 'albumId': + return SongsFilterAlbumId.fromJson( + json + ); + case 'playlistId': + return SongsFilterPlaylistId.fromJson( + json + ); + + default: + throw CheckedFromJsonException( + json, + 'runtimeType', + 'SongsFilter', + 'Invalid union type "${json['runtimeType']}"!' +); + } + +} + +/// @nodoc +mixin _$SongsFilter { + + + + /// Serializes this SongsFilter to a JSON map. + Map toJson(); + + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SongsFilter); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => runtimeType.hashCode; + +@override +String toString() { + return 'SongsFilter()'; +} + + +} + +/// @nodoc +class $SongsFilterCopyWith<$Res> { +$SongsFilterCopyWith(SongsFilter _, $Res Function(SongsFilter) __); +} + + +/// Adds pattern-matching-related methods to [SongsFilter]. +extension SongsFilterPatterns on SongsFilter { +/// 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( SongsFilterAlbumId value)? albumId,TResult Function( SongsFilterPlaylistId value)? playlistId,required TResult orElse(),}){ +final _that = this; +switch (_that) { +case SongsFilterAlbumId() when albumId != null: +return albumId(_that);case SongsFilterPlaylistId() when playlistId != null: +return playlistId(_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( SongsFilterAlbumId value) albumId,required TResult Function( SongsFilterPlaylistId value) playlistId,}){ +final _that = this; +switch (_that) { +case SongsFilterAlbumId(): +return albumId(_that);case SongsFilterPlaylistId(): +return playlistId(_that);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( SongsFilterAlbumId value)? albumId,TResult? Function( SongsFilterPlaylistId value)? playlistId,}){ +final _that = this; +switch (_that) { +case SongsFilterAlbumId() when albumId != null: +return albumId(_that);case SongsFilterPlaylistId() when playlistId != null: +return playlistId(_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( String albumId)? albumId,TResult Function( String playlistId)? playlistId,required TResult orElse(),}) {final _that = this; +switch (_that) { +case SongsFilterAlbumId() when albumId != null: +return albumId(_that.albumId);case SongsFilterPlaylistId() when playlistId != null: +return playlistId(_that.playlistId);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( String albumId) albumId,required TResult Function( String playlistId) playlistId,}) {final _that = this; +switch (_that) { +case SongsFilterAlbumId(): +return albumId(_that.albumId);case SongsFilterPlaylistId(): +return playlistId(_that.playlistId);case _: + throw StateError('Unexpected subclass'); + +} +} +/// 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( String albumId)? albumId,TResult? Function( String playlistId)? playlistId,}) {final _that = this; +switch (_that) { +case SongsFilterAlbumId() when albumId != null: +return albumId(_that.albumId);case SongsFilterPlaylistId() when playlistId != null: +return playlistId(_that.playlistId);case _: + return null; + +} +} + +} + +/// @nodoc +@JsonSerializable() + +class SongsFilterAlbumId implements SongsFilter { + const SongsFilterAlbumId(this.albumId, {final String? $type}): $type = $type ?? 'albumId'; + factory SongsFilterAlbumId.fromJson(Map json) => _$SongsFilterAlbumIdFromJson(json); + + final String albumId; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SongsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SongsFilterAlbumIdCopyWith get copyWith => _$SongsFilterAlbumIdCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$SongsFilterAlbumIdToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SongsFilterAlbumId&&(identical(other.albumId, albumId) || other.albumId == albumId)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,albumId); + +@override +String toString() { + return 'SongsFilter.albumId(albumId: $albumId)'; +} + + +} + +/// @nodoc +abstract mixin class $SongsFilterAlbumIdCopyWith<$Res> implements $SongsFilterCopyWith<$Res> { + factory $SongsFilterAlbumIdCopyWith(SongsFilterAlbumId value, $Res Function(SongsFilterAlbumId) _then) = _$SongsFilterAlbumIdCopyWithImpl; +@useResult +$Res call({ + String albumId +}); + + + + +} +/// @nodoc +class _$SongsFilterAlbumIdCopyWithImpl<$Res> + implements $SongsFilterAlbumIdCopyWith<$Res> { + _$SongsFilterAlbumIdCopyWithImpl(this._self, this._then); + + final SongsFilterAlbumId _self; + final $Res Function(SongsFilterAlbumId) _then; + +/// Create a copy of SongsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? albumId = null,}) { + return _then(SongsFilterAlbumId( +null == albumId ? _self.albumId : albumId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +/// @nodoc +@JsonSerializable() + +class SongsFilterPlaylistId implements SongsFilter { + const SongsFilterPlaylistId(this.playlistId, {final String? $type}): $type = $type ?? 'playlistId'; + factory SongsFilterPlaylistId.fromJson(Map json) => _$SongsFilterPlaylistIdFromJson(json); + + final String playlistId; + +@JsonKey(name: 'runtimeType') +final String $type; + + +/// Create a copy of SongsFilter +/// with the given fields replaced by the non-null parameter values. +@JsonKey(includeFromJson: false, includeToJson: false) +@pragma('vm:prefer-inline') +$SongsFilterPlaylistIdCopyWith get copyWith => _$SongsFilterPlaylistIdCopyWithImpl(this, _$identity); + +@override +Map toJson() { + return _$SongsFilterPlaylistIdToJson(this, ); +} + +@override +bool operator ==(Object other) { + return identical(this, other) || (other.runtimeType == runtimeType&&other is SongsFilterPlaylistId&&(identical(other.playlistId, playlistId) || other.playlistId == playlistId)); +} + +@JsonKey(includeFromJson: false, includeToJson: false) +@override +int get hashCode => Object.hash(runtimeType,playlistId); + +@override +String toString() { + return 'SongsFilter.playlistId(playlistId: $playlistId)'; +} + + +} + +/// @nodoc +abstract mixin class $SongsFilterPlaylistIdCopyWith<$Res> implements $SongsFilterCopyWith<$Res> { + factory $SongsFilterPlaylistIdCopyWith(SongsFilterPlaylistId value, $Res Function(SongsFilterPlaylistId) _then) = _$SongsFilterPlaylistIdCopyWithImpl; +@useResult +$Res call({ + String playlistId +}); + + + + +} +/// @nodoc +class _$SongsFilterPlaylistIdCopyWithImpl<$Res> + implements $SongsFilterPlaylistIdCopyWith<$Res> { + _$SongsFilterPlaylistIdCopyWithImpl(this._self, this._then); + + final SongsFilterPlaylistId _self; + final $Res Function(SongsFilterPlaylistId) _then; + +/// Create a copy of SongsFilter +/// with the given fields replaced by the non-null parameter values. +@pragma('vm:prefer-inline') $Res call({Object? playlistId = null,}) { + return _then(SongsFilterPlaylistId( +null == playlistId ? _self.playlistId : playlistId // ignore: cast_nullable_to_non_nullable +as String, + )); +} + + +} + +// dart format on diff --git a/lib/database/query.g.dart b/lib/database/query.g.dart new file mode 100644 index 0000000..4900a81 --- /dev/null +++ b/lib/database/query.g.dart @@ -0,0 +1,226 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'query.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +AlbumsSortingTerm _$AlbumsSortingTermFromJson(Map json) => + AlbumsSortingTerm( + dir: $enumDecode(_$SortDirectionEnumMap, json['dir']), + by: $enumDecode(_$AlbumsColumnEnumMap, json['by']), + $type: json['runtimeType'] as String?, + ); + +Map _$AlbumsSortingTermToJson(AlbumsSortingTerm instance) => + { + 'dir': _$SortDirectionEnumMap[instance.dir]!, + 'by': _$AlbumsColumnEnumMap[instance.by]!, + 'runtimeType': instance.$type, + }; + +const _$SortDirectionEnumMap = { + SortDirection.asc: 'asc', + SortDirection.desc: 'desc', +}; + +const _$AlbumsColumnEnumMap = { + AlbumsColumn.name: 'name', + AlbumsColumn.created: 'created', + AlbumsColumn.year: 'year', + AlbumsColumn.starred: 'starred', +}; + +ArtistsSortingTerm _$ArtistsSortingTermFromJson(Map json) => + ArtistsSortingTerm( + dir: $enumDecode(_$SortDirectionEnumMap, json['dir']), + by: $enumDecode(_$ArtistsColumnEnumMap, json['by']), + $type: json['runtimeType'] as String?, + ); + +Map _$ArtistsSortingTermToJson(ArtistsSortingTerm instance) => + { + 'dir': _$SortDirectionEnumMap[instance.dir]!, + 'by': _$ArtistsColumnEnumMap[instance.by]!, + 'runtimeType': instance.$type, + }; + +const _$ArtistsColumnEnumMap = { + ArtistsColumn.name: 'name', + ArtistsColumn.starred: 'starred', + ArtistsColumn.albumCount: 'albumCount', +}; + +SongsSortingTerm _$SongsSortingTermFromJson(Map json) => + SongsSortingTerm( + dir: $enumDecode(_$SortDirectionEnumMap, json['dir']), + by: $enumDecode(_$SongsColumnEnumMap, json['by']), + $type: json['runtimeType'] as String?, + ); + +Map _$SongsSortingTermToJson(SongsSortingTerm instance) => + { + 'dir': _$SortDirectionEnumMap[instance.dir]!, + 'by': _$SongsColumnEnumMap[instance.by]!, + 'runtimeType': instance.$type, + }; + +const _$SongsColumnEnumMap = { + SongsColumn.title: 'title', + SongsColumn.starred: 'starred', + SongsColumn.disc: 'disc', + SongsColumn.track: 'track', +}; + +_AlbumsQuery _$AlbumsQueryFromJson(Map json) => _AlbumsQuery( + sourceId: (json['sourceId'] as num).toInt(), + filter: json['filter'] == null + ? const IListConst([]) + : IList.fromJson( + json['filter'], + (value) => AlbumsFilter.fromJson(value as Map), + ), + sort: IList.fromJson( + json['sort'], + (value) => AlbumsSortingTerm.fromJson(value as Map), + ), + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), +); + +Map _$AlbumsQueryToJson(_AlbumsQuery instance) => + { + 'sourceId': instance.sourceId, + 'filter': instance.filter.toJson((value) => value), + 'sort': instance.sort.toJson((value) => value), + 'limit': instance.limit, + 'offset': instance.offset, + }; + +AlbumsFilterArtistId _$AlbumsFilterArtistIdFromJson( + Map json, +) => AlbumsFilterArtistId( + json['artistId'] as String, + $type: json['runtimeType'] as String?, +); + +Map _$AlbumsFilterArtistIdToJson( + AlbumsFilterArtistId instance, +) => { + 'artistId': instance.artistId, + 'runtimeType': instance.$type, +}; + +AlbumsFilterYearEquals _$AlbumsFilterYearEqualsFromJson( + Map json, +) => AlbumsFilterYearEquals( + (json['year'] as num).toInt(), + $type: json['runtimeType'] as String?, +); + +Map _$AlbumsFilterYearEqualsToJson( + AlbumsFilterYearEquals instance, +) => {'year': instance.year, 'runtimeType': instance.$type}; + +_ArtistsQuery _$ArtistsQueryFromJson(Map json) => + _ArtistsQuery( + sourceId: (json['sourceId'] as num).toInt(), + filter: json['filter'] == null + ? const IListConst([]) + : IList.fromJson( + json['filter'], + (value) => ArtistsFilter.fromJson(value as Map), + ), + sort: IList.fromJson( + json['sort'], + (value) => ArtistsSortingTerm.fromJson(value as Map), + ), + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), + ); + +Map _$ArtistsQueryToJson(_ArtistsQuery instance) => + { + 'sourceId': instance.sourceId, + 'filter': instance.filter.toJson((value) => value), + 'sort': instance.sort.toJson((value) => value), + 'limit': instance.limit, + 'offset': instance.offset, + }; + +ArtistsFilterNameSearch _$ArtistsFilterNameSearchFromJson( + Map json, +) => ArtistsFilterNameSearch( + json['name'] as String, + $type: json['runtimeType'] as String?, +); + +Map _$ArtistsFilterNameSearchToJson( + ArtistsFilterNameSearch instance, +) => {'name': instance.name, 'runtimeType': instance.$type}; + +ArtistsFilterStarred _$ArtistsFilterStarredFromJson( + Map json, +) => ArtistsFilterStarred( + json['starred'] as bool, + $type: json['runtimeType'] as String?, +); + +Map _$ArtistsFilterStarredToJson( + ArtistsFilterStarred instance, +) => { + 'starred': instance.starred, + 'runtimeType': instance.$type, +}; + +_SongsQuery _$SongsQueryFromJson(Map json) => _SongsQuery( + sourceId: (json['sourceId'] as num).toInt(), + filter: json['filter'] == null + ? const IListConst([]) + : IList.fromJson( + json['filter'], + (value) => SongsFilter.fromJson(value as Map), + ), + sort: IList.fromJson( + json['sort'], + (value) => SongsSortingTerm.fromJson(value as Map), + ), + limit: (json['limit'] as num?)?.toInt(), + offset: (json['offset'] as num?)?.toInt(), +); + +Map _$SongsQueryToJson(_SongsQuery instance) => + { + 'sourceId': instance.sourceId, + 'filter': instance.filter.toJson((value) => value), + 'sort': instance.sort.toJson((value) => value), + 'limit': instance.limit, + 'offset': instance.offset, + }; + +SongsFilterAlbumId _$SongsFilterAlbumIdFromJson(Map json) => + SongsFilterAlbumId( + json['albumId'] as String, + $type: json['runtimeType'] as String?, + ); + +Map _$SongsFilterAlbumIdToJson(SongsFilterAlbumId instance) => + { + 'albumId': instance.albumId, + 'runtimeType': instance.$type, + }; + +SongsFilterPlaylistId _$SongsFilterPlaylistIdFromJson( + Map json, +) => SongsFilterPlaylistId( + json['playlistId'] as String, + $type: json['runtimeType'] as String?, +); + +Map _$SongsFilterPlaylistIdToJson( + SongsFilterPlaylistId instance, +) => { + 'playlistId': instance.playlistId, + 'runtimeType': instance.$type, +}; diff --git a/pubspec.lock b/pubspec.lock index 2c9c22f..00bd8d6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -843,7 +843,7 @@ packages: source: sdk version: "0.0.0" sliver_tools: - dependency: transitive + dependency: "direct main" description: name: sliver_tools sha256: eae28220badfb9d0559207badcbbc9ad5331aac829a88cb0964d330d2a4636a6 diff --git a/pubspec.yaml b/pubspec.yaml index 1e3d5e0..81551b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: path: ^1.9.1 path_provider: ^2.1.5 pool: ^1.5.2 + sliver_tools: ^0.2.12 url_launcher: ^6.3.2 xml: ^6.6.1