extends Node
class_name ReservationEntity

var id: String

@export var title: String

@export var description: String

@export var room_id: String

@export var creator: String

@export var date: String

@export var start_time: Dictionary # TODO: get rid of dictionaries if can

@export var finish_time: Dictionary

@export var color: int

func is_identical(other: ReservationEntity) -> bool:
	if !(other is ReservationEntity):
		return false

	return (
		id == other.id &&
		title == other.title &&
		description == other.description &&
		room_id == other.room_id &&
		creator == other.creator &&
		date == other.date &&
		_compare_time(start_time, other.start_time) &&
		_compare_time(finish_time, other.finish_time) &&
		color == other.color
	)

static func _compare_time(a: Dictionary, b: Dictionary) -> bool:
	return a.get("hours", -1) == b.get("hours", -2) and \
		   a.get("minutes", -1) == b.get("minutes", -2)
