package com.gamedog.vididin.features.withdraw.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.ama.core.architecture.util.ResUtil
import com.gamedog.vididin.R
import com.gamedog.vididin.databinding.WithdrawItemViewBinding as ViewBinding


class WithDrawItemView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {
    private var mBinding: ViewBinding

    init {
        mBinding = ViewBinding.inflate(LayoutInflater.from(context), this, true)
        mBinding.run {

        }
    }


    fun setNumAndAction(number: String, clickAction: ()->Unit) {
        mBinding.tvWithdrawNum.text = number
        mBinding.root.setOnClickListener {
            clickAction.invoke()
        }
    }


    fun setIconAndText(iconRes: Int, textRes: Int, clickAction: ()->Unit) {
        mBinding.tvWithdrawNum.text = ResUtil.getString(textRes)
        mBinding.ivItemIcon.setImageResource(iconRes)
        mBinding.root.setOnClickListener {
            clickAction.invoke()
        }
    }

    fun setSelected() {
        mBinding.root.setBackgroundResource(R.drawable.withdraw_item_bg_selected)
    }


}