import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lunchpick/data/repositories/restaurant_repository_impl.dart';
import 'package:lunchpick/data/repositories/visit_repository_impl.dart';
import 'package:lunchpick/data/repositories/settings_repository_impl.dart';
import 'package:lunchpick/data/repositories/weather_repository_impl.dart';
import 'package:lunchpick/data/repositories/recommendation_repository_impl.dart';
import 'package:lunchpick/data/datasources/remote/naver_url_processor.dart';
import 'package:lunchpick/data/datasources/remote/naver_map_parser.dart';
import 'package:lunchpick/data/api/naver_api_client.dart';
import 'package:lunchpick/domain/repositories/restaurant_repository.dart';
import 'package:lunchpick/domain/repositories/visit_repository.dart';
import 'package:lunchpick/domain/repositories/settings_repository.dart';
import 'package:lunchpick/domain/repositories/weather_repository.dart';
import 'package:lunchpick/domain/repositories/recommendation_repository.dart';
import 'package:lunchpick/core/services/geocoding_service.dart';

/// RestaurantRepository Provider
final restaurantRepositoryProvider = Provider<RestaurantRepository>((ref) {
  return RestaurantRepositoryImpl();
});

/// VisitRepository Provider
final visitRepositoryProvider = Provider<VisitRepository>((ref) {
  return VisitRepositoryImpl();
});

/// SettingsRepository Provider
final settingsRepositoryProvider = Provider<SettingsRepository>((ref) {
  return SettingsRepositoryImpl();
});

/// WeatherRepository Provider
final weatherRepositoryProvider = Provider<WeatherRepository>((ref) {
  return WeatherRepositoryImpl();
});

/// RecommendationRepository Provider
final recommendationRepositoryProvider = Provider<RecommendationRepository>((
  ref,
) {
  return RecommendationRepositoryImpl();
});

/// NaverApiClient Provider
final naverApiClientProvider = Provider<NaverApiClient>((ref) {
  return NaverApiClient();
});

/// NaverMapParser Provider
final naverMapParserProvider = Provider<NaverMapParser>((ref) {
  final apiClient = ref.watch(naverApiClientProvider);
  return NaverMapParser(apiClient: apiClient);
});

/// NaverUrlProcessor Provider
final naverUrlProcessorProvider = Provider<NaverUrlProcessor>((ref) {
  final apiClient = ref.watch(naverApiClientProvider);
  final parser = ref.watch(naverMapParserProvider);
  return NaverUrlProcessor(apiClient: apiClient, mapParser: parser);
});

/// GeocodingService Provider
final geocodingServiceProvider = Provider<GeocodingService>((ref) {
  return GeocodingService();
});
