#ifndef OpenTestSystem_OtxDiagManager_Common_Command_H
#define OpenTestSystem_OtxDiagManager_Common_Command_H

#include "CommonDefs.h"
#include <string>
#include "ParameterContainer.h"

namespace OpenTestSystem
{
	namespace OtxDiagManager
	{
		namespace Common
		{
			class CommandDataPb;

			/// <summary>
			/// This class is used for communication between layers. 
			/// <remarks>
			/// The Command contains a Google Protobuf data object, which is related according to OTX term or action (e.g. GetComChannel, ExecuteDiagService, ...). It contains all required parameter values.
			/// </remarks>
			/// </summary>
			class COMMON_EXPORTS Command : public ParameterContainer
			{
			public:
				Command();
				Command(const Command& otherCmd);
				Command& operator=(const Command& otherCmd);
				virtual ~Command();

				/// <summary>
				/// Set Client Id field in Command.
				/// </summary>
				/// <param name="clientId">Client Id.</param>
				void SetClientId(int clientId); // the server will set this client id

				/// <summary>
				/// Get Client Id in Command.
				/// </summary>
				/// <returns>Client Id.</returns>
				int GetClientId() const;

				/// <summary>
				/// Set Client Name field in Command.
				/// </summary>
				/// <param name="clientName">Client Name.</param>
				void SetClientName(const std::string & clientName);

				/// <summary>
				/// Get Client Name in Command.
				/// </summary>
				/// <returns>Client Name.</returns>
				std::string GetClientName() const;

				/// <summary>
				/// Set unique Command Id.
				/// </summary>
				/// <param name="commandId">Command id.</param>
				void SetCommandId(int commandId);

				/// <summary>
				/// Get unique Command Id.
				/// </summary>
				/// <returns>Unique Command Id.</returns>
				int GetCommandId() const;  // this is the unique id of command

				/// <summary>
				/// Set Command Type.
				/// </summary>
				/// <remarks>
				/// E.g: UserCommand = 0 (default), GetComChannel = 1, CreateDiagService = 2, ...
				/// </remarks>
				/// <param name="commandType">Command Type.</param>
				void SetCommandType(int commandType);

				/// <summary>
				/// Get Command Type. 
				/// <remarks>
				/// E.g: UserCommand = 0 (default), GetComChannel = 1, CreateDiagService = 2, ...
				/// </remarks>
				/// </summary>
				/// <returns>Command Type.</returns>
				int GetCommandType() const; // this is command type, e.g: UserCommand = 0 (default), GetComChannel = 1, CreateDiagService = 2, ...

				/// <summary>
				/// Set Command Name field in Command.
				/// </summary>
				/// <param name="name">Command Name.</param>
				void SetCommandName(std::string name); //no need on server side. Name will be set at deserializing object.

				/// <summary>
				/// Get Command Name in Command.
				/// </summary>
				/// <returns>Command Name.</returns>
				std::string GetCommandName() const;

				/// <summary>
				/// Serialize the internal Google Protobuf data object in the output string.
				/// </summary>
				/// <param name="output">Output string.</param>
				void Serialize(std::string* output) const override;

				/// <summary>
				/// Deserialize the data string into the internal Google Protobuf data object.
				/// </summary>
				/// <param name="output">Output string.</param>
				void Deserialize(const std::string& data) override;

			private:
				int _clientId;
				std::string _clientName;
				CommandDataPb* _commandData;
			};
		}
	}
}
#endif // OpenTestSystem_OtxDiagManager_Common_Command_H