struct EndScreenData
{
	var unlockedPrograms : array< ProgramData >;
	var outcome : OutcomeMessage;
}

enum OutcomeMessage
{
	Success = 0,
	Failure = 1,
}

class NetworkMinigameEndScreenController extends inkLogicController
{
	protected editable var m_outcomeText : inkTextRef;
	protected editable var m_finishBarContainer : weak< NetworkMinigameProgramController >;
	protected editable var m_programsListContainer : inkWidgetRef;
	protected editable var m_programLibraryName : CName;
	protected var m_slotList : array< weak< NetworkMinigameProgramController > >;
	protected var m_endData : EndScreenData;
	protected editable var m_closeButton : inkWidgetRef;
	protected editable var header_bg : inkWidgetRef;
	protected editable var m_completionColor : Color;
	protected editable var m_failureColor : Color;

	public function SetUp( const endData : ref< EndScreenData > )
	{
		var slotLogic : weak< NetworkMinigameProgramController >;
		var slot : weak< inkWidget >;
		var i : Int32;
		m_endData = endData;
		if( endData.outcome == OutcomeMessage.Success )
		{
			inkWidgetRef.SetTintColor( header_bg, m_completionColor );
			inkTextRef.SetText( m_outcomeText, "UI-Cyberpunk-Fullscreen-HackingMiniGame-AccessGranted" );
		}
		else
		{
			inkTextRef.SetText( m_outcomeText, "UI-Cyberpunk-Fullscreen-HackingMiniGame-AccessDenied" );
			inkWidgetRef.SetTintColor( header_bg, m_failureColor );
		}
		for( i = 0; i < endData.unlockedPrograms.Size(); i += 1 )
		{
			slot = SpawnFromLocal( inkWidgetRef.Get( m_programsListContainer ), m_programLibraryName );
			slotLogic = ( ( NetworkMinigameProgramController )( slot.GetController() ) );
			slotLogic.Spawn( endData.unlockedPrograms[ i ] );
			m_slotList.PushBack( slotLogic );
		}
	}

	public function GetCloseButtonRef() : inkWidgetRef
	{
		return m_closeButton;
	}

}

