import class MappinsContainerController extends inkProjectedHUDGameController
{
	protected import var psmVision : gamePSMVision;
	protected import var psmCombat : gamePSMCombat;
	protected import var psmZone : gamePSMZones;

	protected import function GetSpawnContainer() : weak< inkCompoundWidget >;

	public virtual function CreateMappinUIProfile( mappin : weak< IMappin >, mappinVariant : gamedataMappinVariant, customData : MappinControllerCustomData ) : MappinUIProfile
	{
		return MappinUIProfile.None();
	}

}

import class CyberspaceMappinsContainerController extends MappinsContainerController
{

	public export override function CreateMappinUIProfile( mappin : weak< IMappin >, mappinVariant : gamedataMappinVariant, customData : MappinControllerCustomData ) : MappinUIProfile
	{
		switch( mappinVariant )
		{
			case gamedataMappinVariant.CyberspaceObject:
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\cyberspace\cyberspace_object_mappin.inkwidget", T"MappinUISpawnProfile.Always" );
			case gamedataMappinVariant.CyberspaceNPC:
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\cyberspace\cyberspace_object_npc.inkwidget", T"MappinUISpawnProfile.Always" );
		}
		return MappinUIProfile.None();
	}

}

class CyberspaceMappinController extends BaseQuestMappinController
{
	editable var m_image : inkImageRef;

	protected event OnIntro()
	{
		var mappin : weak< IMappin >;
		var texturePart : CName;
		mappin = GetMappin();
		texturePart = StringToName( mappin.GetDisplayName() );
		if( inkImageRef.IsTexturePartExist( m_image, texturePart ) )
		{
			inkImageRef.SetTexturePart( m_image, texturePart );
		}
	}

}

