package com.syaroful.agrilinkvocpro.control_feature.di

import com.syaroful.agrilinkvocpro.control_feature.data.network.ControlService
import okhttp3.OkHttpClient
import org.koin.dsl.module
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit

val networkModule = module {

    single {
        OkHttpClient.Builder()
            .connectTimeout(3, TimeUnit.SECONDS)
            .build()
    }

    single {
        Retrofit.Builder()
            .baseUrl("http://labai.polinema.ac.id:3042/")
            .client(get())
            .addConverterFactory(GsonConverterFactory.create())
            .build()
    }

    single<ControlService> { get<Retrofit>().create(ControlService::class.java) }
}