package com.quansu.heifengwuliu.vmodel

import androidx.lifecycle.MutableLiveData
import com.quansu.heifengwuliu.activity.*
import com.quansu.heifengwuliu.model.User
import com.quansu.heifengwuliu.repository.MineRepository
import com.ysnows.base.base.BViewModel
import com.ysnows.base.utils.DialUtils

/**
 *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)
    }

    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")

    }

}
