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

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

class ParkingViewModel(val context: Context) : BaseViewModel(context) {
    private val _responseParking by lazy { MutableLiveData<Boolean>() }
    val responseParking: LiveData<Boolean> = _responseParking

    fun setParking(scanItem: String, parking: String) {
        salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
            .enqueue(object :
                SalixCallback<Any>(context) {
                override fun onSuccess(response: Response<Any>) {
                    _responseParking.value = true
                }
            })
    }

}
