using Translate.Interface;
using Microsoft.Extensions.Configuration;

namespace Translate
{
  public class Executor
  {
      private readonly IConfiguration _configuration;
      private readonly IMainService _mainService;
      private readonly ICommandArgs _commandArgs;

      public Executor(IMainService mainService,IConfigurationRoot configuration,ICommandArgs commandArgs)
      {
          _configuration = configuration ?? throw new ArgumentException(nameof(configuration));
          _mainService = mainService ?? throw new ArgumentException(nameof(mainService));
          _commandArgs = commandArgs ?? throw new ArgumentException(nameof(commandArgs));
      }

      /// <summary>
      /// This is essentially the starting point where we bootstrap the legacy entry point 
      /// </summary>
      public void Execute()
      {  _mainService.RunService(_commandArgs.GetArgs(), _configuration);
      }
  }
}
