--[[
	Returns a new window component associated with specified model. 
]]

function Window.new(model)
	local component = {
		_model = model,
		_state = Constants.State.Window.Normal,
		_connections = {}
	}

	setmetatable(component, {__index = Window})

	component._connections.repairConnection =
		model:FindFirstChild("Glass").Touched:Connect(
		function(otherPart)
			if otherPart.Anchored then
				return
			end

			if
				CollectionService:HasTag(otherPart, Constants.Tag.Tool.RepairKit) and
					component._state == Constants.State.Window.Breached
			 then
				otherPart:Destroy()
				component:fix()
			end
		end
	)

	return component
end
