package ru.fincode.tsudesk.di

import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import ru.fincode.tsudesk.BuildConfig
import ru.fincode.tsudesk.core.common.app.AppConfig
import javax.inject.Singleton

private const val BASE_TIMEOUT = 30L

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

    private const val BASE_URL_PROD = "https://tulsu.ru/"
    private const val BASE_URL_DEVELOP = "https://scherbatykh.ru/app/tsudesk/"

    @Provides
    @Singleton
    fun provideAppConfig(): AppConfig {
        val baseUrl = if (BuildConfig.DEBUG) BASE_URL_PROD else BASE_URL_PROD
        return AppConfig(
            isDebug = BuildConfig.DEBUG,
            baseUrl = baseUrl,
            networkTimeoutSec = BASE_TIMEOUT
        )
    }
}
