using System.Numerics;
using Voile.Input;

namespace Voile.UI;

public class UIInputContext
{
    public IInputAction Action { get; }
    public Vector2 MousePosition { get; }
    public bool MousePressed { get; set; }
    public bool MouseReleased { get; set; }
    public bool MouseDown { get; set; }

    public string ActionName { get; }

    public int CharPressed { get; }
    public bool HasCharInput => CharPressed != 0;

    public bool Handled => _handled;

    /// <summary>
    /// Marks this context as handled, meaning next elements that will receive it should discard it.
    /// </summary>
    public void SetHandled() => _handled = true;

    public UIInputContext(IInputAction action, Vector2 mousePosition, string actionName, int charPressed = 0)
    {
        Action = action;
        MousePosition = mousePosition;
        ActionName = actionName;
        CharPressed = charPressed;
    }

    private bool _handled;
}