//---------------------------------------------------------------------------------
// <copyright file="VirtualRelayProgramSettings.cpp" company="LiquidRobotics">
//
// Copyright (c) 2014 Liquid Robotics, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This software is associated with a release.  Liquid Robotics makes no
// representation that the design, interfaces or component distribution will
// remain unchanged in future releases.
//
// </copyright>
//
// <summary>
// 	Implementation of VirtualRelayProgramSettings class, a serializable entity that
//  holds the various settings for the VirtualRelayProgram class
// </summary>
//
// <owner>Arash Ushani</owner>
//---------------------------------------------------------------------------------

#include "VirtualRelayProgramSettings.h"
#include "LqrSMACLoadSaveBoostXml.h"

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

namespace LiquidRobotics {
namespace VirtualRelay {

VirtualRelayProgramSettings::VirtualRelayProgramSettings()
: serverName("VirtualRelay")
, serverKind("")
, FCCIncomingMessageEvent("FCCIncomingMessage", "FCCMessageEvent", "LiquidR-SMC")
, FCCOutgoingMessageEvent("FCCOutgoingMessage", "FCCMessageEvent", "LiquidR-SMC")
, channelStateEvent("ChannelState", "ChannelStateEvent", "LiquidR-SMC")
, requestEvent("ChannelRequest", "ChannelRequestEvent", "LiquidR-SMC")
, shutdownEvent("Shutdown", "EventBase", "LiquidR-SMC")
{
}

VirtualRelayProgramSettings::VirtualRelayProgramSettings(const VirtualRelayProgramSettings& rhs)
: serverName(rhs.serverName)
, serverKind(rhs.serverKind)
, controllerSettings(rhs.controllerSettings)
, loggerSettings(rhs.loggerSettings)
, FCCIncomingMessageEvent(rhs.FCCIncomingMessageEvent)
, FCCOutgoingMessageEvent(rhs.FCCOutgoingMessageEvent)
, channelStateEvent(rhs.channelStateEvent)
, requestEvent(rhs.requestEvent)
, shutdownEvent(rhs.shutdownEvent)
, eventTransceiverSettings(rhs.eventTransceiverSettings)
, payloadManagerClientSettings(rhs.payloadManagerClientSettings)
{
}

const string& VirtualRelayProgramSettings::GetServerName() const
{
	return serverName;
}

void VirtualRelayProgramSettings::SetServerName(const string& newValue)
{
	serverName = newValue;
}

const string& VirtualRelayProgramSettings::GetServerKind() const
{
	return serverKind;
}

void VirtualRelayProgramSettings::SetServerKind(const string& newValue)
{
	serverKind = newValue;
}

const VirtualRelayProgramSettings::StdOutLoggerSettings& VirtualRelayProgramSettings::GetLoggerSettings() const
{
	return loggerSettings;
}

void VirtualRelayProgramSettings::SetLoggerSettings(const StdOutLoggerSettings& newValue)
{
	loggerSettings = newValue;
}

const VirtualRelayProgramSettings::EventSettings& VirtualRelayProgramSettings::GetFCCIncomingMessageEvent() const
{
	return FCCIncomingMessageEvent;
}

void VirtualRelayProgramSettings::SetFCCIncomingMessageEvent(const EventSettings& newValue)
{
	FCCIncomingMessageEvent = newValue;
}

const VirtualRelayProgramSettings::EventSettings& VirtualRelayProgramSettings::GetFCCOutgoingMessageEvent() const
{
	return FCCOutgoingMessageEvent;
}

void VirtualRelayProgramSettings::SetFCCOutgoingMessageEvent(const EventSettings& newValue)
{
	FCCOutgoingMessageEvent = newValue;
}

const VirtualRelayProgramSettings::EventSettings& VirtualRelayProgramSettings::GetChannelStateEvent() const
{
	return channelStateEvent;
}

void VirtualRelayProgramSettings::SetChannelStateEvent(const EventSettings& newValue)
{
	channelStateEvent = newValue;
}

const VirtualRelayProgramSettings::EventSettings& VirtualRelayProgramSettings::GetRequestEvent() const
{
	return requestEvent;
}

void VirtualRelayProgramSettings::SetRequestEvent(const EventSettings& newValue)
{
	requestEvent = newValue;
}

const VirtualRelayProgramSettings::EventSettings& VirtualRelayProgramSettings::GetShutdownEvent() const
{
	return shutdownEvent;
}

void VirtualRelayProgramSettings::SetShutdownEvent(const EventSettings& newValue)
{
	shutdownEvent = newValue;
}

VirtualRelayProgramSettings::ControllerSettingsList& VirtualRelayProgramSettings::GetControllerSettings()
{
	return controllerSettings;
}

void VirtualRelayProgramSettings::SetControllerSettings(const ControllerSettingsList& newValue)
{
	controllerSettings = newValue;
}

const EventTransceiverSettings& VirtualRelayProgramSettings::GetEventTransceiverSettings() const
{
	return eventTransceiverSettings;
}

void VirtualRelayProgramSettings::SetEventTransceiverSettings(const EventTransceiverSettings& newValue)
{
	eventTransceiverSettings = newValue;
}

const PayloadManagerClientSettings& VirtualRelayProgramSettings::GetPayloadManagerClientSettings() const
{
	return payloadManagerClientSettings;
}

void VirtualRelayProgramSettings::SetPayloadManagerClientSettings(const PayloadManagerClientSettings& newValue)
{
	payloadManagerClientSettings = newValue;
}

void VirtualRelayProgramSettings::Load(const string& fileName)
{
	LoadBoostXml(fileName, *this);
}

void VirtualRelayProgramSettings::Save(const string& fileName) const
{
	SaveBoostXml(fileName, *this);
}

}
}
