import 'dart:async';
import 'dart:io';

import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:path_provider/path_provider.dart';

import '../core/contracts/cancellation.dart';
import '../core/contracts/library.dart';
import '../core/contracts/script_widget.dart';
import '../core/contracts/tmdb.dart';
import '../core/contracts/trakt/trakt_playback_entry.dart';
import '../core/domain/ports/authed_trakt_gateway.dart';
import '../core/domain/ports/danmaku_gateway.dart';
import '../core/domain/ports/danmaku_sources_store.dart';
import '../core/domain/ports/emby_gateway.dart';
import '../core/domain/ports/server_repository.dart';
import '../core/domain/ports/server_sync_gateway.dart';
import '../core/domain/ports/session_repository.dart';
import '../core/domain/ports/script_widget_remote_gateway.dart';
import '../core/domain/ports/script_widget_repository.dart';
import '../core/domain/ports/script_widget_runtime.dart';
import '../core/domain/ports/tmdb_gateway.dart';
import '../core/domain/ports/trakt_gateway.dart';
import '../core/domain/usecases/auth_usecases.dart';
import '../core/domain/usecases/backup_usecases.dart';
import '../core/domain/usecases/server_sync_usecases.dart';
import '../core/domain/usecases/library_usecases.dart';
import '../core/domain/usecases/media_usecases.dart';
import '../core/domain/usecases/series_resume_target.dart';
import '../core/domain/usecases/server_usecases.dart';
import '../core/domain/usecases/script_widget/script_widget_service.dart';
import '../core/domain/usecases/usecase_helpers.dart';
import '../core/infra/danmaku_api/dispatching_danmaku_gateway.dart';
import '../core/infra/danmaku_api/danmaku_client.dart';
import '../core/infra/danmaku_api/script_widget_danmaku_gateway.dart';
import '../core/infra/emby_api/emby_api_client.dart';
import '../core/infra/emby_api/emby_headers.dart';
import '../core/infra/emby_api/playback_resolver.dart';
import '../core/infra/storage/device_id_store.dart';
import '../core/infra/storage/discover_page_cache_store.dart';
import '../core/infra/storage/home_page_cache_store.dart';
import '../core/infra/server_sync_api/server_sync_client.dart';
import '../core/infra/storage/json_server_repository.dart';
import '../core/infra/storage/json_session_repository.dart';
import '../core/infra/storage/json_script_widget_repository.dart';
import '../core/infra/storage/prefs_danmaku_sources_store.dart';
import '../core/infra/storage/search_history_store.dart';
import '../core/infra/script_widget/quickjs_widget_runtime.dart';
import '../core/infra/script_widget/script_widget_remote_client.dart';
import '../core/infra/tmdb_api/tmdb_client.dart';
import '../core/infra/trakt_api/authed_trakt_client.dart';
import '../core/infra/trakt_api/trakt_auth.dart';
import '../core/infra/trakt_api/trakt_client.dart';
import '../core/infra/trakt_api/trakt_pending_sync_queue.dart';
import '../core/infra/trakt_api/trakt_retry_policy.dart';
import '../core/infra/trakt_api/trakt_sync_service.dart';
import '../core/infra/trakt_api/trakt_token_store.dart';
import '../features/discover/trakt_continue_watching_item.dart';
import '../shared/mappers/tmdb_image_url.dart';
import '../shared/utils/app_logger.dart';
import '../shared/utils/platform_device_name.dart';
import '../shared/utils/time_bucket.dart';
import 'danmaku_settings_provider.dart';
import 'sm_account_provider.dart';
import 'tmdb_settings_provider.dart';

part 'di/di_core_stores.dart';
part 'di/di_detail_data.dart';
part 'di/di_emby_usecases.dart';
part 'di/di_script_widget.dart';
part 'di/di_tmdb.dart';
part 'di/di_trakt.dart';
