/**
  * Aksing for strategy
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @param RestoreJob $job
  * @return RestoreStrategy
  * @author Daniel Wendlandt
  */
 private function askForRestoreStrategy(InputInterface $input, OutputInterface $output, RestoreJob $job)
 {
     $strategies = array(RestoreStrategy::STRATEGY_RESET, RestoreStrategy::STRATEGY_ADD, RestoreStrategy::STRATEGY_CUSTOM);
     $questions = array('Delete all indices/types if exist and insert data', 'Do not touch indices/types if exist and add data', 'Define custom mappings and insert the data');
     $helper = $this->getHelper('question');
     $question = new ChoiceQuestion('<info>Please decide the strategy for restoring teh data ?</info>', $questions);
     $mappingStrategyAnswer = $helper->ask($input, $output, $question);
     $strategy = new RestoreStrategy();
     foreach ($questions as $strategyKey => $strategyQuestion) {
         if ($mappingStrategyAnswer === $strategyQuestion) {
             $strategy->setStrategy($strategies[$strategyKey]);
         }
     }
     if (RestoreStrategy::STRATEGY_CUSTOM !== $strategy->getStrategy()) {
         $strategy->processMappingsForStrategy($strategy->getStrategy(), $job->getMappings());
         return $strategy;
     }
     $this->askForCustomMapping($input, $output, $job, $strategy);
     return $strategy;
 }
 /**
  * Creates a job from given config file in yaml format
  *
  * @param string $filepath
  * @param null|string $host
  * @param null|string $port
  * @return RestoreJob
  * @throws \Exception
  * @author Daniel Wendlandt
  */
 public function createJobFromConfig($filepath, $host = null, $port = null)
 {
     $config = $this->filesystem->loadYamlConfig($filepath);
     if (null === $host) {
         $host = $config['host'];
     }
     if (null === $port) {
         $port = $config['port'];
     }
     $source = $config['source'] . DIRECTORY_SEPARATOR . $config['name'];
     $job = $this->createJob($source, $host, $port);
     $strategy = new RestoreStrategy();
     $strategy->setStrategy($config['strategy']['strategy']);
     foreach ($config['strategy']['mappings'] as $actionConfig) {
         $mappingAction = RestoreStrategy\MappingAction::createFromArray($actionConfig);
         $strategy->addMappingAction($mappingAction);
     }
     $job->setStrategy($strategy);
     return $job;
 }