export default (configuration) => {
    return `
  package ${configuration.packageName}.network
  
  import android.app.Application
  import ${configuration.packageName}.extensions.BaseLiveData
  import ${configuration.packageName}.extensions.Constants
  import ${configuration.packageName}.extensions.Constants.AUTH_TOKEN
  import com.google.gson.GsonBuilder
  import ${configuration.packageName}.network.ApiService
  import kotlinx.coroutines.runBlocking
  import okhttp3.Authenticator
  import okhttp3.Cache
  import okhttp3.Interceptor
  import okhttp3.OkHttpClient
  import okhttp3.Request
  import okhttp3.Response
  import okhttp3.Route
  import okhttp3.logging.HttpLoggingInterceptor
  import org.koin.dsl.module
  import retrofit2.Retrofit
  import retrofit2.converter.gson.GsonConverterFactory
  import java.util.concurrent.TimeUnit
  
  
  fun provideRetrofit(application: Application): Retrofit {
    val interceptor = HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)
  
    val cacheSize: Long = 10 * 1024 * 1024 // 10 MiB
    val cache = Cache(application.cacheDir, cacheSize)
  
    val okHttpClient = OkHttpClient().newBuilder()
        .cache(cache)
        .callTimeout(1, TimeUnit.MINUTES)
        .writeTimeout(1, TimeUnit.MINUTES)
        .readTimeout(1, TimeUnit.MINUTES)
        .addInterceptor(interceptor)
        .addInterceptor(Interceptor { chain ->
            val request: Request =
                chain.request().newBuilder()
                    .addHeader("Content-Type", Constants.CONTENT_TYPE)
                    .addHeader("x-project", ${configuration.name}.BuildConfig.PROJECT_ID)
                    .addHeader("Authorization", AUTH_TOKEN.value ?: "")
                    .build()
            val response = chain.proceed(request)
            if (response.code == 401) {
                Constants.isAuthorized.postValue(false)
            }
            response
        })
        .build()
    val gson = GsonBuilder()
        .serializeNulls()
        .create()
    return Retrofit.Builder().baseUrl(${configuration.name}.BuildConfig.BASE_URL)
        .client(okHttpClient)
        .addConverterFactory(GsonConverterFactory.create(gson))
        .build()
  }
  
  fun provideApi(retrofit: Retrofit): ApiService = retrofit.create(ApiService::class.java)
  
  
    `;
  };
  
  
  
  
  
  
  
  
    
  