import class WorldMappinsContainerController extends MappinsContainerController
{

	public export override function CreateMappinUIProfile( mappin : weak< IMappin >, mappinVariant : gamedataMappinVariant, customData : MappinControllerCustomData ) : MappinUIProfile
	{
		var defaultWidgetResource : ResRef;
		var defaultRuntimeProfile : TweakDBID;
		var questMappin : weak< QuestMappin >;
		var questAnimationRecord : UIAnimation_Record;
		var stealthMappin : weak< StealthMappin >;
		var gameplayRoleData : GameplayRoleMappinData;
		gameplayRoleData = ( ( GameplayRoleMappinData )( mappin.GetScriptData() ) );
		defaultRuntimeProfile = T"WorldMappinUIProfile.Default";
		defaultWidgetResource = R"base\gameplay\gui\widgets\mappins\quest\default_mappin.inkwidget";
		if( mappin.IsExactlyA( 'gamemappinsStealthMappin' ) )
		{
			stealthMappin = ( ( StealthMappin )( mappin ) );
			if( ( !( stealthMappin.IsCombatNPC() ) && !( stealthMappin.IsPrevention() ) ) && !( stealthMappin.IsDevice() ) )
			{
				return MappinUIProfile.None();
			}
			else
			{
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\stealth\stealth_default_mappin.inkwidget", T"MappinUISpawnProfile.Stealth", T"WorldMappinUIProfile.Stealth" );
			}
		}
		else if( mappin.IsExactlyA( 'gamemappinsStubMappin' ) )
		{
			return MappinUIProfile.None();
		}
		else if( mappin.IsExactlyA( 'gamemappinsRemotePlayerMappin' ) )
		{
			return MappinUIProfile.Create( R"multi\gameplay\gui\widgets\world_mappins\remote_player_mappin.inkwidget", T"MappinUISpawnProfile.Always", defaultRuntimeProfile );
		}
		else if( mappin.IsExactlyA( 'gamemappinsPingSystemMappin' ) )
		{
			return MappinUIProfile.Create( R"multi\gameplay\gui\widgets\world_mappins\pingsystem_mappin.inkwidget", T"MappinUISpawnProfile.Always", defaultRuntimeProfile );
		}
		else if( mappin.IsExactlyA( 'gamemappinsInteractionMappin' ) )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.Interaction" );
		}
		else if( mappin.IsExactlyA( 'gamemappinsPointOfInterestMappin' ) )
		{
			if( MappinUIUtils.IsMappinServicePoint( mappinVariant ) )
			{
				return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.ServicePoint" );
			}
			else if( mappinVariant == gamedataMappinVariant.FixerVariant )
			{
				return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.Fixer" );
			}
			else if( mappinVariant == gamedataMappinVariant.Zzz12_WorldEncounterVariant )
			{
				return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.WorldEncounter", defaultRuntimeProfile );
			}
			else
			{
				return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", defaultRuntimeProfile );
			}
		}
		else if( mappinVariant == gamedataMappinVariant.QuickHackVariant || mappinVariant == gamedataMappinVariant.Zzz12_QuickHackQueueVariant )
		{
			return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\interaction\quick_hack_mappin.inkwidget", T"MappinUISpawnProfile.LongRange", T"WorldMappinUIProfile.QuickHack" );
		}
		else if( mappinVariant == gamedataMappinVariant.Zzz15_QuickHackDurationVariant )
		{
			return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\interaction\quick_hack_duration_mappin.inkwidget", T"MappinUISpawnProfile.LongRange", T"WorldMappinUIProfile.QuickHack" );
		}
		else if( mappinVariant == gamedataMappinVariant.PhoneCallVariant )
		{
			return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\interaction\quick_hack_mappin.inkwidget", T"MappinUISpawnProfile.Always", defaultRuntimeProfile );
		}
		else if( mappinVariant == gamedataMappinVariant.Zzz04_PreventionVehicleVariant )
		{
			return MappinUIProfile.None();
		}
		else if( mappinVariant == gamedataMappinVariant.Zzz11_RoadBlockadeVariant )
		{
			return MappinUIProfile.None();
		}
		else if( mappinVariant == gamedataMappinVariant.VehicleVariant || mappinVariant == gamedataMappinVariant.Zzz03_MotorcycleVariant )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.LongRange", T"WorldMappinUIProfile.Vehicle" );
		}
		else if( gameplayRoleData != NULL )
		{
			if( mappinVariant == gamedataMappinVariant.FocusClueVariant )
			{
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\gameplay\gameplay_mappin.inkwidget", T"MappinUISpawnProfile.Always", T"WorldMappinUIProfile.FocusClue" );
			}
			else if( mappinVariant == gamedataMappinVariant.LootVariant )
			{
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\gameplay\gameplay_mappin.inkwidget", T"MappinUISpawnProfile.Always", T"WorldMappinUIProfile.Loot" );
			}
			else
			{
				return MappinUIProfile.Create( R"base\gameplay\gui\widgets\mappins\gameplay\gameplay_mappin.inkwidget", T"MappinUISpawnProfile.Always", T"WorldMappinUIProfile.GameplayRole" );
			}
		}
		else if( mappinVariant == gamedataMappinVariant.FastTravelVariant )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.FastTravel" );
		}
		else if( mappinVariant == gamedataMappinVariant.Zzz17_NCARTVariant )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.FastTravel" );
		}
		else if( mappinVariant == gamedataMappinVariant.ServicePointDropPointVariant )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.ShortRange", T"WorldMappinUIProfile.DropPoint" );
		}
		else if( mappinVariant == gamedataMappinVariant.Zzz10_RemoteControlDrivingVariant )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.Always", T"WorldMappinUIProfile.RemoteControlDriving" );
		}
		else if( mappin.IsQuestMappin() )
		{
			questMappin = ( ( QuestMappin )( mappin ) );
			if( questMappin )
			{
				if( questMappin.IsUIAnimation() )
				{
					questAnimationRecord = TweakDBInterface.GetUIAnimationRecord( questMappin.GetUIAnimationRecordID() );
					if( ( ResRef.IsValid( questAnimationRecord.WidgetResource() ) && questAnimationRecord.AnimationName() != '' ) && questAnimationRecord.ProfileHandle() )
					{
						return MappinUIProfile.Create( questAnimationRecord.WidgetResource(), T"MappinUISpawnProfile.Always", questAnimationRecord.ProfileHandle().GetID() );
					}
				}
				else
				{
					return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.Always", T"WorldMappinUIProfile.Quest" );
				}
			}
		}
		if( ( customData != NULL ) && ( ( ( TrackedMappinControllerCustomData )( customData ) ) != NULL ) )
		{
			return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.Always", defaultRuntimeProfile );
		}
		return MappinUIProfile.Create( defaultWidgetResource, T"MappinUISpawnProfile.MediumRange", defaultRuntimeProfile );
	}

}

