// 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 System.Linq; using MessagePack; using osu.Game.Online.API; namespace osu.Game.Online.Rooms { [Serializable] [MessagePackObject] public class MultiplayerPlaylistItem { [Key(0)] public long ID { get; set; } [Key(1)] public int OwnerID { get; set; } [Key(2)] public int BeatmapID { get; set; } [Key(3)] public string BeatmapChecksum { get; set; } = string.Empty; [Key(4)] public int RulesetID { get; set; } [Key(5)] public IEnumerable RequiredMods { get; set; } = Enumerable.Empty(); [Key(6)] public IEnumerable AllowedMods { get; set; } = Enumerable.Empty(); [Key(7)] public bool Expired { get; set; } /// /// The order in which this will be played relative to others. /// Playlist items should be played in increasing order (lower values are played first). /// /// /// This is only valid for items which are not . The value for expired items is undefined and should not be used. /// [Key(8)] public ushort PlaylistOrder { get; set; } /// /// The date when this was played. /// [Key(9)] public DateTimeOffset? PlayedAt { get; set; } public MultiplayerPlaylistItem() { } public MultiplayerPlaylistItem(PlaylistItem item) { ID = item.ID; OwnerID = item.OwnerID; BeatmapID = item.Beatmap.OnlineID; BeatmapChecksum = item.Beatmap.MD5Hash; RulesetID = item.RulesetID; RequiredMods = item.RequiredMods.ToArray(); AllowedMods = item.AllowedMods.ToArray(); Expired = item.Expired; PlaylistOrder = item.PlaylistOrder ?? 0; PlayedAt = item.PlayedAt; } } }