#pragma once

namespace inertia
{

/** Type of socket data. */
enum MessageType : unsigned {
	MESSAGE_TYPE_TEXT = 0,   ///< ASCII text data.
	MESSAGE_TYPE_BINARY = 1, ///< Binary data.
	MESSAGE_TYPE_LAST = 2
};


/** Type of sample data to include. */
enum SamplingType : unsigned {
	SAMPLING_TYPE_NONE = 0,   ///< No sample data.
	SAMPLING_TYPE_ALL,        ///< All sample data.
	SAMPLING_TYPE_INERTIAL,   ///< Inertial sample data.
	SAMPLING_TYPE_ADC,        ///< ADC sample data.
	SAMPLING_TYPE_ACTIVITY,   ///< Activity sample data.
	SAMPLING_TYPE_INE_ADC,    ///< Inertial and ADC sample data.
	SAMPLING_TYPE_LAST
};


/** @brief Socket Settings
 *
 *  Class containing settings for configuring network TCP connection.
 */
struct INERTIA_API SocketSettings
{
	std::wstring hostname;   ///< Hostname of the TCP connection, empty for server.
	unsigned port;           ///< Port of the TCP connection.
	MessageType messageType; ///< Message type used by the TCP connection.
	unsigned reconnectDelay; ///< Number of seconds after which to automatically reconnect a client connection, 0 to disable.

	/** Default constructor. */
	SocketSettings();

	/** Constructor with individual arguments.
	 *  @param hostname the hostname
	 *  @param port the port
	 *  @param messageType the messageType
	 *  @param reconnectDelay the reconnectDelay
	 */
	SocketSettings(std::wstring const& hostname, const unsigned port, MessageType const messageType = MESSAGE_TYPE_TEXT, const unsigned reconnectDelay = 0);

	/** Constructor with string argument.
	 *  Creates SocketSettings from a string.
	 *  @param argString string with arguments
	 */
	SocketSettings(std::wstring const& argString);

#ifdef WITH_BOOST_PROGRAM_OPTIONS
	/** Get the possible command-line arguments for SocketSettings.
	 *  Only available when \a WITH_BOOST_PROGRAM_OPTIONS is defined.
	 *  @return the option description
	 */
	static const po::options_description GetOptionDescription();
#endif

	/** Get a string representation of this SocketSettings.
	 *  The string is compatible with GetOptionDescription() and SocketSettings(std::wstring const&).
	 *  @return the string
	 */
	std::wstring const ToString() const;
};


/** @brief Stream Filter
 *
 *  A filter to limit the (types of) data that is send over a network stream.
 */
struct INERTIA_API StreamFilter
{
	bool forwardConfig;          ///< Configurations are forwarded.
	bool forwardCommand;         ///< Commands are forwarded.
	bool forwardState;           ///< State updates are forwarded.
	bool forwardProgress;        ///< Progress messages are forwarded.
	SamplingType forwardSamples; ///< The types of sample data that is forwarded.

	/** Default constructor. */
	StreamFilter();

	/** Constructor with individual arguments.
	 *  @param forward_samples initial setting for forwardSamples
	 *  @param forward_config initial setting for forwardConfig
	 *  @param forward_command initial setting for forwardCommand
	 *  @param forward_state initial setting for forwardState
	 *  @param forward_progress initial setting for forwardProgress
	 */
	StreamFilter(const SamplingType forward_samples, const bool forward_config, const bool forward_command, const bool forward_state, const bool forward_progress);

	/** Constructor with string argument.
	 *  Creates a StreamFilter from a string.
	 *  @param argString string with arguments
	 */
	StreamFilter(std::wstring const& argString);

#ifdef WITH_BOOST_PROGRAM_OPTIONS
	/** Get the possible command-line arguments for StreamFilter.
	 *  Only available when \a WITH_BOOST_PROGRAM_OPTIONS is defined.
	 *  @return the option description
	 */
	static const po::options_description GetOptionDescription();
#endif

	/** Get a string representation of this StreamFilter.
	 *  The string is compatible with GetOptionDescription() and SocketSettings(std::wstring const&).
	 *  @return the string
	 */
	std::wstring const ToString() const;
};

}
