using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
namespace NugetForUnity.Models
{
///
/// Class containing information about a package install operation.
///
internal class PackageInstallOperationResult
{
///
/// Gets or sets a value indicating whether the install was successful.
///
public bool Successful { get; set; } = true;
///
/// Gets the list containing information about the installed packages.
///
[NotNull]
public List Packages { get; } = new List();
///
/// Combines this result withe the information of the by adding all installed package information from the other
/// result to this result.
///
/// The other result to combine with this result.
public void Combine([NotNull] PackageInstallOperationResult otherResult)
{
Successful = Successful && otherResult.Successful;
Packages.AddRange(otherResult.Packages.Where(package => !Packages.Contains(package)));
}
}
}