package com.lukouguoji.gjj.viewModel

import android.content.Intent
import androidx.lifecycle.MutableLiveData
import com.google.gson.Gson
import com.lukouguoji.module_base.base.BaseViewModel
import com.lukouguoji.module_base.bean.IntImpPickUpRecordBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.showToast

/**
 * 国际进港提取详情 ViewModel
 */
class IntImpPickUpRecordDetailsViewModel : BaseViewModel() {

    val dataBean = MutableLiveData(IntImpPickUpRecordBean())

    fun initOnCreated(intent: Intent) {
        val json = intent.getStringExtra(Constant.Key.DATA) ?: ""
        if (json.isNotEmpty()) {
            dataBean.value = Gson().fromJson(json, IntImpPickUpRecordBean::class.java)
        } else {
            showToast("参数错误")
            getTopActivity().finish()
        }
    }
}
