package com.adealink.weparty.ui.category.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.adealink.weparty.commonui.recycleview.adapter.BindingViewHolder
import com.adealink.weparty.commonui.recycleview.adapter.multitype.ItemViewBinder
import com.adealink.weparty.databinding.LayoutCategoryItemBinding
import com.adealink.weparty.ui.category.data.CategoryListItemData

class CategoryListItemViewBinder :
    ItemViewBinder<CategoryListItemData, BindingViewHolder<LayoutCategoryItemBinding>>() {

    override fun onBindViewHolder(
        holder: BindingViewHolder<LayoutCategoryItemBinding>,
        item: CategoryListItemData,
    ) {
        holder.binding.ivImg.setImageUrl(item.data.icon)
        holder.binding.tvTab.text = item.data.name
    }

    override fun onCreateViewHolder(
        inflater: LayoutInflater,
        parent: ViewGroup,
    ): BindingViewHolder<LayoutCategoryItemBinding> {
        return BindingViewHolder(LayoutCategoryItemBinding.inflate(inflater, parent, false))
    }
}