class DropdownItemData
{
	var identifier : Variant;
	var labelKey : CName;
	var direction : DropdownItemDirection;
}

enum DropdownItemDirection
{
	None = 0,
	Down = 1,
	Up = 2,
}

enum DropdownDisplayContext
{
	NotSet = 0,
	Default = 1,
	ItemChooserWeapon = 2,
}

final abstract class SortingDropdownData
{

	public static function GetDropdownOption( const options : ref< array< DropdownItemData > >, identifier : ItemSortMode ) : DropdownItemData
	{
		var i : Int32;
		for( i = 0; i < options.Size(); i += 1 )
		{
			if( ( ( ItemSortMode )options[ i ].identifier ) == identifier )
			{
				return options[ i ];
			}
		}
		return NULL;
	}

	private static function GetDropdownItemData( identifier : Variant, labelKey : CName, direction : DropdownItemDirection ) : DropdownItemData
	{
		var itemData : DropdownItemData;
		itemData = new DropdownItemData;
		itemData.identifier = identifier;
		itemData.labelKey = labelKey;
		itemData.direction = direction;
		return itemData;
	}

	public static function GetDefaultDropdownOptions() : array< DropdownItemData >
	{
		var result : array< DropdownItemData >;
		result.PushBack( GetDropdownItemData( ItemSortMode.Default, 'UI-Sorting-Default', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NewItems, 'UI-Sorting-NewItems', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameAsc, 'UI-Sorting-Name', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameDesc, 'UI-Sorting-Name', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.DpsDesc, 'UI-Sorting-DPS', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.DpsAsc, 'UI-Sorting-DPS', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityAsc, 'UI-Sorting-Quality', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityDesc, 'UI-Sorting-Quality', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.WeightDesc, 'UI-Sorting-Weight', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.WeightAsc, 'UI-Sorting-Weight', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceDesc, 'UI-Sorting-Price', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceAsc, 'UI-Sorting-Price', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.ItemType, 'UI-Sorting-ItemType', DropdownItemDirection.None ) );
		return result;
	}

	public static function GetItemChooserWeaponDropdownOptions() : array< DropdownItemData >
	{
		var result : array< DropdownItemData >;
		result.PushBack( GetDropdownItemData( ItemSortMode.Default, 'UI-Sorting-Default', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NewItems, 'UI-Sorting-NewItems', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameAsc, 'UI-Sorting-Name', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameDesc, 'UI-Sorting-Name', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.DpsDesc, 'UI-Sorting-DPS', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.DpsAsc, 'UI-Sorting-DPS', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityAsc, 'UI-Sorting-Quality', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityDesc, 'UI-Sorting-Quality', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.WeightDesc, 'UI-Sorting-Weight', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.WeightAsc, 'UI-Sorting-Weight', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceDesc, 'UI-Sorting-Price', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceAsc, 'UI-Sorting-Price', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.ItemType, 'UI-Sorting-ItemType', DropdownItemDirection.None ) );
		return result;
	}

	public static function GetContextDropdownOptions( context : DropdownDisplayContext ) : array< DropdownItemData >
	{
		switch( context )
		{
			case DropdownDisplayContext.Default:
				return GetDefaultDropdownOptions();
			case DropdownDisplayContext.ItemChooserWeapon:
				return GetItemChooserWeaponDropdownOptions();
		}
		return GetDefaultDropdownOptions();
	}

	public static function GeVisualsDropdownOptions() : array< DropdownItemData >
	{
		var result : array< DropdownItemData >;
		result.PushBack( GetDropdownItemData( ItemSortMode.Default, 'UI-Sorting-Default', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NewItems, 'UI-Sorting-NewItems', DropdownItemDirection.None ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameAsc, 'UI-Sorting-Name', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.NameDesc, 'UI-Sorting-Name', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityAsc, 'UI-Sorting-Quality', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.QualityDesc, 'UI-Sorting-Quality', DropdownItemDirection.Up ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceDesc, 'UI-Sorting-Price', DropdownItemDirection.Down ) );
		result.PushBack( GetDropdownItemData( ItemSortMode.PriceAsc, 'UI-Sorting-Price', DropdownItemDirection.Up ) );
		return result;
	}

}

