package com.hongyegroup.cpt_auths.ui

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.lifecycle.MutableLiveData
import com.guadou.cs_cptservices.base.activity.YYBaseVDBActivity
import com.guadou.lib_baselib.bean.DataBindingConfig
import com.guadou.lib_baselib.utils.CommUtils
import com.guadou.lib_baselib.utils.KeyboardUtils
import com.hongyegroup.cpt_auths.BR
import com.hongyegroup.cpt_auths.R
import com.hongyegroup.cpt_auths.databinding.ActivityPensonalSignupVerityBinding
import com.hongyegroup.cpt_auths.mvvm.vm.PensonalSignUpInputViewModel

/**
 * 用户注册的校验页面
 */
class PensonalSignupInputActivity : YYBaseVDBActivity<PensonalSignUpInputViewModel, ActivityPensonalSignupVerityBinding>() {

    companion object {
        fun startInstance() {
            val context = CommUtils.getContext()
            val intent = Intent(context, PensonalSignupInputActivity::class.java)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context.startActivity(intent)
        }
    }

    override fun getDataBindingConfig(): DataBindingConfig {
        return DataBindingConfig(R.layout.activity_pensonal_signup_input, BR.viewModel, mViewModel)
            .addBindingParams(BR.click, ClickProxy())
    }

    override fun startObserve() {

    }

    override fun init(savedInstanceState: Bundle?) {

    }

    /**
     * DataBinding事件处理
     */
    inner class ClickProxy {

        //电话号码
        val mMobilePhoneLD: MutableLiveData<String> = MutableLiveData()

        //全名
        val mFullNameLD: MutableLiveData<String> = MutableLiveData()

        //身份证
        val mNRICLD: MutableLiveData<String> = MutableLiveData()

        //密码
        val mPasswordLD: MutableLiveData<String> = MutableLiveData()

        //确认密码
        val mConfirmPsdLD: MutableLiveData<String> = MutableLiveData()

        //选择手机区号
        fun selectCountCode(view: View) {
            KeyboardUtils.hideSoftInput(mActivity)
            mViewModel.showCountryCodePopup(view, mActivity)
        }

        //执行登录校验
        fun doSignUp() {
            KeyboardUtils.hideSoftInput(mActivity)
            PensonalSignupVerifyActivity.startInstance("+86 1234567890")
        }

    }

}