namespace Voile.Input
{

    public interface IInputAction
    {
        bool IsDown(InputSystem inputSystem);
        bool IsPressed(InputSystem inputSystem);
        bool IsReleased(InputSystem inputSystem);
    }

    public struct KeyInputAction : IInputAction
    {
        public KeyboardKey Key => _keyboardKey;

        public KeyInputAction(KeyboardKey keyboardKey)
        {
            _keyboardKey = keyboardKey;
        }
        public bool IsDown(InputSystem inputSystem)
        {
            return inputSystem.IsKeyboardKeyDown(_keyboardKey);
        }

        public bool IsPressed(InputSystem inputSystem)
        {
            return inputSystem.KeyboardKeyJustPressed(_keyboardKey);
        }

        public bool IsReleased(InputSystem inputSystem)
        {
            return inputSystem.KeyboardKeyJustReleased(_keyboardKey);
        }

        private KeyboardKey _keyboardKey;
    }

    public struct MouseInputAction : IInputAction
    {
        public MouseButton MouseButton { get; private set; }

        public MouseInputAction(MouseButton button)
        {
            MouseButton = button;
        }

        public bool IsPressed(InputSystem inputSystem)
        {
            return inputSystem.IsMouseButtonPressed(MouseButton);
        }

        public bool IsDown(InputSystem inputSystem)
        {
            return inputSystem.IsMouseButtonDown(MouseButton);
        }

        public bool IsReleased(InputSystem inputSystem)
        {
            return inputSystem.IsMouseButtonReleased(MouseButton);
        }
    }
}