using System;
using System.Diagnostics.CodeAnalysis;
namespace StardewModdingAPI
{
/// A semantic version with an optional release tag.
public interface ISemanticVersion : IComparable, IEquatable
{
/*********
** Accessors
*********/
/// The major version incremented for major API changes.
int MajorVersion { get; }
/// The minor version incremented for backwards-compatible changes.
int MinorVersion { get; }
/// The patch version for backwards-compatible bug fixes.
int PatchVersion { get; }
/// An optional prerelease tag.
string? PrereleaseTag { get; }
/// Optional build metadata. This is ignored when determining version precedence.
string? BuildMetadata { get; }
/*********
** Accessors
*********/
/// Whether this is a prerelease version.
#if NET5_0_OR_GREATER
[MemberNotNullWhen(true, nameof(ISemanticVersion.PrereleaseTag))]
#endif
bool IsPrerelease();
/// Get whether this version is older than the specified version.
/// The version to compare with this instance.
/// Although the parameter is nullable, it isn't optional. A null version is considered earlier than every possible valid version, so passing null to will always return false.
bool IsOlderThan(ISemanticVersion? other);
/// Get whether this version is older than the specified version.
/// The version to compare with this instance. A null value is never older.
/// The specified version is not a valid semantic version.
/// Although the parameter is nullable, it isn't optional. A null version is considered earlier than every possible valid version, so passing null to will always return false.
bool IsOlderThan(string? other);
/// Get whether this version is newer than the specified version.
/// The version to compare with this instance. A null value is always older.
/// Although the parameter is nullable, it isn't optional. A null version is considered earlier than every possible valid version, so passing null to will always return true.
bool IsNewerThan(ISemanticVersion? other);
/// Get whether this version is newer than the specified version.
/// The version to compare with this instance. A null value is always older.
/// The specified version is not a valid semantic version.
/// Although the parameter is nullable, it isn't optional. A null version is considered earlier than every possible valid version, so passing null to will always return true.
bool IsNewerThan(string? other);
/// Get whether this version is between two specified versions (inclusively).
/// The minimum version. A null value is always older.
/// The maximum version. A null value is never newer.
/// Although the and parameters are nullable, they are not optional. A null version is considered earlier than every possible valid version. For example, passing null to will always return false, since no valid version can be earlier than null.
bool IsBetween(ISemanticVersion? min, ISemanticVersion? max);
/// Get whether this version is between two specified versions (inclusively).
/// The minimum version. A null value is always older.
/// The maximum version. A null value is never newer.
/// One of the specified versions is not a valid semantic version.
/// Although the and parameters are nullable, they are not optional. A null version is considered earlier than every possible valid version. For example, passing null to will always return false, since no valid version can be earlier than null.
bool IsBetween(string? min, string? max);
/// Get a string representation of the version.
string ToString();
/// Whether the version uses non-standard extensions, like four-part game versions on some platforms.
bool IsNonStandard();
}
}