package com.abbidot.tracker.deprecated.ui.activity.vm

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.bean.LKSimListBean
import com.abbidot.tracker.bean.SetMealBean
import com.abbidot.tracker.retrofit2.NetworkApi
import kotlinx.coroutines.launch

/**
 *Created  by .yzq on 2022/3/26/026.
 * @link
 * @description:
 */
class RechargeAmountViewModel : ViewModel() {
    val mSetMealListLiveData = MutableLiveData<Result<MutableList<SetMealBean>>>()
    val mLKSimSetMealListLiveData = MutableLiveData<Result<LKSimListBean>>()

    /**
     * 获取套餐列表
     */
    fun getSetMealList(activity: BaseActivity<*>) {
        activity.showLoading(true)
        viewModelScope.launch {
            val result = NetworkApi.getSetMealList()
            mSetMealListLiveData.value = result
        }
    }

    /**
     * 获取sim卡餐列表
     */
    fun getSimSetMealList(activity: BaseActivity<*>, iccId: String) {
        activity.showLoading(true)
        viewModelScope.launch {
            val result = NetworkApi.getSimSetMealList(iccId, "CN00000827")
            mLKSimSetMealListLiveData.value = result
        }
    }
}