package com.example.dtf.models

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

@Entity(tableName = "comment")
@Serializable
data class Comment(
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo
    val id: Int?,
    @ColumnInfo(name = "user_id")
    val user_id: Int,
    @ColumnInfo(name = "post_id")
    val post_id: Int,
    @ColumnInfo
    val content: String,
    @ColumnInfo
    val date: String,
    @ColumnInfo
    val author: String = ""
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true

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

        other as Comment

        return id == other.id
    }

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