22// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33// See the LICENSE file in the project root for more information
44
5- using Elastic . Documentation ;
6- using Elastic . Documentation . AppliesTo ;
7- using Elastic . Documentation . Configuration . Versions ;
8-
9- namespace Elastic . Markdown . Myst . Components ;
5+ namespace Elastic . Documentation . AppliesTo ;
106
117/// <summary>
128/// Utility class for selecting the most relevant applicability from a collection of applicabilities.
@@ -17,9 +13,9 @@ public static class ApplicabilitySelector
1713 /// Selects the most relevant applicability for display: available versions first (highest version), then closest future version
1814 /// </summary>
1915 /// <param name="applicabilities">The collection of applicabilities to select from</param>
20- /// <param name="versioningSystem ">The versioning system to use for comparison</param>
16+ /// <param name="currentVersion ">The current version to use for comparison</param>
2117 /// <returns>The most relevant applicability for display</returns>
22- public static Applicability GetPrimaryApplicability ( IEnumerable < Applicability > applicabilities , VersioningSystem versioningSystem )
18+ public static Applicability GetPrimaryApplicability ( IEnumerable < Applicability > applicabilities , SemVersion currentVersion )
2319 {
2420 var applicabilityList = applicabilities . ToList ( ) ;
2521 var lifecycleOrder = new Dictionary < ProductLifecycle , int >
@@ -34,7 +30,7 @@ public static Applicability GetPrimaryApplicability(IEnumerable<Applicability> a
3430 } ;
3531
3632 var availableApplicabilities = applicabilityList
37- . Where ( a => a . Version is null || a . Version is AllVersions || a . Version <= versioningSystem . Current )
33+ . Where ( a => a . Version is null || a . Version is AllVersions || a . Version <= currentVersion )
3834 . ToList ( ) ;
3935
4036 if ( availableApplicabilities . Count != 0 )
@@ -46,13 +42,13 @@ public static Applicability GetPrimaryApplicability(IEnumerable<Applicability> a
4642 }
4743
4844 var futureApplicabilities = applicabilityList
49- . Where ( a => a . Version is not null && a . Version is not AllVersions && a . Version > versioningSystem . Current )
45+ . Where ( a => a . Version is not null && a . Version is not AllVersions && a . Version > currentVersion )
5046 . ToList ( ) ;
5147
5248 if ( futureApplicabilities . Count != 0 )
5349 {
5450 return futureApplicabilities
55- . OrderBy ( a => a . Version ! . CompareTo ( versioningSystem . Current ) )
51+ . OrderBy ( a => a . Version ! . CompareTo ( currentVersion ) )
5652 . ThenBy ( a => lifecycleOrder . GetValueOrDefault ( a . Lifecycle , 999 ) )
5753 . First ( ) ;
5854 }
0 commit comments