using Newtonsoft.Json;
using StardewModdingAPI.Toolkit.Serialisation.Converters;
namespace StardewModdingAPI.Toolkit.Serialisation.Models
{
/// A mod dependency listed in a mod manifest.
public class ManifestDependency : IManifestDependency
{
/*********
** Accessors
*********/
/// The unique mod ID to require.
public string UniqueID { get; set; }
/// The minimum required version (if any).
[JsonConverter(typeof(SemanticVersionConverter))]
public ISemanticVersion MinimumVersion { get; set; }
/// Whether the dependency must be installed to use the mod.
public bool IsRequired { get; set; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The unique mod ID to require.
/// The minimum required version (if any).
/// Whether the dependency must be installed to use the mod.
public ManifestDependency(string uniqueID, string minimumVersion, bool required = true)
{
this.UniqueID = uniqueID;
this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion)
? new SemanticVersion(minimumVersion)
: null;
this.IsRequired = required;
}
}
}