package com.cocking.fight.screen.report

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gdtlib.lib.adapter.BaseListAdapter
import com.sambath.sbc.R
import com.sambath.sbc.remote.ReportOne

class ReportAdapter(private val type: Type): BaseListAdapter() {
    var printButtonListener: ((ReportOne) -> Unit) ?= null

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        when (type) {
            Type.DEPOSIT -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_money_transaction,
                        parent,
                        false
                    )
                )
            }
            Type.WITHDRAW -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_money_transaction,
                        parent,
                        false
                    )
                )
            }
            Type.WIN -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_table_statement,
                        parent,
                        false
                    ), printButtonListener
                )
            }
            Type.WIN_LOST -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_table_report,
                        parent,
                        false
                    ), printButtonListener
                )
            }
            Type.STATEMENT -> {//Statement
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_report,
                        parent,
                        false
                    )
                )
            }

        }
    }
}
enum class Type{
    DEPOSIT, WITHDRAW, WIN, WIN_LOST, STATEMENT
}