using UnityEngine;

/// <summary>
/// Test script to verify the new click management system is working correctly.
/// This can be attached to any GameObject to test the ClickManager functionality.
/// </summary>
public class ClickManagerTest : MonoBehaviour
{
    [Header("Test Settings")]
    public bool showDebugInfo = true;
    public KeyCode testKey = KeyCode.T;

    void Update()
    {
        if (Input.GetKeyDown(testKey))
        {
            TestClickManager();
        }

        if (Input.GetMouseButtonDown(0) && showDebugInfo)
        {
            TestClickBlocking();
        }
    }

    void TestClickManager()
    {
        if (ClickManager.Instance != null)
        {
            Debug.Log("✅ ClickManager is working!");
            ClickManager.Instance.ListRegisteredBlockers();
        }
        else
        {
            Debug.LogError("❌ ClickManager is not available!");
        }
    }

    void TestClickBlocking()
    {
        Vector2 mousePos = Input.mousePosition;
        bool isBlocked = ClickManager.Instance != null && ClickManager.Instance.IsClickBlocked(mousePos);

        Debug.Log($"🖱️ Click at {mousePos}: {(isBlocked ? "BLOCKED" : "ALLOWED")}");
    }
}
