extends RefCounted

class_name Holes

var holes: Dictionary[int, Hole]
var counter: int = 0

func _init() -> void:
	self.holes = {}

func add_hole(vectors: PackedVector2Array) -> Hole:
	var hole = Hole.new(counter, vectors)
	self.holes[counter] = hole
	counter += 1
	
	return hole

func remove_hole(hole_id: int):
	self.holes.erase(hole_id)

func get_hole(hole_id: int) -> Hole:
	return self.holes[hole_id]

func get_hole_verticies() -> PackedVector2Array:
	var return_val: PackedVector2Array = []
	for hole in holes.values():
		return_val.append_array(hole.vectors)
	return return_val

func get_holes() -> Array[PackedVector2Array]:
	var return_val: Array[PackedVector2Array] = []
	for hole in holes.values():
		return_val.append(hole.vectors)
	return return_val
