aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/SyncPlay/PlaybackRequests/QueueGroupRequest.cs
blob: 0f91476de1b21ce78ed7c2f2bec9d00edc98a32a (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
45
46
47
48
#nullable disable

using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;

namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
    /// <summary>
    /// Class QueueGroupRequest.
    /// </summary>
    public class QueueGroupRequest : AbstractPlaybackRequest
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="QueueGroupRequest"/> class.
        /// </summary>
        /// <param name="items">The items to add to the queue.</param>
        /// <param name="mode">The enqueue mode.</param>
        public QueueGroupRequest(IReadOnlyList<Guid> items, GroupQueueMode mode)
        {
            ItemIds = items ?? Array.Empty<Guid>();
            Mode = mode;
        }

        /// <summary>
        /// Gets the items to enqueue.
        /// </summary>
        /// <value>The items to enqueue.</value>
        public IReadOnlyList<Guid> ItemIds { get; }

        /// <summary>
        /// Gets the mode in which to add the new items.
        /// </summary>
        /// <value>The enqueue mode.</value>
        public GroupQueueMode Mode { get; }

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

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