namespace Mr.BrickAdventures.Progression; /// /// Stable identity of a Level. Never a position in a list — Playthroughs and Best Times both /// reference Levels, so ids must survive inserting and reordering. /// public readonly struct LevelId : IEquatable { public string Value { get; } private LevelId(string value) => Value = value; public static LevelId Of(string value) => string.IsNullOrWhiteSpace(value) ? throw new ArgumentException("A level id cannot be blank.", nameof(value)) : new LevelId(value); public bool Equals(LevelId other) => string.Equals(Value, other.Value, StringComparison.Ordinal); public override bool Equals(object? obj) => obj is LevelId other && Equals(other); public override int GetHashCode() => StringComparer.Ordinal.GetHashCode(Value ?? string.Empty); public override string ToString() => Value; }