using StabilityMatrix.Core.Models.Packages;
namespace StabilityMatrix.Core.Helper.Factory;
public class PackageFactory : IPackageFactory
{
///
/// Mapping of package.Name to package
///
private readonly Dictionary basePackages;
public PackageFactory(IEnumerable basePackages)
{
this.basePackages = basePackages.ToDictionary(x => x.Name);
}
public IEnumerable GetAllAvailablePackages()
{
return basePackages.Values;
}
public BasePackage? FindPackageByName(string packageName)
{
return basePackages.GetValueOrDefault(packageName);
}
}