package com.example.shawarma.data.models

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "users")
data class UserModel(
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id")
    val id: Int?,
    @ColumnInfo(name = "user_login")
    val login: String,
    @ColumnInfo(name = "user_password")
    val password: String,
    @ColumnInfo(name = "user_role")
    val role: String
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false
        other as UserModel
        if (id != other.id) return false
        return true
    }

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