//----------------------------------------------------------------------------------
// <copyright file="AlarmMessage.h" company="LiquidRobotics">
//	Copyright (c) Liquid Robotics Corporation.  All rights reserved.
// </copyright>
//
// <summary>
//	Alarm message definition to send telemetry.
// </summary>
//
// <owner>Andrew Trapani</owner>
//----------------------------------------------------------------------------------

//#ifndef __PayloadInterfaceLib_AlarmMessage_H__
//#define __PayloadInterfaceLib_AlarmMessage_H__

#ifndef __EventLib_AlarmMessage_H__
#define __EventLib_AlarmMessage_H__

#include "TelemetryEventBase.h"
#include "LqrSMACSharedLib.h"
#include "LqrSMACByteArray.h"
#include <string>
#include <sys/time.h>

namespace LiquidRobotics {
enum alarmTypes {
	alarmCleared_AT = 0,
	alarmSet_AT = 1,
	alarmEvent_AT = 2,
	nonAlarmEvent_AT = 3
};
namespace EventLib {

class SHARED_LIB_PUBLIC AlarmMessage : public TelemetryEventBase
{
public:
	typedef TelemetryEventBase Base;
	typedef ::LiquidRobotics::EventLib::EventName EventName;
	typedef ::LiquidRobotics::EventLib::EventType EventType;
	typedef ::LiquidRobotics::EventLib::IOR IOR;
	typedef boost::shared_ptr<AlarmMessage> Ptr;
	typedef std::string string;
	typedef std::vector<string> StringArray;
	typedef LiquidRobotics::SMACFramework::ByteArray ByteArray;
	typedef LiquidRobotics::SMACFramework::ByteArrayPtr ByteArrayPtr;

	/* Alarm Reporter Settings allows users to set a reporter Type Id by configuration.
	 * SMC software starts at 1000, as defined in the ICD ship to shore.
	 * Email any changes to ehud.prado@liquidr.com
	 */
	static const int payloadReporterTypeMinimum = 1000; //Payload starts at 1000

	AlarmMessage(IObjectBroker& _broker);
	AlarmMessage(const EventSettings& _eventSettings, IObjectBroker& _broker);
	AlarmMessage(const EventName& _eventName, const EventType& _eventType, IObjectBroker& _broker);
	AlarmMessage(const EventName& _eventName, const EventType& _eventType, const IOR& _senderIOR, IObjectBroker& _broker);
	AlarmMessage(const AlarmMessage& other);

	virtual ostream& Describe(ostream& stm) const;
	virtual IEventBase::Ptr Duplicate() const;

	void SetAlarmMessage(const int reporterTypeId, const alarmTypes alarmType, const int enumerationType,
			const int notificationId, const string& freeText, const ByteArray& freeData);
	void SetReporterTypeId(const int& reporterTypeId);
	void SetAlarmType(const int& alarmType);
	void SetEnumerationType(const int& enumerationType);
	void SetNotificationId(const int& notificationId);
	void SetFreeTextLength(const int& newValue);
	void SetFreeText(const string& freeText);
	void SetFreeDataLength(const int& newValue);
	void SetFreeData(const ByteArray& freeData);

	int GetReporterTypeId() const;
	int GetAlarmType() const;
	int GetEnumerationType() const;
	int GetNotificationId() const;
	string GetFreeText() const;
	ByteArrayPtr GetFreeData() const;

	bool HasReporterTypeId() const;
	bool HasAlarmType() const;
	bool HasEnumerationType() const;
	bool HasNotificationId() const;
	bool HasFreeText() const;
	bool HasFreeData() const;

private:

	static const PropertyNameType reporterTypeIdTag;
	static const PropertyNameType alarmTypeTag;
	static const PropertyNameType enumerationTypeTag;
	static const PropertyNameType notificationIdTag;
	static const PropertyNameType freeTextLengthTag;
	static const PropertyNameType freeTextTag;
	static const PropertyNameType freeDataLengthTag;
	static const PropertyNameType freeDataTag;
};

}
}


#endif
