package com.adealink.weparty.room.gift.data

import com.adealink.weparty.commonui.recycleview.diffutil.BaseListItemData
import com.adealink.weparty.module.gift.data.GiftInfo
import com.adealink.weparty.module.profile.data.UserInfo

data class RoomGiftUserItemData(
    val userInfo: UserInfo?,
    val tag: String,
    var isSelected: Boolean = false
) : BaseListItemData {

    override fun areItemsTheSame(newItem: Any): Boolean {
        return false
    }

    override fun areContentsTheSame(newItem: Any): Boolean {
        val other = (newItem as? RoomGiftUserItemData) ?: return false
        return userInfo?.uid == other.userInfo?.uid
                && tag == other.tag
                && isSelected == other.isSelected
    }
}

data class RoomGiftTargetUserItemData(
    val userInfo: UserInfo?,
) : BaseListItemData {
    override fun areContentsTheSame(newItem: Any): Boolean {
        val other = (newItem as? RoomGiftTargetUserItemData) ?: return false
        return userInfo?.uid == other.userInfo?.uid
    }
}

data class RoomGiftItemData(
    val giftInfo: GiftInfo,
    var isSelected: Boolean = false
) : BaseListItemData {

    override fun areItemsTheSame(newItem: Any): Boolean {
        return false
    }

    override fun areContentsTheSame(newItem: Any): Boolean {
        val other = (newItem as? RoomGiftItemData) ?: return false
        return giftInfo.id == other.giftInfo.id
                && isSelected == other.isSelected
    }
}