package com.khmer9.yuki.screen.report

import android.annotation.SuppressLint
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.khmer9.yuki.R
import com.khmer9.yuki.remote.StatementBetting
import java.text.DecimalFormat


class ReportListViewHolder(itemView: View, private val printButtonListener: ((String, String, String, String, String, String) -> Unit)? = null) : BaseListViewHolder(itemView) {

    @SuppressLint("SetTextI18n")
    override fun bindView(item: BaseListItem) {

        when (item) {
            is StatementBetting -> {//Statement
                val imgC1 = itemView.findViewById<ImageView>(R.id.img_c1)
                val tvC2 = itemView.findViewById<TextView>(R.id.tv_c2)
                val tvC3 = itemView.findViewById<TextView>(R.id.tv_c3)
                val tvC4 = itemView.findViewById<TextView>(R.id.tv_c4)
                // val tvC5 = itemView.findViewById<TextView>(R.id.tv_c5)
                tvC2.text = item.date
                tvC3.text = currencyFormat(item.amount!!.toInt())
            }
        }
    }

    fun currencyFormat(amount: Int): String? {
        val formatter = DecimalFormat("#,###")
        return formatter.format(amount)
    }
}