class MenuScenario_Vendor extends MenuScenario_BaseMenu
{

	protected event OnEnterScenario( prevScenario : CName, userData : IScriptable )
	{
		OpenMenu( 'vendor_hub_menu', userData, ScreenDisplayContext.Vendor );
	}

	protected event OnLeaveScenario( nextScenario : CName )
	{
		if( m_currMenuName != '' )
		{
			GetMenusState().DispatchEvent( m_currMenuName, 'OnBeforeLeaveScenario' );
			m_currMenuName = '';
		}
		super.OnLeaveScenario( nextScenario );
	}

	protected event OnSwitchToVendor( optional userData : IScriptable )
	{
		SwitchMenu( 'fullscreen_vendor', userData, ScreenDisplayContext.Vendor );
	}

	protected event OnSwitchToRipperDoc( optional userData : IScriptable )
	{
		SwitchMenu( 'ripperdoc', userData, ScreenDisplayContext.Vendor );
	}

	protected event OnSwitchToCrafting( optional userData : IScriptable )
	{
		SwitchMenu( 'crafting_main', userData, ScreenDisplayContext.Vendor );
	}

	protected event OnSwitchToCharacter( optional userData : IScriptable )
	{
		var perkUserData : PerkUserData;
		SwitchMenu( 'new_perks', userData, ScreenDisplayContext.Vendor );
		perkUserData = ( ( PerkUserData )( userData ) );
		if( perkUserData.cyberwareScreenType == CyberwareScreenType.Ripperdoc )
		{
			GetMenusState().DispatchEvent( 'vendor_hub_menu', 'SwitchToCharacterFromRipperdoc' );
		}
	}

	protected event OnSwitchToInventory( optional userData : IScriptable )
	{
		SwitchMenu( 'inventory_screen', userData );
	}

	protected event OnRefreshCurrentTab()
	{
		GetMenusState().DispatchEvent( 'vendor_hub_menu', 'RefreshCurrentTab' );
	}

	protected event OnVendorClose()
	{
		GotoIdleState();
	}

	protected override function GotoIdleState()
	{
		GetMenusState().DispatchEvent( 'vendor_hub_menu', 'OnBack' );
		SwitchToScenario( 'MenuScenario_Idle' );
	}

	protected event OnCloseHubMenuRequest()
	{
		GotoIdleState();
	}

	protected event OnTutorialComplete()
	{
		GetMenusState().DispatchEvent( 'vendor_hub_menu', 'TutorialComplete' );
	}

	protected event OnEquipAnimationDataUpdate( userData : IScriptable )
	{
		GetMenusState().DispatchEvent( 'vendor_hub_menu', 'EquipAnimationDataUpdate', userData );
	}

}

class VendorUserData extends IScriptable
{
	var vendorData : VendorPanelData;
	var menu : String;
}

