package com.example.myapplication.database.room.model.rent

import androidx.room.ColumnInfo
import androidx.room.Entity
import java.util.Objects

@Entity(
    tableName = "rents_items",
    primaryKeys = ["rent_id", "item_id"]
)
data class RentItemCrossRef(
    @ColumnInfo(name = "rent_id", index = true)
    val rentId: Int,
    @ColumnInfo(name = "item_id", index = true)
    val itemId: Int,
    @ColumnInfo(name = "frozen_weight")
    val frozenWeight: Double,
    val radius: Double,
    val colorbike: String,
    val count: Int
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }
        if (javaClass != other?.javaClass) {
            return false
        }
        other as RentItemCrossRef
        if (rentId == other.rentId && itemId == other.itemId) {
            return true
        }
        return false
    }

    override fun hashCode(): Int {
        return Objects.hash(rentId, itemId)
    }
}