package com.yidian.shenghuoquan.border.viewmodel

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.yidian.bcommon.mvvm.BaseViewModel
import com.yidian.shenghuoquan.border.app.bean.OrderWebData
import com.yidian.shenghuoquan.border.http.UserOrderListOperation
import com.yidian.shenghuoquan.border.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!!
        }
      }
    }
}
