package com.sambath.klaklouk_main.screen.result

import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.gdtlib.lib.adapter.BaseListItem
import com.gdtlib.lib.viewholder.BaseListViewHolder
import com.sambath.klaklouk_main.R

class Table2ListViewHolder(
    itemView: View

) : BaseListViewHolder(itemView) {
    private val ivCircle = itemView.findViewById<ImageView>(R.id.img_color)

     private val tvNumber = itemView.findViewById<TextView>(R.id.tv_number)


    override fun bindView(item: BaseListItem) {
        when (item) {
            is Table2ListItem -> {

                with(item) {
                    if (rangeNumber == 1){//1 is yellow
                        ivCircle.setImageResource(R.drawable.bg_circle_yellow)
                        tvNumber.text = rangeNumber.toString()

                    }else if (rangeNumber ==2){//2 is blue
                        ivCircle.setImageResource(R.drawable.bg_circle_blue)
                        tvNumber.text = rangeNumber.toString()
                    }else if (rangeNumber ==3){//3 is green
                        ivCircle.setImageResource(R.drawable.bg_circle_green)
                        tvNumber.text = rangeNumber.toString()
                    }else if (rangeNumber ==4){//4 is red
                        ivCircle.setImageResource(R.drawable.bg_circle_red)
                        tvNumber.text = rangeNumber.toString()
                    }else if (rangeNumber ==5){//5 is pink
                        ivCircle.setImageResource(R.drawable.bg_circle_pink)
                        tvNumber.text = rangeNumber.toString()
                    }
                }
            }

        }

    }
}