//-------------------------------------------------------------------------------------------------
// <copyright file="AlarmReporterSettings.cpp" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved.
// </copyright>
//
// <summary>
// 	Implementation of AlarmReporterSettings, a serializable entity that holds the
//  settings for an alarm's unique "reporter type ID" and name.
// </summary>
//
// <owner>Andrew Trapani</owner>
//-------------------------------------------------------------------------------------------------

#include "AlarmReporterSettings.h"
#include "LqrSMACLoadSaveBoostXml.h"

using namespace std;
using namespace LiquidRobotics::SMACFramework;
using namespace LiquidRobotics::EventLib;

namespace LiquidRobotics {
namespace EventLib {


AlarmReporterSettings::AlarmReporterSettings()
: reporterTypeId(0)
, reporterName("")
, minTimeBetweenOneTimeAlarmsMinutes(0)
{
}

AlarmReporterSettings::AlarmReporterSettings(const AlarmReporterSettings& rhs)
: reporterTypeId(rhs.reporterTypeId)
, reporterName(rhs.reporterName)
, minTimeBetweenOneTimeAlarmsMinutes(rhs.minTimeBetweenOneTimeAlarmsMinutes)
{
}

AlarmReporterSettings& AlarmReporterSettings::operator=(const AlarmReporterSettings& rhs)
{
	if (this != &rhs)
	{
		reporterTypeId = rhs.reporterTypeId;
		reporterName = rhs.reporterName;
		minTimeBetweenOneTimeAlarmsMinutes = rhs.minTimeBetweenOneTimeAlarmsMinutes;
	}

	return *this;
}

const int AlarmReporterSettings::GetReporterTypeId() const {
	return reporterTypeId;
}

void AlarmReporterSettings::SetReporterTypeId(const int newValue) {
	reporterTypeId = newValue;
}

const string AlarmReporterSettings::GetReporterName() const {
	return reporterName;
}

void AlarmReporterSettings::SetReporterName(const string newValue) {
	reporterName = newValue;
}

const unsigned int AlarmReporterSettings::GetMinTime() const {
	return minTimeBetweenOneTimeAlarmsMinutes;
}

void AlarmReporterSettings::SetMinTime(const unsigned int newValue) {
	minTimeBetweenOneTimeAlarmsMinutes = newValue;
}

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

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

}
}
