enum EViabilityDecision
{
	INCONCLUSIVE = 0,
	VIABLE = 1,
	NONVIABLE = 2,
}

class BasicViabilityInterpreter
{

	public static function Evaluate( device : ScriptableDeviceComponentPS, hasActiveActions : Bool ) : EViabilityDecision
	{
		if( hasActiveActions )
		{
			return EViabilityDecision.VIABLE;
		}
		if( device.IsDisabled() )
		{
			return EViabilityDecision.NONVIABLE;
		}
		if( device.IsMarkedAsQuest() )
		{
			return EViabilityDecision.VIABLE;
		}
		return EViabilityDecision.INCONCLUSIVE;
	}

}

class SurveillanceCameraViabilityInterpreter
{

	public static function Evaluate( device : SurveillanceCameraControllerPS, hasActiveActions : Bool ) : Bool
	{
		var basicCheckResult : EViabilityDecision;
		basicCheckResult = BasicViabilityInterpreter.Evaluate( device, hasActiveActions );
		if( basicCheckResult == EViabilityDecision.VIABLE )
		{
			return true;
		}
		if( basicCheckResult == EViabilityDecision.NONVIABLE )
		{
			return false;
		}
		if( device.IsUnpowered() )
		{
			return false;
		}
		if( device.IsQuickHacksExposed() )
		{
			return true;
		}
		return false;
	}

}

class MasterViabilityInterpreter
{

	public static function Evaluate( device : MasterControllerPS, hasActiveActions : Bool ) : Bool
	{
		if( device.IsDisabled() || device.IsUnpowered() )
		{
			return false;
		}
		return true;
	}

}

class TVViabilityInterpreter
{

	public static function Evaluate( device : MediaDeviceControllerPS, hasActiveActions : Bool ) : Bool
	{
		var basicCheckResult : EViabilityDecision;
		basicCheckResult = BasicViabilityInterpreter.Evaluate( device, hasActiveActions );
		if( basicCheckResult == EViabilityDecision.VIABLE )
		{
			return true;
		}
		if( basicCheckResult == EViabilityDecision.NONVIABLE )
		{
			return false;
		}
		if( device.IsDisabled() || device.IsUnpowered() )
		{
			return false;
		}
		return true;
	}

}

class RadioViabilityInterpreter
{

	public static function Evaluate( device : RadioControllerPS, hasActiveActions : Bool ) : Bool
	{
		var basicCheckResult : EViabilityDecision;
		basicCheckResult = BasicViabilityInterpreter.Evaluate( device, hasActiveActions );
		if( basicCheckResult == EViabilityDecision.VIABLE )
		{
			return true;
		}
		if( basicCheckResult == EViabilityDecision.NONVIABLE )
		{
			return false;
		}
		return false;
	}

}

class DoorViabilityInterpreter
{

	public static function Evaluate( device : DoorControllerPS, hasActiveActions : Bool ) : Bool
	{
		var basicCheckResult : EViabilityDecision;
		basicCheckResult = BasicViabilityInterpreter.Evaluate( device, hasActiveActions );
		if( device.IsOpen() )
		{
			return false;
		}
		if( basicCheckResult == EViabilityDecision.VIABLE )
		{
			return true;
		}
		if( basicCheckResult == EViabilityDecision.NONVIABLE )
		{
			return false;
		}
		if( device.GetDoorType() == EDoorType.REMOTELY_CONTROLLED )
		{
			return false;
		}
		if( device.IsSealed() || device.IsLocked() )
		{
			return false;
		}
		if( device.IsUnpowered() )
		{
			return false;
		}
		return true;
	}

}

class ElevatorFloorViabilityInterpreter
{

	public static function Evaluate( device : DoorControllerPS, hasActiveActions : Bool ) : Bool
	{
		var basicCheckResult : EViabilityDecision;
		basicCheckResult = BasicViabilityInterpreter.Evaluate( device, hasActiveActions );
		if( basicCheckResult == EViabilityDecision.VIABLE )
		{
			return true;
		}
		if( basicCheckResult == EViabilityDecision.NONVIABLE )
		{
			return false;
		}
		if( device.GetDoorType() == EDoorType.AUTOMATIC )
		{
			return false;
		}
		return true;
	}

}

class SmartWindowViabilityInterpreter
{

	public static function Evaluate( device : SmartWindowControllerPS, hasActiveActions : Bool ) : Bool
	{
		if( device.IsOFF() )
		{
			return true;
		}
		return false;
	}

}

