//-------------------------------------------------------------------------------------------------
// <copyright file="EncryptedStartupSettings.h" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved. 
// </copyright>
//
// <summary>
// </summary>
//
// <owner></owner>
//-------------------------------------------------------------------------------------------------

#ifndef __ENCRYPTEDSTARTUPSETTINGS_H__
#define __ENCRYPTEDSTARTUPSETTINGS_H__

#include "LqrSMACSerialPortSettings.h"
#include "PayloadMessage.h"
#include <stdint.h>

namespace LiquidRobotics {
namespace EncryptedStartup {

class EncryptedStartupSettings
{
public:

	typedef LiquidRobotics::PayloadInterface::PayloadMessage PayloadMessage;
	typedef LiquidRobotics::SMACFramework::SerialPortSettings SerialPortSettings;
	typedef std::string string;

	EncryptedStartupSettings();
	virtual ~EncryptedStartupSettings();

	PayloadMessage::BoardID GetBoardID() const;
	PayloadMessage::BoardAddress GetBoardAddress() const;
	const string& GetDateVerb() const;
	string GetDateVerbGMT(int year, int month, int day, int hour, int minute, int second) const;
	const string& GetDescription() const;
	uint16_t GetDeviceType() const;
	bool GetEchoedAcksRequested() const;
	bool GetEventsRequested() const;
	uint8_t GetFirmwareMajor() const;
	uint8_t GetFirmwareMinor() const;
	uint16_t GetFirmwareRev() const;
	uint32_t GetPollingRate() const;
	const SerialPortSettings& GetPortSettings() const;
	bool GetPowerNotificationRequested() const;
	const uint8_t GetPowerOffDelay() const;
	const uint8_t GetPowerOnDelay() const;
	const string& GetSerialNum() const;
	const string& GetServerName() const;
	const string& GetShutdownVerb() const;
	PayloadMessage::BoardID GetTaskID() const;
	bool GetTelemetryRequested() const;

	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(boardAddress);
		ar & BOOST_SERIALIZATION_NVP(dateVerb);
		ar & BOOST_SERIALIZATION_NVP(description);
		ar & BOOST_SERIALIZATION_NVP(deviceType);
		ar & BOOST_SERIALIZATION_NVP(echoedAcksRequested);
		ar & BOOST_SERIALIZATION_NVP(eventsRequested);
		ar & BOOST_SERIALIZATION_NVP(firmwareMajor);
		ar & BOOST_SERIALIZATION_NVP(firmwareMinor);
		ar & BOOST_SERIALIZATION_NVP(firmwareRev);
		ar & BOOST_SERIALIZATION_NVP(pollingRate);
		ar & BOOST_SERIALIZATION_NVP(portSettings);
		ar & BOOST_SERIALIZATION_NVP(powerNotificationRequested);
		ar & BOOST_SERIALIZATION_NVP(powerOffDelay);
		ar & BOOST_SERIALIZATION_NVP(powerOnDelay);
		ar & BOOST_SERIALIZATION_NVP(serverName);
		ar & BOOST_SERIALIZATION_NVP(shutdownVerb);
		ar & BOOST_SERIALIZATION_NVP(telemetryRequested);
	}

	PayloadMessage::BoardAddress boardAddress;
	string dateVerb;
	string description;
	uint16_t deviceType;
	bool echoedAcksRequested;
	bool eventsRequested;
	uint8_t firmwareMajor;
	uint8_t firmwareMinor;
	uint16_t firmwareRev;
	uint32_t pollingRate;
	bool powerNotificationRequested;
	uint8_t powerOffDelay;
	uint8_t powerOnDelay;
	string serialNum;
	string serverName;
	string shutdownVerb;
	SerialPortSettings portSettings;
	bool telemetryRequested;
};

}
}

#endif
