/*
 * Authors : Kerem Yollu & Edwin Koch
 * Date : 07.03.2021
 *
 * Description : 
 * TODO : Inplement singleton pattern 
 * TODO : Write description
 * TODO : Comment the code wiht odxygen
 *
 */


#ifndef _COMMMANDMANAGER_H_
#define _COMMMANDMANAGER_H_

#include <iostream>
#include <array>
#include <string>
#include <functional>

#define MAX_MUNBER_OF_COMMANDS 4

class CommandManager 
{
	public: 
		typedef std::function<void(void)> commanCallback_t; 
		CommandManager();
		void addNewCommand(	const std::string& commmand, 
							const std::string& description, 
							commanCallback_t callBack);

		void operator()(const std::string cmdName);


	private: 
		unsigned int emptyIndex; 

		struct commant_t{
			std::string commmand; 
			std::string description; 
			commanCallback_t callBack; // The Callback function could only be a void returning a void. 
		}; 

		std::array <commant_t, MAX_MUNBER_OF_COMMANDS> commandLookup; 
		int getLookUpIndex(const std::string& cmd); // If command exists retunrs the index otherwise -1
		void printHelp(); // Prints all awailbale commands and their description.
		void printCommads(); // Prints all awailable commnads without description.
};




#endif // _COMMMANDMANAGER_H_
