// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using JetBrains.Annotations; using osu.Game.Beatmaps; using osu.Game.Database; using Realms; namespace osu.Game.Collections { /// /// A collection of beatmaps grouped by a name. /// public class BeatmapCollection : RealmObject, IHasGuidPrimaryKey { [PrimaryKey] public Guid ID { get; set; } /// /// The collection's name. /// public string Name { get; set; } = string.Empty; /// /// The es of beatmaps contained by the collection. /// /// /// We store as hashes rather than references to s to allow collections to maintain /// references to beatmaps even if they are removed. This helps with cases like importing collections before /// importing the beatmaps they contain, or when sharing collections between users. /// /// This can probably change in the future as we build the system up. /// public IList BeatmapMD5Hashes { get; } = null!; /// /// The date when this collection was last modified. /// public DateTimeOffset LastModified { get; set; } public BeatmapCollection(string? name = null, IList? beatmapMD5Hashes = null) { ID = Guid.NewGuid(); Name = name ?? string.Empty; BeatmapMD5Hashes = beatmapMD5Hashes ?? new List(); LastModified = DateTimeOffset.UtcNow; } [UsedImplicitly] private BeatmapCollection() { } } }