package com.example.dtf.models

import androidx.room.*
import kotlinx.serialization.Serializable

@Entity(tableName = "category")
@Serializable
data class Category(
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo
    val id: Int?,
    @ColumnInfo
    val name: String
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true

        if (javaClass != other?.javaClass) return false

        other as Category

        return id == other.id
    }

    override fun hashCode(): Int {
        return id ?: -1
    }
}