package eu.gaudian.translator.di

import android.app.Application
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import eu.gaudian.translator.model.communication.ApiManager
import eu.gaudian.translator.model.repository.ApiLogRepository
import eu.gaudian.translator.model.repository.ApiRepository
import eu.gaudian.translator.model.repository.DictionaryFileRepository
import eu.gaudian.translator.model.repository.DictionaryLookupRepository
import eu.gaudian.translator.model.repository.DictionaryRepository
import eu.gaudian.translator.model.repository.ExerciseRepository
import eu.gaudian.translator.model.repository.LanguageConfigRepository
import eu.gaudian.translator.model.repository.LanguageRepository
import eu.gaudian.translator.model.repository.SettingsRepository
import eu.gaudian.translator.model.repository.VocabularyRepository
import eu.gaudian.translator.utils.CorrectionService
import eu.gaudian.translator.utils.ExerciseService
import eu.gaudian.translator.utils.StatusMessageService
import eu.gaudian.translator.utils.TranslationService
import eu.gaudian.translator.utils.VocabularyService
import eu.gaudian.translator.utils.YouTubeApiService
import eu.gaudian.translator.utils.YouTubeExerciseService
import eu.gaudian.translator.utils.dictionary.DictionaryService
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object RepositoryModule {

    @Provides
    @Singleton
    fun provideApiRepository(application: Application): ApiRepository {
        return ApiRepository(application)
    }

    @Provides
    @Singleton
    fun provideSettingsRepository(application: Application): SettingsRepository {
        return SettingsRepository(application)
    }

    @Provides
    @Singleton
    fun provideApiManager(application: Application): ApiManager {
        return ApiManager(application)
    }

    @Provides
    @Singleton
    fun provideApiLogRepository(application: Application): ApiLogRepository {
        return ApiLogRepository(application)
    }

    @Provides
    @Singleton
    fun provideDictionaryRepository(application: Application): DictionaryRepository {
        return DictionaryRepository(application)
    }

    @Provides
    @Singleton
    fun provideLanguageRepository(application: Application): LanguageRepository {
        return LanguageRepository(application)
    }

    @Provides
    @Singleton
    fun provideLanguageConfigRepository(application: Application): LanguageConfigRepository {
        return LanguageConfigRepository(application)
    }

    @Provides
    @Singleton
    fun provideDictionaryFileRepository(application: Application): DictionaryFileRepository {
        return DictionaryFileRepository(application)
    }

    @Provides
    @Singleton
    fun provideDictionaryLookupRepository(application: Application): DictionaryLookupRepository {
        return DictionaryLookupRepository(application)
    }

    @Provides
    @Singleton
    fun provideDictionaryService(application: Application): DictionaryService {
        return DictionaryService(application)
    }

    @Provides
    @Singleton
    fun provideVocabularyRepository(application: Application): VocabularyRepository {
        return VocabularyRepository.getInstance(application)
    }

    @Provides
    @Singleton
    fun provideStatusMessageService(): StatusMessageService {
        return StatusMessageService
    }

    @Provides
    @Singleton
    fun provideVocabularyService(application: Application): VocabularyService {
        return VocabularyService(application)
    }

    @Provides
    @Singleton
    fun provideExerciseRepository(application: Application): ExerciseRepository {
        return ExerciseRepository(application)
    }

    @Provides
    @Singleton
    fun provideExerciseService(application: Application): ExerciseService {
        return ExerciseService(application)
    }

    @Provides
    @Singleton
    fun provideTranslationService(application: Application): TranslationService {
        return TranslationService(application)
    }

    @Provides
    @Singleton
    fun provideCorrectionService(application: Application): CorrectionService {
        return CorrectionService(application)
    }

    @Provides
    @Singleton
    fun provideYouTubeApiService(): YouTubeApiService {
        return YouTubeApiService
    }

    @Provides
    @Singleton
    fun provideYouTubeExerciseService(): YouTubeExerciseService {
        return YouTubeExerciseService
    }
}
