using System;
using Newtonsoft.Json;
namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels
{
/// Mod metadata from Nexus Mods.
internal class NexusMod
{
/*********
** Accessors
*********/
/// The mod name.
public string? Name { get; }
/// The mod's semantic version number.
public string? Version { get; }
/// The mod's web URL.
[JsonProperty("mod_page_uri")]
public string? Url { get; }
/// The mod's publication status.
[JsonIgnore]
public NexusModStatus Status { get; }
/// The files available to download.
[JsonIgnore]
public IModDownload[] Downloads { get; }
/// A custom user-friendly error which indicates why fetching the mod info failed (if applicable).
[JsonIgnore]
public string? Error { get; }
/*********
** Public methods
*********/
/// Construct an instance.
/// The mod name
/// The mod's semantic version number.
/// The mod's web URL.
/// The files available to download.
public NexusMod(string name, string? version, string url, IModDownload[] downloads)
{
this.Name = name;
this.Version = version;
this.Url = url;
this.Status = NexusModStatus.Ok;
this.Downloads = downloads;
}
/// Construct an instance.
/// The mod's publication status.
/// A custom user-friendly error which indicates why fetching the mod info failed (if applicable).
public NexusMod(NexusModStatus status, string error)
{
this.Status = status;
this.Error = error;
this.Downloads = Array.Empty();
}
}
}