//-----------------------------------------------------------------------------------
// <copyright file="ConnectionManagerProgramSettings.h" 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>
// 	Declaration of ConnectionManagerProgramSettings class, a serializable entity that
//  holds the various settings for the ConnectionManagerProgramclass
// </summary>
//
// <owner>Arash Ushani</owner>
//-----------------------------------------------------------------------------------

#ifndef __ConnectionManagerProgramSettings_H__
#define __ConnectionManagerProgramSettings_H__

#include "ConnectionManagerChannelSettings.h"
#include "LqrSMACSharedLib.h"
#include "LqrSMACStdOutLoggerSettings.h"
#include "LqrSMACFileSetSettings.h"
#include "EventSettings.h"
#include "EventTransceiver.h"
#include "PayloadManagerClientSettings.h"
#include <string>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/vector.hpp>

namespace LiquidRobotics {
namespace ConnectionManager {

class SHARED_LIB_PUBLIC ConnectionManagerProgramSettings
{
public:

	typedef std::vector<ConnectionManagerChannelSettings> ChannelSettingsList;
	typedef LiquidRobotics::EventLib::EventSettings EventSettings;
	typedef LiquidRobotics::EventLib::EventTransceiver::Settings EventTransceiverSettings;
	typedef LiquidRobotics::EventLib::PayloadManagerClientSettings PayloadManagerClientSettings;
	typedef LiquidRobotics::SMACFramework::StdOutLoggerSettings StdOutLoggerSettings;
	typedef std::string string;

	ConnectionManagerProgramSettings();
	ConnectionManagerProgramSettings(const ConnectionManagerProgramSettings& rhs);

	const string& GetServerName() const;
	void SetServerName(const string& newValue);

	const string& GetServerKind() const;
	void SetServerKind(const string& newValue);

	const ChannelSettingsList& GetChannelSettings() const;
	void SetChannelSettings(const ChannelSettingsList& newValue);

	//const ConnectionManagerChannelSettings& GetRUDICSSettings() const;
	//void SetRUDICSSettings(const ConnectionManagerChannelSettings& newValue);

	const StdOutLoggerSettings& GetLoggerSettings() const;
	void SetLoggerSettings(const StdOutLoggerSettings& newValue);

	const EventSettings& GetChannelStateEvent() const;
	void SetChannelStateEvent(const EventSettings& newValue);

	const EventSettings& GetChannelRequestEvent() const;
	void SetChannelRequestEvent(const EventSettings& newValue);

	const EventSettings& GetShutdownEvent() const;
	void SetShutdownEvent(const EventSettings& newValue);

	const EventTransceiverSettings& GetEventTransceiverSettings() const;
	void SetEventTransceiverSettings(const EventTransceiverSettings& newValue);

	const PayloadManagerClientSettings& GetPayloadManagerClientSettings() const;
	void SetPayloadManagerClientSettings(const PayloadManagerClientSettings& newValue);

	void Load(const string& fileName);
	void Save(const string& fileName) const;

private:

	friend class boost::serialization::access;

	template<class Archive>
	void serialize(Archive & ar, const unsigned int version)
	{
		ar & BOOST_SERIALIZATION_NVP(serverName);
		ar & BOOST_SERIALIZATION_NVP(serverKind);
		ar & BOOST_SERIALIZATION_NVP(channelSettings);
		ar & BOOST_SERIALIZATION_NVP(loggerSettings);
		ar & BOOST_SERIALIZATION_NVP(channelStateEvent);
		ar & BOOST_SERIALIZATION_NVP(channelRequestEvent);
		ar & BOOST_SERIALIZATION_NVP(shutdownEvent);
		ar & BOOST_SERIALIZATION_NVP(eventTransceiverSettings);
		ar & BOOST_SERIALIZATION_NVP(payloadManagerClientSettings);
	}

	string serverName;
	string serverKind;
	ChannelSettingsList channelSettings;
	//ConnectionManagerChannelSettings RUDICSSettings;
	StdOutLoggerSettings loggerSettings;
	EventSettings channelStateEvent;
	EventSettings channelRequestEvent;
	EventSettings shutdownEvent;
	EventTransceiverSettings eventTransceiverSettings;
	PayloadManagerClientSettings payloadManagerClientSettings;
};

}
}

BOOST_CLASS_VERSION(LiquidRobotics::ConnectionManager::ConnectionManagerProgramSettings, 1)

#endif
