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

#include "AlarmSettings.h"
#include "LqrSMACLoadSaveBoostXml.h"

using namespace std;
using namespace LiquidRobotics::SMACFramework;

namespace LiquidRobotics {
namespace EventLib {

AlarmSettings::AlarmSettings()
: rawDataEventSettings("AlarmMessage", "AlarmMessageEvent", "LiquidR-SMC")
{}

AlarmSettings::AlarmSettings(const AlarmSettings& rhs)
: rawDataEventSettings(rhs.rawDataEventSettings)
, alarmReporterSettings(rhs.alarmReporterSettings)
{}

AlarmSettings& AlarmSettings::operator=(const AlarmSettings& rhs)
{
	if (this != &rhs)
	{
		rawDataEventSettings = rhs.rawDataEventSettings;
		alarmReporterSettings = rhs.alarmReporterSettings;
	}

	return *this;
}

const EventSettings& AlarmSettings::GetEventSettings() const
{
	return rawDataEventSettings;
}

void AlarmSettings::SetEventSettings(const EventSettings& newValue)
{
	rawDataEventSettings = newValue;
}

const AlarmReporterSettings& AlarmSettings::GetAlarmReporterSettings() const {
	return alarmReporterSettings;
}

void AlarmSettings::SetAlarmReporterSettings(const AlarmReporterSettings& newValue) {
	alarmReporterSettings = newValue;
}

void AlarmSettings::Load(const string& fileName, bool withMD5)
{
	if (withMD5)
		LoadBoostXmlMD5(fileName, *this, true);
	else
		LoadBoostXml(fileName, *this);
}

void AlarmSettings::Save(const string& fileName, bool withMD5) const
{
	if (withMD5)
		SaveBoostXmlMD5(fileName, *this, true);
	else
		SaveBoostXml(fileName, *this);
}

}
}
