package com.quansu.heifengwuliu.vmodel

import android.os.Bundle
import androidx.lifecycle.MutableLiveData
import com.quansu.heifengwuliu.activity.*
import com.quansu.heifengwuliu.config.MIntentAction
import com.quansu.heifengwuliu.model.User
import com.quansu.heifengwuliu.repository.MineRepository
import com.ysnows.base.base.BViewModel
import com.ysnows.base.utils.B
import com.ysnows.base.utils.DialUtils
import com.ysnows.base.utils.MMKVManager
import com.ysnows.base.utils.UiSwitch

/**
 *Created by shihuiyun
 *on 2020/9/10
 */
open class MineVModel : BViewModel<MineRepository>() {
    val user: MutableLiveData<User?> = MutableLiveData(User.get())

    fun goSettings() {
        single(SettingsActivity::class.java)
    }

    fun goMsg() {
        single(MsgActivity::class.java)
    }

    fun goVehicleVerify() {
        single(MsgActivity::class.java)
    }

    fun goComVerify() {
        single(ComVerityActivity::class.java)
    }

    fun goCollection() {
//        single(CollectionActivity::class.java)
        bundle(CollectionActivity::class.java, Bundle().apply {
            putString("type", "0") })

    }
    fun goInvoice() {
        //发票
        single(InvoiceActivity::class.java)
    }





    fun goPersonalVerify() {
        single(PersonalVerityActivity::class.java)
    }

    fun goMyAccount() {
        single(AccountActivity::class.java)
    }



    override fun firstReq() {
        super.firstReq()
        repository().getUserInfo()
                .doOnNext {
                    user.value = it
                }
                .subscribe()
    }

    fun callPhone() {
        DialUtils.dialPhone(view()?.context(), "19898989898")

    }
    fun goAdress(){

        bundle(AddressActivity::class.java, Bundle().apply {
            putString("type", "1")
            putString("isShow", "0")
        })

    }





}
