namespace Mr.BrickAdventures.Progression; /// /// Identity of one Playthrough. Several Playthroughs exist at once and the player picks between /// them; "slot" is the word the UI uses for the same thing. /// /// /// Deliberately has no factory that generates a value. Ids are created by an adapter and passed in, /// so nothing in the domain depends on a source of randomness. /// public readonly struct PlaythroughId : IEquatable { public Guid Value { get; } private PlaythroughId(Guid value) => Value = value; public static PlaythroughId Of(Guid value) => value == Guid.Empty ? throw new ArgumentException("A playthrough id cannot be the empty guid.", nameof(value)) : new PlaythroughId(value); public bool Equals(PlaythroughId other) => Value.Equals(other.Value); public override bool Equals(object? obj) => obj is PlaythroughId other && Equals(other); public override int GetHashCode() => Value.GetHashCode(); public override string ToString() => Value.ToString(); }