package com.gdtlib.lib.adapter

import android.annotation.SuppressLint
import androidx.recyclerview.widget.DiffUtil

abstract class BaseListItem {

    companion object {

        val ITEM_CALLBACK = object : DiffUtil.ItemCallback<BaseListItem>() {
            override fun areItemsTheSame(oldItem: BaseListItem, newItem: BaseListItem) =
                oldItem.getUnique() == newItem.getUnique()

            @SuppressLint("DiffUtilEquals")
            override fun areContentsTheSame(oldItem: BaseListItem, newItem: BaseListItem) =
                oldItem == newItem
        }
    }

    abstract fun getUnique(): String
}