using System;
using System.Diagnostics;
using Interfaces;

namespace IrDaemonNotifier
{
    public class IrDaemonController:ISystemControlProvider
    {
        private readonly ILoggerService _logger;

        public IrDaemonController(ILoggerService logger)
        {
            _logger = logger;
        }

        public void Shutdown()
        {
            Debug.WriteLine("Shutdown controller");
            try
            {
                var communicator = new IrDaemonCommunicator(_logger);
                communicator.SendCommand(Commands.Shutdown);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "IrDaemonController Shutdown Error");
            }
        }

        public PluginDetails GetPluginDetails()
        {
            return Resources.Details;
        }
    }
}
