// 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.AppModels;
using StrixMusic.Sdk.MediaPlayback;
namespace StrixMusic.Sdk.BaseModels
{
///
/// A device that controls playback of an audio player.
///
public interface IDeviceBase : IAudioPlayerBase, IAsyncDisposable
{
///
/// A unique identifier for the player.
///
string Id { get; }
///
/// The displayed name of this device.
///
string Name { get; }
///
/// If true, the device is currently active and playing audio.
///
bool IsActive { get; }
///
/// The context of the currently playing track.
///
IPlayableBase? PlaybackContext { get; }
///
DeviceType Type { get; }
///
/// True if the player is using a shuffled track list.
///
bool ShuffleState { get; }
///
RepeatState RepeatState { get; }
///
/// If true, is supported.
///
bool IsSeekAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsResumeAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsPauseAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsChangeVolumeAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsChangePlaybackSpeedAvailable { get; }
///
/// If true, is supported.
///
bool IsNextAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsPreviousAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsToggleShuffleAsyncAvailable { get; }
///
/// If true, is supported.
///
bool IsToggleRepeatAsyncAvailable { get; }
///
/// Advances to the next track. If there is no next track, playback is paused.
///
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task NextAsync(CancellationToken cancellationToken = default);
///
/// Goes to the previous track.
///
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task PreviousAsync(CancellationToken cancellationToken = default);
///
/// Toggles shuffle on or off.
///
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task ToggleShuffleAsync(CancellationToken cancellationToken = default);
///
/// Asks the device to toggle to the next repeat state.
///
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task ToggleRepeatAsync(CancellationToken cancellationToken = default);
///
/// Switches to this device.
///
/// A cancellation token that may be used to cancel the ongoing task.
/// A representing the asynchronous operation.
Task SwitchToAsync(CancellationToken cancellationToken = default);
///
/// Fires when changes.
///
event EventHandler? IsActiveChanged;
///
/// Fires when changes.
///
event EventHandler? PlaybackContextChanged;
///
/// Fires when changes.
///
event EventHandler? ShuffleStateChanged;
///
/// Fires when changes.
///
event EventHandler? RepeatStateChanged;
}
}