struct WeakFenceSetup
{
	instanceeditable var m_hasGenericInteraction : Bool;
	default m_hasGenericInteraction = false;
}

class WeakFenceController extends ScriptableDeviceComponent
{

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

}

class WeakFenceControllerPS extends ScriptableDeviceComponentPS
{
	default m_deviceName = "LocKey#189";
	default m_tweakDBRecord = T"Devices.WeakFence";
	default m_tweakDBDescriptionRecord = T"device_descriptions.WeakFence";
	default m_shouldScannerShowNetwork = false;
	default m_shouldScannerShowStatus = false;
	default m_shouldScannerShowRole = true;
	instanceeditable inlined var m_weakfenceSkillChecks : EngDemoContainer;
	protected instanceeditable persistent var m_weakFenceSetup : WeakFenceSetup;

	protected override function GetSkillCheckContainerForSetup() : BaseSkillCheckContainer
	{
		if( !( m_weakFenceSetup.m_hasGenericInteraction ) )
		{
			return m_weakfenceSkillChecks;
		}
		return NULL;
	}

	public override function GetActions( out actions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		super.GetActions( actions, context );
		if( m_weakFenceSetup.m_hasGenericInteraction && !( IsDisabled() ) )
		{
			actions.PushBack( ActionActivateDevice( "BreakWeakFence" ) );
		}
		return true;
	}

	protected override function ActionEngineering( const context : ref< GetActionsContext > ) : ActionEngineering
	{
		var action : ActionEngineering;
		action = super.ActionEngineering( context );
		action.ResetCaption();
		action.CreateInteraction( context.processInitiatorObject, , "BreakWeakFence" );
		return action;
	}

	public override function OnActionEngineering( evt : ActionEngineering ) : EntityNotificationType
	{
		if( !( evt.WasPassed() ) )
		{
			return EntityNotificationType.DoNotNotifyEntity;
		}
		DisableDevice();
		super.OnActionEngineering( evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected function ActionActivateDevice( const interactionName : ref< String > ) : ActivateDevice
	{
		var action : ActivateDevice;
		action = new ActivateDevice;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.CreateActionWidgetPackage();
		action.CreateInteraction( , interactionName );
		return action;
	}

	protected override function OnActivateDevice( evt : ActivateDevice ) : EntityNotificationType
	{
		super.OnActivateDevice( evt );
		DisableDevice();
		return EntityNotificationType.SendThisEventToEntity;
	}

}

