package com.example.dtf.models

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

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

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

        other as User

        return id == other.id
    }

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