class DeviceThumbnailWidgetControllerBase extends DeviceButtonLogicControllerBase
{
	default selectable = true;
	[ category = "Widget Refs" ]
	protected editable var m_deviceIconRef : inkImageRef;
	[ category = "Widget Refs" ]
	protected editable var m_statusNameWidget : inkTextRef;
	private var m_thumbnailAction : weak< ThumbnailUI >;

	public virtual function Initialize( gameController : DeviceInkGameControllerBase, const widgetData : ref< SThumbnailWidgetPackage > )
	{
		RegisterThumbnailActionCallback( gameController );
		inkTextRef.SetLocalizedTextScript( m_statusNameWidget, widgetData.deviceStatus );
		inkTextRef.SetTextParameters( m_statusNameWidget, widgetData.textData );
		inkTextRef.SetLocalizedTextScript( m_displayNameWidget, widgetData.displayName );
		if( TDBID.IsValid( widgetData.iconTextureID ) )
		{
			SetTexture( m_deviceIconRef, widgetData.iconTextureID );
			inkImageRef.SetAnchor( m_deviceIconRef, inkEAnchor.Fill );
		}
		else
		{
			inkImageRef.SetVisible( m_deviceIconRef, false );
		}
		if( widgetData.widgetState == EWidgetState.ALLOWED )
		{
			inkTextRef.SetState( m_statusNameWidget, 'Allowed' );
			inkTextRef.SetState( m_displayNameWidget, 'Allowed' );
		}
		else if( widgetData.widgetState == EWidgetState.LOCKED )
		{
			inkTextRef.SetState( m_statusNameWidget, 'Locked' );
			inkTextRef.SetState( m_displayNameWidget, 'Locked' );
		}
		else if( widgetData.widgetState == EWidgetState.SEALED )
		{
			inkTextRef.SetState( m_statusNameWidget, 'Sealed' );
			inkTextRef.SetState( m_displayNameWidget, 'Sealed' );
		}
		SetAction( widgetData.thumbnailAction );
		m_isInitialized = true;
	}

	public function SetAction( action : weak< ThumbnailUI > )
	{
		m_thumbnailAction = action;
	}

	public function GetAction() : weak< ThumbnailUI >
	{
		return m_thumbnailAction;
	}

	protected function RegisterThumbnailActionCallback( gameController : DeviceInkGameControllerBase )
	{
		if( !( m_isInitialized ) )
		{
			m_targetWidget.RegisterToCallback( 'OnRelease', gameController, 'OnThumbnailActionCallback' );
			RegisterAudioCallbacks( gameController );
		}
	}

}

