// RibbonSearchHelper.cs
// Copyright (c) 2016 Bentley Systems, Incorporated. All Rights Reserved.

using Haestad.Support.Library;
using Haestad.Support.Support;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Threading;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.RibbonView;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Haestad.Framework.UI.Integration.Test, PublicKey=" +
    "002400000480000094000000060200000024000052534131000400000100010025b2f82c499245" +
    "27a7853779cf30993d30cf63f0dea189775ddb4d071be50d54e5f910b20cab403f08c5343a38a4" +
    "1ddfb8452cace2996428f4fbf666e622dc3d0f982bc347fe94309e5448d6d22675d8655abee826" +
    "27104632ecf481097c91571411bb1d224f8fe9227638dfcf844e47f78fce62332c705b3c0fea0e" +
    "d4bd46bd"
    )]

namespace Haestad.Framework.UI.Integration
{
    /// <summary>
    /// Class for support methods for ribbon search.
    /// </summary>
    internal class RibbonSearchHelper
    {
        internal static int RibbonSearchResultItemComparison(RibbonSearchResultItem item1, RibbonSearchResultItem item2)
        {
            const int ITEM1_IS_FIRST = -1;
            const int ITEM1_IS_SAME = 0;
            const int ITEM1_IS_SECOND = 1;

            if (item1.CommandRank < item2.CommandRank)
                return ITEM1_IS_FIRST;
            else if (item1.CommandRank > item2.CommandRank)
                return ITEM1_IS_SECOND;
            else
            {
                if (item1.RibbonLocation < item2.RibbonLocation)
                    return ITEM1_IS_FIRST;
                else if (item1.RibbonLocation > item2.RibbonLocation)
                    return ITEM1_IS_SECOND;
                else
                {
                    if (item1.RibbonTabIndex < item2.RibbonTabIndex)
                        return ITEM1_IS_FIRST;
                    else if (item1.RibbonTabIndex > item2.RibbonTabIndex)
                        return ITEM1_IS_SECOND;
                    else
                        return ITEM1_IS_SAME;
                }
            }
        }
    }
}
