class NetrunnerControlPanelController extends BasicDistractionDeviceController
{

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

}

class NetrunnerControlPanelControllerPS extends BasicDistractionDeviceControllerPS
{
	private instanceeditable var m_factQuickHackSetup : ComputerQuickHackData;
	private persistent var m_quickhackPerformed : Bool;

	protected const override function CanCreateAnyQuickHackActions() : Bool
	{
		if( super.CanCreateAnyQuickHackActions() || ( IsNameValid( m_factQuickHackSetup.factName ) && !( m_quickhackPerformed ) ) )
		{
			return true;
		}
		else
		{
			return false;
		}
	}

	protected override function GetQuickHackActions( out actions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		var currentAction : ScriptableDeviceAction;
		if( IsNameValid( m_factQuickHackSetup.factName ) && !( m_quickhackPerformed ) )
		{
			currentAction = ActionCreateFactQuickHack();
			currentAction.SetObjectActionID( T"DeviceAction.MalfunctionClassHack" );
			currentAction.SetInactiveWithReason( !( IsDistracting() ), "LocKey#7004" );
			actions.PushBack( currentAction );
		}
		super.GetQuickHackActions( actions, context );
	}

	protected function ActionCreateFactQuickHack() : FactQuickHack
	{
		var action : FactQuickHack;
		action = new FactQuickHack;
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.SetProperties( m_factQuickHackSetup );
		if( TDBID.IsValid( m_factQuickHackSetup.alternativeName ) )
		{
			action.CreateInteraction( , , m_factQuickHackSetup.alternativeName );
		}
		else
		{
			action.CreateInteraction();
		}
		return action;
	}

	public function OnCreateFactQuickHack( evt : FactQuickHack ) : EntityNotificationType
	{
		m_quickhackPerformed = true;
		return EntityNotificationType.SendThisEventToEntity;
	}

}

