#pragma once

#include "resource.h"
#include "chain.h"
#include "lamp.h"

class Lamp;
//#######################################################################
// GaugeAlarm
//#######################################################################
class GaugeAlarm : public Node
{
	friend class GaugeAlarmManager;

protected:
	GaugeAlarm(Entity *entity, Subsystem *subsystem, Enumeration condition);
	~GaugeAlarm();

public:
	Logical TestInstance() const;
protected:
	Entity *entity;
	Subsystem *subsystem;
	int conditionIndex;
public:
	ChainOf<Lamp*> lampList;		// descendants of GaugeAlarmManager need to see this
};
				 
//#######################################################################
// GaugeAlarmManager
//#######################################################################
class GaugeAlarmManager SIGNATURED
{
	friend class GaugeAlarm;
	friend class GaugeRenderer;
protected:
	GaugeAlarmManager();
public:
	virtual ~GaugeAlarmManager();
	//--------------------------------------------------------------------
	// Resource methods
	//--------------------------------------------------------------------
public:
	ResourceDescription::ResourceID CreateModelGaugeAlarmStreamResource(ResourceFile *resource_file, const char *model_name, NotationFile *model_file, const ResourceDirectories * /*directories*/);

	virtual Logical CreateGaugeAlarmStreamItem(MemoryStream *mem_stream, const char *alarm_name, const char *alarm_data);
	virtual void ReadGaugeAlarmStreamItem(GaugeAlarm *alarm, Entity *the_entity, Subsystem *the_subsystem, Enumeration the_condition, MemoryStream *mem_stream);

	void RemoveAllAlarms();
	void Activate(Entity *entity, Subsystem *subsystem, Enumeration condition, ResourceDescription::ResourceID resource_ID);
	void Deactivate(Entity *entity, Subsystem *subsystem, Enumeration condition);

public:
	Logical TestInstance() const;

protected:
	ChainOf<GaugeAlarm*> gaugeAlarmList;
};