package com.grkj.iscs_mc.view.presenter

import com.grkj.iscs_mc.extentions.serialNo
import com.grkj.iscs_mc.model.vo.material.MaterialPropertyValuePageRespVO
import com.grkj.iscs_mc.model.vo.material.MaterialTypePageRespVO
import com.grkj.iscs_mc.model.vo.replacement.ManualReplacementListRespVO
import com.grkj.iscs_mc.util.Executor
import com.grkj.iscs_mc.util.NetApi
import com.grkj.iscs_mc.view.base.BasePresenter
import com.grkj.iscs_mc.view.iview.IMaterialManualReplacementView

class MaterialManualReplacementPresenter : BasePresenter<IMaterialManualReplacementView>() {

    fun getManualReplacementList(callBack: (MutableList<ManualReplacementListRespVO>?) -> Unit) {
        NetApi.getManualReplacementList(mContext!!.serialNo()) {
            Executor.runOnMain {
                callBack(it)
            }
        }
    }

    fun getMaterialType(callBack: (MaterialTypePageRespVO?) -> Unit) {
        NetApi.getMaterialTypePage(1, -1) {
            Executor.runOnMain {
                callBack(it)
            }
        }
    }

    fun getMaterialProperty(callBack: (MutableList<MaterialPropertyValuePageRespVO.Record>?) -> Unit) {
        NetApi.getMaterialPropertyValuePage(1, -1) {
            Executor.runOnMain {
                callBack(it?.records)
            }
        }
    }
}