content: // Package imports:
  import 'package:booru_clients/hydrus.dart';
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  
  // Project imports:
  import '../../core/boorus/defaults/types.dart';
  import '../../core/configs/config.dart';
  import '../../core/configs/create/create.dart';
  import '../../core/downloads/filename/types.dart';
  import '../../core/http/providers.dart';
  import '../../core/posts/details/details.dart';
  import '../../core/posts/details/providers.dart';
  import '../../core/posts/favorites/types.dart';
  import '../../core/posts/post/post.dart';
  import '../../core/posts/post/providers.dart';
  import '../../core/tags/autocompletes/types.dart';
  import 'client_provider.dart';
  import 'favorites/providers.dart';
  import 'posts/providers.dart';
  import 'tags/providers.dart';
  
  class HydrusRepository extends BooruRepositoryDefault {
    const HydrusRepository({required this.ref});
  
    @override
    final Ref ref;
  
    @override
    PostRepository<Post> post(BooruConfigSearch config) {
      return ref.read(hydrusPostRepoProvider(config));
    }
  
    @override
    AutocompleteRepository autocomplete(BooruConfigAuth config) {
      return ref.read(hydrusAutocompleteRepoProvider(config));
    }
  
    @override
    FavoriteRepository favorite(BooruConfigAuth config) {
      return ref.watch(hydrusFavoriteRepoProvider(config));
    }
  
    @override
    BooruSiteValidator? siteValidator(BooruConfigAuth config) {
      final dio = ref.watch(defaultDioProvider(config));
  
      return () => HydrusClient(
        baseUrl: config.url,
        apiKey: config.apiKey ?? '',
        dio: dio,
      ).getFiles().then((value) => true);
    }
  
    @override
    PostLinkGenerator postLinkGenerator(BooruConfigAuth config) {
      return const NoLinkPostLinkGenerator();
    }
  
    @override
    DownloadFilenameGenerator<Post> downloadFilenameBuilder(
      BooruConfigAuth config,
    ) {
      return DownloadFileNameBuilder<Post>(
        defaultFileNameFormat: kDefaultCustomDownloadFileNameFormat,
        defaultBulkDownloadFileNameFormat: kDefaultCustomDownloadFileNameFormat,
        sampleData: kDanbooruPostSamples,
        tokenHandlers: [
          WidthTokenHandler(),
          HeightTokenHandler(),
          AspectRatioTokenHandler(),
        ],
      );
    }
  
    @override
    Map<String, String> extraHttpHeaders(BooruConfigAuth config) {
      return {
        ...ref.watch(hydrusClientProvider(config)).apiKeyHeader,
      };
    }
  
    @override
    MediaUrlResolver mediaUrlResolver(BooruConfigAuth config) {
      return ref.watch(sampleMediaUrlResolverProvider(config));
    }
  }
  