using System;
using System.Collections.Generic;
using System.Linq;
namespace StardewModdingAPI.Web.ViewModels
{
/// Metadata for the mod list page.
public class ModListModel
{
/*********
** Accessors
*********/
/// The current stable version of the game.
public string? StableVersion { get; }
/// The current beta version of the game (if any).
public string? BetaVersion { get; }
/// The mods to display.
public ModModel[] Mods { get; }
/// When the data was last updated.
public DateTimeOffset LastUpdated { get; }
/// Whether the data hasn't been updated in a while.
public bool IsStale { get; }
/// Whether the mod metadata is available.
public bool HasData => this.Mods.Any();
/*********
** Public methods
*********/
/// Construct an instance.
/// The current stable version of the game.
/// The current beta version of the game (if any).
/// The mods to display.
/// When the data was last updated.
/// Whether the data hasn't been updated in a while.
public ModListModel(string? stableVersion, string? betaVersion, IEnumerable mods, DateTimeOffset lastUpdated, bool isStale)
{
this.StableVersion = stableVersion;
this.BetaVersion = betaVersion;
this.Mods = mods.ToArray();
this.LastUpdated = lastUpdated;
this.IsStale = isStale;
}
}
}