package es.verdnatura.presentation.view.feature.paletizador.adapter


import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemExpeditionstateRowBinding
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionStateRow

class ExpeditionStateAdapter  (
    private val items: List<ItemExpeditionStateRow>,
): RecyclerView.Adapter<ExpeditionStateAdapter.ItemHolder> () {


    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
        return ItemHolder(
            ItemExpeditionstateRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
        )
    }

    override fun getItemCount() =items.size

    override fun onBindViewHolder(holder: ItemHolder, position: Int) {
        holder.bind(items[position])
        /* if (items[position].isEditable){
            holder.binding.root.setOnClickListener {
               // OnItemExpeditionStateRowClickListener.OnItemExpeditionStateRowClickListener(items[position])
            }
        }*/
    }


    class ItemHolder(
        val binding: ItemExpeditionstateRowBinding
    ) : RecyclerView.ViewHolder(binding.root){
        fun bind(item: ItemExpeditionStateRow) {
            binding.apply {
                this.item = item

            }
        }
    }
}