package com.zswc.creativity.vmodel

import android.app.Application
import androidx.databinding.Bindable
import androidx.lifecycle.MutableLiveData
import com.zswc.creativity.activity.LoginActivity
import com.tencent.mmkv.MMKV
import com.ysnows.base.base.BRepository
import com.ysnows.base.base.BViewModel
import com.ysnows.base.utils.UiSwitch
import com.zswc.creativity.BR
import com.zswc.creativity.R

class BindBankVModel(application: Application) : BViewModel<BRepository>(application)  {

    var codeTip: MutableLiveData<String> = MutableLiveData(RegisterVModel.getCodeStr)

    @Bindable
    open var phone: String? = null
        set(value) {
            field = value
            notifyPropertyChanged(BR.phone)
        }


    companion object {
        const val time = 60
        var timeStart: Long = 1
        const val getCodeStr = "获取验证码"

        const val getShow = false


    }


    fun getSmsCode(start: Long = 1) {
        if (codeTip.value != getCodeStr) {
            return
        }

        if (phone.isNullOrEmpty()) {
            toast(R.string.please_input_user_phone)
            return
        }

//        repository().rxLreq(NetEngine.service.getRegisterSms(phone))
//                .doOnNext() { res ->
//                    if (res.ok(true)) {
//                        startTimer(start)
//                    }
//                }
//                .subscribe()
    }



}
