extends Button

@onready var test_button = $"."

func _ready():
	test_button.pressed.connect(_on_test_clicked)

func _on_test_clicked():
	print("Testing HTTPClient...")

	# Test API call (replace with real endpoint)
	# Note: Can use HTTPClient directly in _ready() or later
	#HTTPClient.http_get("/api/v1/health", _on_api_success, _on_api_error)

	# Alternative (always works):
	get_node("/root/HTTPClient").http_get("/api/v1/health", _on_api_success, _on_api_error)

func _on_api_success(response):
	print("API Success!")
	print("Status: ", response.status)
	print("Result: ", response.result)

func _on_api_error(response):
	print("API Error!")
	print("Error: ", response.get_error_message())
