#ifndef OpenTestSystem_OtxDiagManager_Common_ParameterContainerData_H
#define OpenTestSystem_OtxDiagManager_Common_ParameterContainerData_H

#include "CommonDefs.h"
#include "CommonClasses.h"
#include "ProtoClasses.h"

#include "ISerializable.h"
#include <map>
#include <memory>

namespace OpenTestSystem
{
	namespace OtxDiagManager
	{
		namespace Common
		{
			class ParameterContainerData : public ISerializable
			{
			public:
				ParameterContainerData();
				ParameterContainerData(const ParameterContainerData& otherContainerData);
				virtual ~ParameterContainerData();

				ParameterContainerData& operator=(const ParameterContainerData& otherContainerData);
				void Clear();

				void AddParameter(int parameterId, std::shared_ptr<Parameter> parameter);
				std::shared_ptr<Parameter> GetParameter(int parameterId);
				bool Contains(int parameterId) const;

				virtual void Serialize(std::string* output) const override;
				virtual void Deserialize(const std::string& data) override;

				void FillParameters(ParameterContainerPb* container) const;
				void ReadParameters(const ParameterContainerPb& container);

			protected:
				std::map<int, std::shared_ptr<Parameter>> _parameters;
			private:
				void FillParameter(Parameter &parameterValue, ParameterValuePb &output) const;
				void ReadParameter(const ParameterValuePb &parameterValue, Parameter &output) const;
			};
		}
	}
}
#endif // OpenTestSystem_OtxDiagManager_Common_ParameterContainerData_H
