//-------------------------------------------------------------------------------------------------
// <copyright file="AlarmSettings.h" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved.
// </copyright>
//
// <summary>
// 	Declarations for AlarmSettings, a serializable entity that holds the
//  settings for the general alarm class.
// </summary>
//
// <owner>Andrew Trapani</owner>
//-------------------------------------------------------------------------------------------------


#ifndef __EVENTLIB_ALARMSETTINGS_H__
#define __EVENTLIB_ALARMSETTINGS_H__

#include "LqrSMACSharedLib.h"
#include "EventSettings.h"
#include "AlarmReporterSettings.h"
#include <string>
#include <boost/serialization/access.hpp>
#include <boost/serialization/map.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/version.hpp>

namespace LiquidRobotics {
namespace EventLib {

class SHARED_LIB_PUBLIC AlarmSettings
{
public:

	typedef std::string string;
	typedef LiquidRobotics::EventLib::EventSettings EventSettings;

	AlarmSettings();
	AlarmSettings(const AlarmSettings& rhs);

	AlarmSettings& operator=(const AlarmSettings& rhs);

	const EventSettings& GetEventSettings() const;
	void SetEventSettings(const EventSettings& newValue);

	const AlarmReporterSettings& GetAlarmReporterSettings() const;
	void SetAlarmReporterSettings(const AlarmReporterSettings& newValue);

	void Load(const string& fileName, bool withMD5 = false);
	void Save(const string& fileName, bool withMD5 = false) const;

private:

	friend class boost::serialization::access;

	template<class Archive>
	void load(Archive & ar, const unsigned int version)
	{
		ar & BOOST_SERIALIZATION_NVP(rawDataEventSettings);
		if (version > 1) { ar & BOOST_SERIALIZATION_NVP(alarmReporterSettings); }
	}

	template<class Archive>
	void save(Archive & ar, const unsigned int version) const
	{
		ar & BOOST_SERIALIZATION_NVP(rawDataEventSettings);
		if (version > 1) { ar & BOOST_SERIALIZATION_NVP(alarmReporterSettings); }
	}

	BOOST_SERIALIZATION_SPLIT_MEMBER()

	EventSettings rawDataEventSettings;
	AlarmReporterSettings alarmReporterSettings;
};

}
}

BOOST_CLASS_VERSION(LiquidRobotics::EventLib::AlarmSettings, 2)

#endif
