package com.isidroid.c23.di

import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceManager
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import com.isidroid.c23.data.source.network.AuthInterceptor
import com.isidroid.c23.data.source.network.CacheControlInterceptor
import com.isidroid.c23.ext.isDebug
import com.isidroid.core.DiMock
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import com.isidroid.c23.ext.isMock
import com.isidroid.c23.utils.DateDeserializer
import com.isidroid.core.DiDebuggableBuild
import com.isidroid.network.ApiCacheControlInterceptor
import com.isidroid.network.ApiServerUrl
import com.isidroid.network.ApiTokenInterceptor
import com.isidroid.session.repository.SessionRepository
import okhttp3.Interceptor
import java.util.Date
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
object AppModule {
    @Provides @Singleton @DiMock
    fun provideIsMock(): Boolean = isMock()

    @Provides @Singleton @DiDebuggableBuild
    fun provideIsDebuggableBuild(): Boolean = isMock() || isDebug()

    @Provides @Singleton
    fun providePreferences(@ApplicationContext context: Context): SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
}