package com.yidian.shenghuoquan.buserorder.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.yidian.bcommon.mvvm.BaseViewModel
import com.yidian.shenghuoquan.buserorder.app.bean.OrderWebData
import com.yidian.shenghuoquan.buserorder.http.UserOrderListOperation
import com.yidian.shenghuoquan.buserorder.http.callback.OrderListCallBack

class OrderListViewModel : BaseViewModel(){

    private var orderList:MutableLiveData<List<OrderWebData>> = MutableLiveData<List<OrderWebData>>()
    var _orderList:LiveData<List<OrderWebData>> = orderList

    fun requestUserOrder(param:HashMap<String, String?>) {
      UserOrderListOperation.userOrderList(param, orderListCallBack)
    }

    private var orderListCallBack = object : OrderListCallBack {
      override fun onOrderListCallback(orders: List<OrderWebData>?) {
        if (orders != null) {
          orderList.value = orders!!
        }
      }
    }
}
