package ru.fincode.tsudesk.core.network.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import ru.fincode.tsudesk.core.common.app.AppConfig
import ru.fincode.tsudesk.core.network.RetrofitFactory
import javax.inject.Singleton

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

    @Provides
    @Singleton
    fun provideRetrofit(
        factory: RetrofitFactory,
        client: OkHttpClient,
        appConfig: AppConfig
    ): Retrofit =
        factory.create(
            baseUrl = appConfig.baseUrl,
            client = client
        )
}
