package com.zj365.mime.vm

import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.common.util.CommonToastUtils
import com.zj365.mime.R
import com.xty.network.model.NotAccepted
import com.xty.network.model.RespBody
import okhttp3.MultipartBody
import java.io.File

class ActiveActionVm: BaseVm() {
    val status by lazy{MutableLiveData<RespBody<NotAccepted>>()}
    fun active(path:String,devNum:String,code:String){
        if(path.isEmpty()){
            CommonToastUtils.showToast("请完善签名")
            return
        }
        if(devNum.isEmpty()){
            CommonToastUtils.showToast(R.string.please_input_device_code)
            return
        }
        if(code.isEmpty()){
            CommonToastUtils.showToast(R.string.please_input_active_code)
            return
        }

        var file= File(path)
        var fileBody=MultipartBody.Part.createFormData("file",file.name,retrofits.getMultiPartFileRb(file))

        startHttp {
          /* var response= apiInterface().activite(fileBody,retrofits.getRequestBody(devNum),retrofits.getRequestBody(code))
            response.getCodeStatus(status,nowData)*/
        }
    }
}