package com.hongyegroup.cpt_ewallet.ui

import android.content.Intent
import android.os.Bundle
import com.guadou.cs_cptservices.base.activity.YYBaseVDBActivity
import com.guadou.lib_baselib.bean.DataBindingConfig
import com.guadou.lib_baselib.engine.toast
import com.guadou.lib_baselib.ext.commContext
import com.guadou.lib_baselib.ext.gotoActivity
import com.guadou.lib_baselib.utils.KeyboardUtils
import com.hongyegroup.cpt_ewallet.BR
import com.hongyegroup.cpt_ewallet.R
import com.hongyegroup.cpt_ewallet.databinding.ActivityBankWithdrawBinding
import com.hongyegroup.cpt_ewallet.mvvm.BankWithdrawViewModel

/**
 * 银行卡提现页面，输入银行卡信息
 */
class BankWithdrawActivity : YYBaseVDBActivity<BankWithdrawViewModel, ActivityBankWithdrawBinding>() {

    var withDrawMoney: String? = null

    companion object {
        fun startInstance(withdrawMoney: String) {
            commContext().gotoActivity<BankWithdrawActivity>(bundle = arrayOf(Pair("money", withdrawMoney)))
        }
    }

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

    override fun getDataFromIntent(intent: Intent) {
        withDrawMoney = intent.getStringExtra("money")
    }

    override fun init(savedInstanceState: Bundle?) {
        setStatusBarBlackText()
        mViewModel.mWithdrawMoney.value = withDrawMoney ?: ""
    }

    override fun startObserve() {

    }

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

        fun submitForm() {
            KeyboardUtils.hideSoftInput(mActivity)

            toast("调用接口提交提现申请")
        }

    }
}