package com.gh.gamecenter.entity

import android.os.Parcelable
import com.gh.gamecenter.common.entity.ToolBoxEntity
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Parcelize
data class ToolBoxBlockEntity(
    @SerializedName("_id")
    val categoryId: String = "",
    @SerializedName("name")
    val categoryName: String = "",
    val total: Int = 0,
    @SerializedName("data")
    var toolboxList: List<ToolBoxEntity> = ArrayList(),
    // 展开状态（本地字段）
    var isExpand: Boolean = false
) : Parcelable {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as ToolBoxBlockEntity

        if (categoryId != other.categoryId) return false
        if (categoryName != other.categoryName) return false
        if (total != other.total) return false
        if (toolboxList != other.toolboxList) return false

        return true
    }

    override fun hashCode(): Int {
        var result = categoryId.hashCode()
        result = 31 * result + categoryName.hashCode()
        result = 31 * result + total
        result = 31 * result + toolboxList.hashCode()
        return result
    }
}
