package com.zj365.mime.vm

import android.graphics.pdf.PdfDocument.Page
import androidx.lifecycle.MutableLiveData
import com.xty.base.vm.BaseVm
import com.xty.network.model.EnterpriseInfoHomeBean
import com.xty.network.model.RespBody
import org.json.JSONObject

class EnterpriseInformationVm : BaseVm() {

    val enterpriseInfoHomeLiveData by lazy { MutableLiveData<RespBody<MutableList<EnterpriseInfoHomeBean>>>() }

    val enterpriseInfoForTypeLiveData by lazy { MutableLiveData<RespBody<EnterpriseInfoHomeBean>>() }

    fun getEnterpriseInformationHomeList(){
        startHttp {
            var response=apiInterface().getEnterpriseInfoHomeList()
            response.getCodeStatus(enterpriseInfoHomeLiveData,nowData)
        }
    }


    fun getEnterpriseInformationForType(type:Int,pageNum:Int){
        startHttp {
            var json = JSONObject()
            json.put("type",type)
            json.put("pageNum",pageNum)
            json.put("pageSize","10")
            var response=apiInterface().getEnterpriseInfoForType(retrofits.getRequestBody(json.toString()))
            response.getCodeStatus(enterpriseInfoForTypeLiveData,nowData)
        }
    }

}