// Copyright (c) Arlo Godfrey. All Rights Reserved. // Licensed under the GNU Lesser General Public License, Version 3.0 with additional terms. // See the LICENSE, LICENSE.LESSER and LICENSE.ADDITIONAL files in the project root for more information. namespace StrixMusic.Sdk.AppModels { /// /// Holds information about a download operation. /// public readonly struct DownloadInfo : System.IEquatable { /// /// Creates an instance of the struct. /// public DownloadInfo(DownloadState state) { State = state; Progress = default; } /// /// Creates an instance of the struct. /// public DownloadInfo(DownloadState state, ushort progress) { Progress = progress; State = state; } /// /// A value between 0 and 65535 representing how much of this playable item has been downloaded for offline playback. /// public ushort Progress { get; } /// /// The current download state. /// public DownloadState State { get; } /// public override bool Equals(object obj) => obj is DownloadInfo status && Equals(status); /// public override int GetHashCode() => State.GetHashCode() + Progress.GetHashCode(); /// public static bool operator ==(DownloadInfo left, DownloadInfo right) => left.Equals(right); /// public static bool operator !=(DownloadInfo left, DownloadInfo right) => !(left == right); /// public bool Equals(DownloadInfo other) => other.State == State && other.Progress == Progress; } }