using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Events.System;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Session;
namespace Jellyfin.Server.Implementations.Events.Consumers.System
{
    /// 
    /// Notifies users when there is a pending restart.
    /// 
    public class PendingRestartNotifier : IEventConsumer
    {
        private readonly ISessionManager _sessionManager;
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The session manager.
        public PendingRestartNotifier(ISessionManager sessionManager)
        {
            _sessionManager = sessionManager;
        }
        /// 
        public async Task OnEvent(PendingRestartEventArgs eventArgs)
        {
            await _sessionManager.SendRestartRequiredNotification(CancellationToken.None).ConfigureAwait(false);
        }
    }
}