package es.verdnatura.presentation.view.feature.paletizador.fragment

import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.SalixCallback
import es.verdnatura.presentation.base.BaseViewModel
import retrofit2.Response

class ExpeditionScanSorterViewModel(val context: Context) : BaseViewModel(context) {

    private val _responseScan by lazy { MutableLiveData<Any>() }
    val loadResponseScan: LiveData<Any>
        get() = _responseScan

    fun expeditionScan(vExpeditionId: String) {
        salix.expeditionScan(params = arrayListOf(vExpeditionId))
            .enqueue(object : SalixCallback<Unit>(context) {
                override fun onSuccess(response: Response<Unit>) {
                    _responseScan.value = response.message()
                    super.onSuccess(response)
                }

            })
    }

}