package com.khmer9.yuki.screen.report

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gdtlib.lib.adapter.BaseListAdapter
import com.khmer9.yuki.R

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

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        when (type) {
            Type.WIN -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_table_holder,
                        parent,
                        false
                    ), printButtonListener
                )
            }

            Type.WIN_LOST -> {
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_table_holder,
                        parent,
                        false
                    ), printButtonListener
                )
            }

            Type.STATEMENT -> {//Statement
                return ReportListViewHolder(
                    LayoutInflater.from(parent.context).inflate(
                        R.layout.item_report,
                        parent,
                        false
                    )
                )
            }

        }
    }
}

enum class Type {
    WIN, WIN_LOST, STATEMENT
}