using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework.UpdateData; namespace StardewModdingAPI.Web.Framework { /// Generic metadata about a mod page. internal interface IModPage { /********* ** Accessors *********/ /// The mod site containing the mod. ModSiteKey Site { get; } /// The mod's unique ID within the site. string Id { get; } /// The mod name. string? Name { get; } /// The mod's semantic version number. string? Version { get; } /// The mod's web URL. string? Url { get; } /// The mod downloads. IModDownload[] Downloads { get; } /// The mod page status. RemoteModStatus Status { get; } /// A user-friendly error which indicates why fetching the mod info failed (if applicable). string? Error { get; } /// Whether the mod data is valid. [MemberNotNullWhen(true, nameof(IModPage.Name), nameof(IModPage.Url))] [MemberNotNullWhen(false, nameof(IModPage.Error))] bool IsValid { get; } /********* ** Methods *********/ /// Set the fetched mod info. /// The mod name. /// The mod's semantic version number. /// The mod's web URL. /// The mod downloads. IModPage SetInfo(string name, string? version, string url, IEnumerable downloads); /// Set a mod fetch error. /// The mod availability status on the remote site. /// A user-friendly error which indicates why fetching the mod info failed (if applicable). IModPage SetError(RemoteModStatus status, string error); } }