package com.gamedog.vididin.features.withdraw


import android.app.Activity
import android.content.Context
import com.ama.core.architecture.util.ResUtil
import com.ama.core.architecture.util.setOnClickBatch
import com.ama.core.architecture.widget.BindingDialog
import com.gamedog.vididin.R
import com.gamedog.vididin.core.login.login.AccountManager
import com.gamedog.vididin.databinding.DialogWithdrawInfoConfirmBinding as ViewBinding
import com.gamedog.vididin.router.Router


class WithdrawInfoConfirmDialog(context: Activity) : BindingDialog<ViewBinding>(context, ViewBinding::inflate) {

    private var mWithdrawCashNum: Float = 0F

    init {
        build()
    }


    private fun build() {
        with()
        setCenter()
        setMaskValue(0.8f)
        setCanCancel(false)

        mBinding.run {
            setOnClickBatch(tvActionAlter, tvActionApply, ivClose) {
                when (this) {
                    ivClose ->  {
                        dismiss()
                    }

                    tvActionAlter ->  {
                        dismiss()
                    }

                    tvActionApply ->  {
                        WithdrawWatchAdDialog(mActivity).show()
                        dismiss()
                    }
                }
            }
        }
    }


    private fun gotoWatchVideo() {
        Router.Withdraw.startActivity(mActivity)
    }


    fun setWithDrawCashNum(withdrawNum: Float): WithdrawInfoConfirmDialog {
        mWithdrawCashNum = withdrawNum

        mBinding.tvCashNum.text = buildString {
            append(ResUtil.getString(R.string.cash))
            append(" ")
            append(mWithdrawCashNum)
        }
        mBinding.tvCpfAccount.text = AccountManager.getBankInfo()?.bankAccount

        return this
    }

}

