package com.fastest.pass.di

import com.fastest.pass.splash.data.repository.SplashRepositoryImpl
import com.fastest.pass.splash.data.remote.SplashApiService
import com.fastest.pass.splash.domain.repository.SplashRepository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Singleton

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

    @Singleton
    @Provides
    fun provideApiService(): SplashApiService {
        return Retrofit.Builder()
            .baseUrl("https://testing.com")
            .addConverterFactory(GsonConverterFactory.create())
            .build()
            .create(SplashApiService::class.java)
    }

    @Singleton
    @Provides
    fun provideSplashRepository(splashApiService: SplashApiService): SplashRepository {
        return SplashRepositoryImpl(splashApiService)
    }
}