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

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.updateLayoutParams
import com.adealink.weparty.commonui.recycleview.adapter.BindingViewHolder
import com.adealink.weparty.commonui.recycleview.adapter.multitype.ItemViewBinder
import com.adealink.weparty.databinding.LayoutCategoryItemBottomBinding
import com.adealink.weparty.ui.category.data.CategoryListBottomData

class CategoryListBottomViewBinder :
    ItemViewBinder<CategoryListBottomData, BindingViewHolder<LayoutCategoryItemBottomBinding>>() {

    override fun onBindViewHolder(
        holder: BindingViewHolder<LayoutCategoryItemBottomBinding>,
        item: CategoryListBottomData,
    ) {
        holder.binding.vBottom.updateLayoutParams<ConstraintLayout.LayoutParams> {
            height = item.height
        }
    }

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