namespace TrafagSalesExporter.Services; public class TransformationCatalog : ITransformationCatalog { private readonly IReadOnlyList _items; public TransformationCatalog(IEnumerable valueStrategies, IEnumerable recordStrategies) { _items = valueStrategies .Select(x => new TransformationCatalogItem { Key = x.TransformationType, RuleScope = "Value", Description = x.Description }) .Concat(recordStrategies.Select(x => new TransformationCatalogItem { Key = x.TransformationType, RuleScope = "Record", Description = x.Description })) .OrderBy(x => x.RuleScope, StringComparer.OrdinalIgnoreCase) .ThenBy(x => x.Key, StringComparer.OrdinalIgnoreCase) .ToList(); } public IReadOnlyList GetAll() => _items; public IReadOnlyList GetByScope(string ruleScope) => _items .Where(x => string.Equals(x.RuleScope, ruleScope, StringComparison.OrdinalIgnoreCase)) .ToList(); }