package com.demotest.app.repositories

import androidx.lifecycle.LiveData
import androidx.lifecycle.liveData
import com.demotest.app.app.network.Resource
import com.demotest.app.data.remote.RemoteDataSource

import com.demotest.app.model.ExchangeTestRequest
import com.demotest.app.model.ExchangeTestResponse
import kotlinx.coroutines.Dispatchers

class APIRepository(
    private val remoteDataSource: RemoteDataSource,
) {


    fun testConnection(request: ExchangeTestRequest): LiveData<Resource<ExchangeTestResponse>> =
        liveData(Dispatchers.IO) {
            emit(Resource.loading(null))
            val response = remoteDataSource.testConnection(request)
            emit(response)
        }

}
