package com.zj365.health.vm

import androidx.lifecycle.MutableLiveData
import com.alibaba.fastjson.JSONObject
import com.xty.base.vm.BaseVm
import com.xty.network.model.RespBody
import com.xty.network.model.WatchCurrentTimeBean

class FamilyHealthRealTimeVm : BaseVm() {

    val watchCurrentTimeLiveData by lazy { MutableLiveData<RespBody<WatchCurrentTimeBean>>() }
    val measureLiveData by lazy { MutableLiveData<RespBody<Any>>() }

    fun getWatchCurrentTime(id:Long){
        startHttp {
            var json = JSONObject()
            json.put("id",id)
            val request = apiInterface().getWatchCurrentTime(retrofits.getRequestBody(json.toString()))
            request.getCodeStatus(watchCurrentTimeLiveData,nowData)

        }
    }

    fun measureData(id:Long,type:Int){
        startHttp (false){
            var json = JSONObject()
            json.put("id",id)
            json.put("type",type)
            val request = apiInterface().measureWatchData(retrofits.getRequestBody(json.toString()))
            request.getCodeStatus(measureLiveData,nowData)

        }
    }
}