class CloseAd extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'CloseAd';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'Close', true, 'LocKey#274', 'LocKey#274' );
	}

	public constexpr static function IsDefaultConditionMet( device : ScriptableDeviceComponentPS, const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

	public function CreateActionWidgetPackage( const buttonName : ref< String >, optional actions : array< DeviceAction > )
	{
		m_actionWidgetPackage.wasInitalized = true;
		m_actionWidgetPackage.dependendActions = actions;
		m_actionWidgetPackage.libraryPath = GetInkWidgetLibraryPath();
		m_actionWidgetPackage.libraryID = GetInkWidgetLibraryID();
		m_actionWidgetPackage.widgetName = buttonName;
		m_actionWidgetPackage.displayName = buttonName;
		m_actionWidgetPackage.widgetTweakDBID = GetInkWidgetTweakDBID();
		ResolveActionWidgetTweakDBData();
	}

}

class ShowVendor extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'ShowVendor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'ShowVendor', true, 'LocKey#268', 'LocKey#268' );
	}

	public constexpr static function IsDefaultConditionMet( device : ScriptableDeviceComponentPS, const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

	public function CreateActionWidgetPackage( const buttonName : ref< String >, optional actions : array< DeviceAction > )
	{
		m_actionWidgetPackage.wasInitalized = true;
		m_actionWidgetPackage.dependendActions = actions;
		m_actionWidgetPackage.libraryPath = GetInkWidgetLibraryPath();
		m_actionWidgetPackage.libraryID = GetInkWidgetLibraryID();
		m_actionWidgetPackage.widgetName = buttonName;
		m_actionWidgetPackage.displayName = buttonName;
		m_actionWidgetPackage.widgetTweakDBID = GetInkWidgetTweakDBID();
		ResolveActionWidgetTweakDBData();
	}

	public override function GetTweakDBChoiceRecord() : String
	{
		return "ShowVendor";
	}

}

class InteractiveAdController extends ScriptableDeviceComponent
{

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

}

class InteractiveAdControllerPS extends ScriptableDeviceComponentPS
{
	default m_deviceName = "LocKey#197";
	default m_tweakDBRecord = T"Devices.InteractiveAd";
	default m_tweakDBDescriptionRecord = T"device_descriptions.InteractiveAd";
	protected var m_showAd : Bool;
	default m_showAd = false;
	protected var m_showVendor : Bool;
	default m_showVendor = false;
	protected var m_locationAdded : Bool;
	default m_locationAdded = false;

	protected event OnInstantiated()
	{
		super.OnInstantiated();
		if( !( IsStringValid( m_deviceName ) ) )
		{
			m_deviceName = "LocKey#197";
		}
	}

	protected override function Initialize()
	{
		super.Initialize();
	}

	protected function ActionCloseAd( const ButtonName : ref< String > ) : CloseAd
	{
		var action : CloseAd;
		action = new CloseAd;
		action.clearanceLevel = 1;
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		return action;
	}

	protected function ActionShowVendor( const ButtonName : ref< String > ) : ShowVendor
	{
		var action : ShowVendor;
		action = new ShowVendor;
		action.clearanceLevel = 1;
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		action.CreateInteraction();
		return action;
	}

	public override function GetActions( out actions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		if( !( m_locationAdded ) )
		{
			actions.PushBack( ActionShowVendor( "Show vendor" ) );
		}
		else
		{
		}
		if( m_showAd )
		{
		}
		SetActionIllegality( actions, m_illegalActions.regularActions );
		return true;
	}

	public override function GetQuestActions( out outActions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		super.GetQuestActions( outActions, context );
	}

	public function OnCloseAd( evt : CloseAd ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnShowVendor( evt : ShowVendor ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function SetIsReady( value : Bool )
	{
		m_showAd = value;
	}

	public function AddLocation( value : Bool )
	{
		m_locationAdded = value;
	}

	public const override function GetBlackboardDef() : InteractiveDeviceBlackboardDef
	{
		return GetAllBlackboardDefs().InteractiveDeviceBlackboard;
	}

}

