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; set; }
/// The current beta version of the game (if any).
public string BetaVersion { get; set; }
/// The mods to display.
public ModModel[] Mods { get; set; }
/// When the data was last updated.
public DateTimeOffset LastUpdated { get; set; }
/// Whether the data hasn't been updated in a while.
public bool IsStale { get; set; }
/// Whether the mod metadata is available.
public bool HasData => this.Mods != null;
/*********
** Public methods
*********/
/// Construct an empty instance.
public ModListModel() { }
/// 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;
}
}
}