using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
///
/// Class RemoveFromPlaylistGroupRequest.
///
public class RemoveFromPlaylistGroupRequest : AbstractPlaybackRequest
{
///
/// Initializes a new instance of the class.
///
/// The playlist ids of the items to remove.
/// Whether to clear the entire playlist. The items list will be ignored.
/// Whether to remove the playing item as well. Used only when clearing the playlist.
public RemoveFromPlaylistGroupRequest(IReadOnlyList items, bool clearPlaylist = false, bool clearPlayingItem = false)
{
PlaylistItemIds = items ?? Array.Empty();
ClearPlaylist = clearPlaylist;
ClearPlayingItem = clearPlayingItem;
}
///
/// Gets the playlist identifiers ot the items.
///
/// The playlist identifiers ot the items.
public IReadOnlyList PlaylistItemIds { get; }
///
/// Gets a value indicating whether the entire playlist should be cleared.
///
/// Whether the entire playlist should be cleared.
public bool ClearPlaylist { get; }
///
/// Gets a value indicating whether the playing item should be removed as well.
///
/// Whether the playing item should be removed as well.
public bool ClearPlayingItem { get; }
///
public override PlaybackRequestType Action { get; } = PlaybackRequestType.RemoveFromPlaylist;
///
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
{
state.HandleRequest(this, context, state.Type, session, cancellationToken);
}
}
}