// 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. using System; using System.Threading; using System.Threading.Tasks; using StrixMusic.Sdk.MediaPlayback; namespace StrixMusic.Sdk.BaseModels { /// /// Represents an item that can be played. /// public interface IPlayableBase : IImageCollectionBase, IUrlCollectionBase, IAsyncDisposable { /// /// The ID of the playable item. /// string Id { get; } /// /// Name of the playable item. /// string Name { get; } /// /// Provides comments about the item. This may contain markdown content. /// string? Description { get; } /// /// The last time the item was played. If never played or unknown, value is null. /// DateTime? LastPlayed { get; } /// PlaybackState PlaybackState { get; } /// /// How long the playable item takes to complete playback. /// /// If not applicable, use . TimeSpan Duration { get; } /// /// If true, can be used. /// bool IsChangeNameAsyncAvailable { get; } /// /// If true, can be used. /// bool IsChangeDescriptionAsyncAvailable { get; } /// /// If true, can be used. /// bool IsChangeDurationAsyncAvailable { get; } /// /// Changes the of this playable item. /// /// The new name to use. /// A cancellation token that may be used to cancel the ongoing task. /// A representing the asynchronous operation. Task ChangeNameAsync(string name, CancellationToken cancellationToken = default); /// /// Changes the for this item. /// /// The new description for this playable item. /// A cancellation token that may be used to cancel the ongoing task. /// A representing the asynchronous operation. Task ChangeDescriptionAsync(string? description, CancellationToken cancellationToken = default); /// /// Changes the for this item. /// /// The new duration for this playable item. /// A cancellation token that may be used to cancel the ongoing task. /// A representing the asynchronous operation. Task ChangeDurationAsync(TimeSpan duration, CancellationToken cancellationToken = default); /// /// Raised when changes. /// event EventHandler? PlaybackStateChanged; /// /// Raised when changes. /// event EventHandler? NameChanged; /// /// Raised when changes. /// event EventHandler? DescriptionChanged; /// /// Raised when changes; /// event EventHandler? DurationChanged; /// /// Raised when changes. /// event EventHandler? LastPlayedChanged; /// /// Raised when changes. /// event EventHandler? IsChangeNameAsyncAvailableChanged; /// /// Raised when changes. /// event EventHandler? IsChangeDescriptionAsyncAvailableChanged; /// /// Raised when changes. /// event EventHandler? IsChangeDurationAsyncAvailableChanged; } }