using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Input {

	///<summary>Public keyboard interface for Vortex2D.NET engine. It combines async input based on DirectInput and sync input based on Windows message queue</summary>
	public interface IKeyboard {

		/// <summary>
		/// Determines whether the specified key is down.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>
		/// 	<c>true</c> if the specified key is down; otherwise, <c>false</c>.
		/// </returns>
		bool IsDown(Key key);

		/// <summary>
		/// Gets the time of specified key is in down state.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>Time in seconds how long specified key is down. If key is up then </returns>
		float GetKeyDownTime(Key key);

		/// <summary>
		/// Determines whether the specified key is pressed (just changed state to down).
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>
		/// 	<c>true</c> if the specified key is pressed; otherwise, <c>false</c>.
		/// </returns>
		bool IsPressed(Key key);

		/// <summary>
		/// Determines whether the specified key is released (just changed state to up from down).
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>
		/// 	<c>true</c> if the specified key is released; otherwise, <c>false</c>.
		/// </returns>
		bool IsReleased(Key key);

		/// <summary>
		/// Determines whether the specified key is toggled.
		/// </summary>
		/// <param name="key">The key.</param>
		/// <returns>
		/// 	<c>true</c> if the specified key is toggled; otherwise, <c>false</c>.
		/// </returns>
		bool IsToggled(Key key);

		/// <summary>
		/// Determines whether some key combination was pressed.
		/// </summary>
		/// <param name="shiftKey">The shift key (it should be pressed before main key is going down).</param>
		/// <param name="mainKey">The main key.</param>
		/// <returns>
		/// 	<c>true</c> if specified combination was pressed; otherwise, <c>false</c>.
		/// </returns>
		bool IsPressedCombination(Key shiftKey, Key mainKey);


		#region Events

		///<summary>Occurs when some key is down in focused window</summary>
		event KeyActionHandler KeyDown;

		///<summary>Occurs when some key is up after it was down in focused window</summary>
		event KeyActionHandler KeyUp;

		///<summary>Occurs when system decoded some character code from keyboard events</summary>
		event CharActionHandler EnterChar;

		#endregion

	}
}
