package com.adealink.weparty.room.gift.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.room.R
import com.adealink.weparty.room.databinding.ItemRoomGiftTargetUserBinding
import com.adealink.weparty.room.gift.data.RoomGiftTargetUserItemData

class RoomGiftTargetUserItemViewBinder :
    ItemViewBinder<RoomGiftTargetUserItemData, BindingViewHolder<ItemRoomGiftTargetUserBinding>>() {

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

    override fun onBindViewHolder(
        holder: BindingViewHolder<ItemRoomGiftTargetUserBinding>,
        item: RoomGiftTargetUserItemData
    ) {
        holder.binding.ivAvatar.setImageUrl(item.userInfo?.avatar)
        holder.binding.ivAvatar.setBackgroundResource(R.drawable.room_gift_user_selected_bg)
        holder.binding.tvName.text = item.userInfo?.nickName
    }
}