class AlarmLightController extends ScriptableDeviceComponent
{

	public const override function GetPS() : AlarmLightControllerPS
	{
		return ( ( AlarmLightControllerPS )( GetBasePS() ) );
	}

}

class AlarmLightControllerPS extends BasicDistractionDeviceControllerPS
{
	protected var m_securityAlarmState : ESecuritySystemState;
	default m_securityAlarmState = ESecuritySystemState.SAFE;

	public const function GetAlarmState() : ESecuritySystemState
	{
		return m_securityAlarmState;
	}

	public override function OnQuestForceSecuritySystemSafe( evt : QuestForceSecuritySystemSafe ) : EntityNotificationType
	{
		m_securityAlarmState = ESecuritySystemState.SAFE;
		return EntityNotificationType.SendThisEventToEntity;
	}

	public override function OnQuestForceSecuritySystemArmed( evt : QuestForceSecuritySystemArmed ) : EntityNotificationType
	{
		m_securityAlarmState = ESecuritySystemState.COMBAT;
		WakeUpDevice();
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export override function OnSecurityAlarmBreachResponse( evt : SecurityAlarmBreachResponse ) : EntityNotificationType
	{
		m_securityAlarmState = evt.GetSecurityState();
		if( m_securityAlarmState == ESecuritySystemState.COMBAT )
		{
			WakeUpDevice();
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

	public override function OnSecuritySystemOutput( evt : SecuritySystemOutput ) : EntityNotificationType
	{
		super.OnSecuritySystemOutput( evt );
		m_securityAlarmState = evt.GetCachedSecurityState();
		if( m_securityAlarmState == ESecuritySystemState.COMBAT )
		{
			WakeUpDevice();
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

}

