aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/SyncPlay/PlaybackRequests/MovePlaylistItemGroupRequest.cs
blob: efca4ed3ef3c221032bbf0f7f4dac4bc8762fb8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;

namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
    /// <summary>
    /// Class MovePlaylistItemGroupRequest.
    /// </summary>
    public class MovePlaylistItemGroupRequest : AbstractPlaybackRequest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MovePlaylistItemGroupRequest"/> class.
        /// </summary>
        /// <param name="playlistItemId">The playlist identifier of the item.</param>
        /// <param name="newIndex">The new position.</param>
        public MovePlaylistItemGroupRequest(string playlistItemId, int newIndex)
        {
            PlaylistItemId = playlistItemId;
            NewIndex = newIndex;
        }

        /// <summary>
        /// Gets the playlist identifier of the item.
        /// </summary>
        /// <value>The playlist identifier of the item.</value>
        public string PlaylistItemId { get; }

        /// <summary>
        /// Gets the new position.
        /// </summary>
        /// <value>The new position.</value>
        public int NewIndex { get; }

        /// <inheritdoc />
        public override PlaybackRequestType Action { get; } = PlaybackRequestType.MovePlaylistItem;

        /// <inheritdoc />
        public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
        {
            state.HandleRequest(context, state.Type, this, session, cancellationToken);
        }
    }
}