<?php

namespace Modules\Admin\Config\Assistant;

class Controller extends \App\Mvc\ControllerAbstract
{

	/**
	 *
	 * {@inheritDoc}
	 * @see \App\Mvc\ControllerAbstract::initialize()
	 */
	protected function initialize()
	{
		parent::initialize();

		$this->actionsCfg['index'] = ['checkSection'=>true, 'checkOption'=>false];
		$this->actionsCfg['renderSetupGuide'] = ['checkSection'=>true, 'checkOption'=>false];
	}


	protected function actionIndex($R)
	{
		// collects messages
		$msgs = \App\MessagesCollector::create();

		$helpManagement = new HelpManagement();

		$this->populateHelp($helpManagement);

		// call plugin trigger which allows any other plugin to attach
		\Engine\Plugins\Manager::getInstance()->executeEvent('Modules\Admin\Config\Assistant-extendHelp', ['helpManagement'=>$helpManagement]);

		// INSTANTIATE AND RENDER VIEW ////////////////////////////////////////////////////////////
		// instantiate the view
		$view = new View_Index($this);

		// send data to the view
		$view->addInput('helpInfosList', $helpManagement->getHelpInfosList());
		$view->getMessagesCollector()->appendMessages($msgs);

		// render the view
		return new \Engine\Mvc\Response\Html($view->render());
	}

	protected function actionRenderSetupGuide($R)
	{
		$helpManagement = new HelpManagement();
		$this->populateHelp($helpManagement);
		// call plugin trigger which allows any other plugin to attach
		\Engine\Plugins\Manager::getInstance()->executeEvent('Modules\Admin\Config\Assistant-extendHelp', ['helpManagement'=>$helpManagement] );

		$helpInfos = $helpManagement->getHelpInfosList();

		$helpInfo = $helpInfos[$R['setupGuideIndex']];
		
		// Create and render the view
		$view = new View_SetupGuide($this);
		
		// Convert markdown content to HTML
		$markdownContent = file_get_contents($helpInfo->SETUP_GUIDE);
		// Pass raw Markdown content to the view
		$view->addInput('content', $markdownContent);
		$view->setPageTitle($helpInfo->title);
		
		// Return the rendered view
		return new \Engine\Mvc\Response\Html($view->render());
	}

	/**
	 * Collects details about various systems.
	 * @param \Modules\Admin\Config\Assistant\HelpManagement $helpManagement
	 */
	private function populateHelp(\Modules\Admin\Config\Assistant\HelpManagement $helpManagement)
	{
		// export data
		$helpManagement->addHelpInfo($this->getExportDataHelp());
		// enitity management ws
		$helpManagement->addHelpInfo($this->getEntityManagementWsHelp());
		// add imported orders ws details
		$helpManagement->addHelpInfo($this->getImportedOrdersWsHelp());
		// add imported documents ws details
		$helpManagement->addHelpInfo($this->getImportedDocumentsWsHelp());
		// add imported documents bank statements import details
		$helpManagement->addHelpInfo($this->getImportedDocumentsStatementsImportHelp());
		// add cronjobs details
		$helpManagement->addHelpInfo($this->getCronjobsHelp());
		// add BI report data ws
		$helpManagement->addHelpInfo($this->getReportsDataWsHelp());
		// invoice cashing transfer to credit
		$helpManagement->addHelpInfo($this->getCashingTransferToCreditHelp());
		// supplier invoice payment transfer to credit
		$helpManagement->addHelpInfo($this->getPaymentTransferToCreditHelp());
		// azure login
		$helpManagement->addHelpInfo($this->getAzureLoginHelp());
		// import bookings from email
		$helpManagement->addHelpInfo($this->getEmailBookingsHelp());
		// add webhook details
		$helpManagement->addHelpInfo($this->getEntityWebhookHelp());

		// add GDS/Amadeus details
		$helpManagement->addHelpInfo($this->getGdsAmadeusHelp());
		// add GDS/Sabre details
		$helpManagement->addHelpInfo($this->getGdsSabreHelp());
		// add GDS/Galileo details
		$helpManagement->addHelpInfo($this->getGdsGalileoHelp());
		// add GDS/Worldspan details
		$helpManagement->addHelpInfo($this->getGdsWorldspanHelp());
		// add GDS/Apollo details
		$helpManagement->addHelpInfo($this->getGdsApolloHelp());
	}

	/**
	 * Provides details about the export data.
	 */
	private function getExportDataHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['exportData']['title'];

		$wsdlAddress = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Utils/ExportData', null, ['wsdl'=>'']);

		$getFileRequest = 	sprintf("%s%s", APP_URL, "Modules/Admin/Config/Assistant/Resources/ExportData/GetFile-Request.xml");
		$getFileResponse = 	sprintf("%s%s", APP_URL, "Modules/Admin/Config/Assistant/Resources/ExportData/GetFile-Response.xml");
		$resourcesGetFile = sprintf("<a href=%s target='_blank'>%s</a>, <a href=%s target='_blank'>%s</a>", $getFileRequest, "Request", $getFileResponse, "Response");

		$confirmFileRequest = 	sprintf("%s%s", APP_URL, "Modules/Admin/Config/Assistant/Resources/ExportData/ConfirmFile-Request.xml");
		$confirmFileResponse = 	sprintf("%s%s", APP_URL, "Modules/Admin/Config/Assistant/Resources/ExportData/ConfirmFile-Response.xml");
		$resourcesConfirmFile = sprintf("<a href=%s target='_blank'>%s</a>, <a href=%s target='_blank'>%s</a>", $confirmFileRequest, "Request", $confirmFileResponse, "Response");

		$securityCode = \App\Config\ExportData\Webservice::getInstance()->get('securityCode');

		$help->description = sprintf($this->lang['index']['exportData']['description'],
				'<i>'.$wsdlAddress.'</i>',
				'<i>'.$securityCode.'</i>',
				'<i>GetFile</i>',
				'<i>'.$resourcesGetFile.'</i>',
				'<i>ConfirmFile</i>',
				'<i>'.$resourcesConfirmFile.'</i>',
				'<i>GetFile</i>',
				'<i>ConfirmFile</i>'
		);

		$help->configModule = 'Utils/ExportData/Config';
		$help->configAction = 'index';

		return $help;
	}

	/**
	 * Provides details about the main cronjob setup
	 */
	private function getCronjobsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['cronjobs']['title'];

		$help->description = sprintf($this->lang['index']['cronjobs']['description'],
			'<i>'.(trim(shell_exec('whoami'))?:'apache').'</i>',
			'<i>'.sprintf("php -f '%sdisp.php' module='Admin/CronJobs/Main' action=startLoop from=systemCron", APP_REAL_PATH).'</i>'
		);

		return $help;
	}

	/**
	 * Provides details about the entity management WS.
	 */
	private function getEntityManagementWsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['entityManagementWs']['title'];

		$endpointAddress = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/EntityManagementWs', 'handleRequest');

		$help->description = sprintf($this->lang['index']['entityManagementWs']['description'], "<i>{$endpointAddress}</i>");

		return $help;
	}

	/**
	 * Provides details about the imported orders WS.
	 */
	private function getImportedOrdersWsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{

		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['importedOrdersWs']['title'];

		$endpointAddress = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Orders/ImportedOrders/Webservice', 'handleRequest');

		$help->description = sprintf($this->lang['index']['importedOrdersWs']['description'], "<i>{$endpointAddress}</i>", '<i>authenticate</i>', '<i>importOrder</i>');

		return $help;

	}

	/**
	 * Provides details about the imported documents WS.
	 */
	private function getImportedDocumentsWsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{

		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['importedDocsWs']['title'];

		$endpointAddress = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Documents/ImportedDocuments/Webservice', 'handleRequest');

		$help->description = sprintf($this->lang['index']['importedDocsWs']['description'], "<i>{$endpointAddress}</i>", '<i>authenticate</i>', '<i>importDocument</i>');

		return $help;

	}
	
	/**
	 * Provides details about the imported documents bank statements import
	 */
	private function getImportedDocumentsStatementsImportHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['impDocBankStatementsImport']['title'];
		
		$help->description = $this->lang['index']['impDocBankStatementsImport']['description'];
		$help->description .= "</br>".sprintf($this->lang['index']['impDocBankStatementsImport']['cashing'], "<i>paymentOrder</i>");
		$help->description .= "</br>".sprintf($this->lang['index']['impDocBankStatementsImport']['payment'], "<i>paymentOrder</i>");
		
		$help->description .= "</br></br>".$this->lang['index']['impDocBankStatementsImport']['description2'];
		
		\Engine\Loader_Cfg::getInstance()->loadModule('Modules\\Documents\\ImportedDocuments\\ImportStatements');
		$CFG = \Engine\Loader_Cfg::getInstance()->getGlobal();

		\Engine\Loader_Lang::getInstance()->loadSection('documents/importedDocuments/importStatements');
		$_LANG = \Engine\Loader_Lang::getInstance()->getGlobal();
		
		foreach ($CFG['Documents']['ImportedDocuments']['ImportStatements']['banks'] as $bankCode => $active) {
			if ($active) {
				$help->description .= "</br>".$_LANG['Documents']['ImportedDocuments']['ImportStatements']['banks'][$bankCode]." - <b>".$bankCode." </b>";
			}
		}
		
		return $help;
		
	}

	/**
	 * Provides details about the entity management WS.
	 */
	private function getReportsDataWsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['reportsDataWs']['title'];

		$endpointAddress = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/ReportsDataWs', 'handleRequest');
		$authToken = \App\ReportsData\Params::getInstance()->get('wsAuthToken');

		$blockExampleRequest = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/ReportsDataWs', 'handleRequest', [
			'authToken' => $authToken,
			'operation' => 'block',
			'blockingApp' => '__YourAppName__',
			'blockTime' => 20,
		]);

		$getStatusExampleRequest = \Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/RemoteData/ReportsDataWs', 'handleRequest', [
			'authToken' => $authToken,
			'operation' => 'getStatus',
		]);

		$reportsDataDescription = sprintf($this->lang['index']['reportsDataWs']['description'], "<i>{$endpointAddress}</i>", "<i>{$authToken}</i>");

		if ($authToken) {
			$reportsDataDescription .= sprintf($this->lang['index']['reportsDataWs']['authentication']['definedToken'], "<b>{$authToken}</b>");
		} else {
			$reportsDataDescription .= "<b>".sprintf($this->lang['index']['reportsDataWs']['authentication']['undefinedToken'])."</b>";
		}

		$description = $reportsDataDescription.
						"<br><br>".
						$this->lang['index']['reportsDataWs']['methods']['description'].
						"<br><br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['getStatus'], "<b>getStatus</b>").
						"<br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['getStatusExample'], "<i>{$getStatusExampleRequest}</i>").
						"<br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['getStatusResponse'], "status", "ok", "reportsDataStatus", "transactionsCountMainQueue", "oldestRecordDateTime", "status", "error", "message").
						"<br><br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['block'], "<b>block</b>").
						"<br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['blockExample'], "<i>{$blockExampleRequest}</i>").
						"<br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['blockRequestParams'], "blockingApp", "blockTime").
						"<br>".
						sprintf($this->lang['index']['reportsDataWs']['methods']['blockResponse'], "status", "error", "status", "ok");


		$help->description = $description;

		$help->configModule = 'RemoteData/ReportsDataWs/Config';
		$help->configAction = 'index';

		return $help;
	}

	/**
	 * Configure cashing transfer to credit.
	 */
	private function getCashingTransferToCreditHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['cashingTransferToCredit']['title'];

		$help->description = $this->lang['index']['cashingTransferToCredit']['description'];

		$help->configModule = 'Invoices/Cashings/Management/TransferToCredit/Config';
		$help->configAction = 'index';

		return $help;
	}

	/**
	 * Configure payment transfer to credit.
	 */
	private function getPaymentTransferToCreditHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['paymentTransferToCredit']['title'];

		$help->description = $this->lang['index']['paymentTransferToCredit']['description'];

		$help->configModule = 'Invoices/Payments/Management/TransferToCredit/Config';
		$help->configAction = 'index';

		return $help;
	}

	private function getAzureLoginHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['azureLogin']['title'];

		$help->description = sprintf($this->lang['index']['azureLogin']['description'],
			'<b>'.'Certificates & secrets'.'</b>',
			'<b>'.'Authentication'.'</b>',
			'<i>'.\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Authenticate/Providers/Azure', '').'</i>'
		);

		$help->configModule = 'Authenticate/Providers/Azure/Config';
		$help->configAction = 'index';

		return $help;
	}

	private function getEmailBookingsHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();
		$help->title = $this->lang['index']['emailBookings']['title'];
		$help->description = $this->lang['index']['emailBookings']['description_general'];
		$help->description .= '<br />';
		$help->description .= sprintf($this->lang['index']['emailBookings']['description_wizzair1'], '<b>Wizzair</b>') . ' ';
		$help->description .= sprintf($this->lang['index']['emailBookings']['description_wizzair2'], '<b>wizzair</b>', '<b>ticketing</b>') . ' ';
		$help->description .= sprintf($this->lang['index']['emailBookings']['description_wizzair3'], '<b>OW</b>', '<b>RT</b>') . ' ';
		$help->description .= sprintf($this->lang['index']['emailBookings']['description_wizzair4'], '<b>MR, MS, CHD</b>') . ' ';

		// chekc if the IMAP extension is loaded
		if (!extension_loaded('imap')) {
			$help->description .= "<p style='color:red'>";
			$help->description .= $this->lang['index']['emailBookings']['description_noImap1'];
			$help->description .= sprintf($this->lang['index']['emailBookings']['description_noImap2'], '<b>https://www.php.net/manual/en/book.imap.php</b>' );
			$help->description .= "</p'>";
		}

		return $help;
	}


	private function getEntityWebhookHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['entityWebhook']['title'];

		$help->description = $this->lang['index']['entityWebhook']['description'];

		$help->configModule = 'Admin/WebhookQueue/Config';
		$help->configAction = 'index';
		$help->configWidth = 900;
		$help->configHeight = 580;

		return $help;

	}


	private function getGdsAmadeusHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['GdsAmadeus']['title'];

		$help->description = '';
		$help->description.= sprintf($this->lang['index']['GdsAmadeus']['description_01'],
			'<b>amadeus</b>',
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/SystemManagement', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/SystemManagement')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsAmadeus']['description_02'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/Services', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/Services')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsAmadeus']['description_03'],
			implode(', ', array_map(function ($item) {
				return '<b>'.$item.'</b>';
			}, [
				'ticketing',			// this includes reissues,refunds,voids, as they get mapped on the same service in IO
				'EMD',
				'MCO',
				'hotel',
				'car',
				'train',
				'insurance',
				'groundTransportation',
				'transfer',
			])),
		);

		$help->description.= sprintf($this->lang['index']['GdsAmadeus']['description_04'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/Gds/Amadeus', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/Gds/Amadeus')->getLabel()
			),
		);

		return $help;
	}


	private function getGdsSabreHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['GdsSabre']['title'];

		$help->description = '';
		$help->description.= sprintf($this->lang['index']['GdsSabre']['description_01'],
			'<b>sabre</b>',
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/SystemManagement', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/SystemManagement')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsSabre']['description_02'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/Services', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/Services')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsSabre']['description_03'],
			implode(', ', array_map(function ($item) {
				return '<b>'.$item.'</b>';
			}, [
				'ticketing',			// this includes reissues,refunds,voids, as they get mapped on the same service in IO
				'EMD',
				'MCO',
				'hotel',
				'car',
				'train',
				'airTaxi',
				'NDCTicketing',
				'LCCTicketing',
			])),
		);

		$help->description.= sprintf($this->lang['index']['GdsSabre']['description_04'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/Gds/Sabre', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/Gds/Sabre')->getLabel()
			),
		);

		return $help;
	}

	private function getGdsGalileoHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['GdsGalileo']['title'];

		$help->description = '';
		$help->description.= sprintf($this->lang['index']['GdsGalileo']['description_01'],
			'<b>galileo</b>',
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/SystemManagement', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/SystemManagement')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsGalileo']['description_02'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/Services', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/Services')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsGalileo']['description_03'],
			implode(', ', array_map(function ($item) {
				return '<b>'.$item.'</b>';
			}, [
				'ticketing',			// this includes reissues,refunds,voids, as they get mapped on the same service in IO
				'EMD',
				'MCO',
				'hotel',
				'car',

				'surface',
				'NDCTicketing',
				'NDCEMD',
				'LCCTicketing',
			])),
		);

		$help->description.= sprintf($this->lang['index']['GdsGalileo']['description_04'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/Gds/Galileo', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/Gds/Galileo')->getLabel()
			),
		);

		return $help;
	}


	private function getGdsWorldspanHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['GdsWorldspan']['title'];

		$help->description = '';
		$help->description.= sprintf($this->lang['index']['GdsWorldspan']['description_01'],
			'<b>worldspan</b>',
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/SystemManagement', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/SystemManagement')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsWorldspan']['description_02'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/Services', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/Services')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsWorldspan']['description_03'],
			implode(', ', array_map(function ($item) {
				return '<b>'.$item.'</b>';
			}, [
				'ticketing',			// this includes reissues,refunds,voids, as they get mapped on the same service in IO
				'EMD',
				'MCO',

				'spoil',	// I'm not sure what we should do with Spoil's
			])),
		);

		$help->description.= sprintf($this->lang['index']['GdsWorldspan']['description_04'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/Gds/Worldspan', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/Gds/Worldspan')->getLabel()
			),
		);

		return $help;
	}



	private function getGdsApolloHelp() :\Modules\Admin\Config\Assistant\Help_General
	{
		$help = new \Modules\Admin\Config\Assistant\Help_General();

		$help->title = $this->lang['index']['GdsApollo']['title'];

		$help->description = '';
		$help->description.= sprintf($this->lang['index']['GdsApollo']['description_01'],
			'<b>worldspan</b>',
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/SystemManagement', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/SystemManagement')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsApollo']['description_02'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/ImportedOrders/Services', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/ImportedOrders/Services')->getLabel()
			),
		);

		$help->description.= sprintf($this->lang['index']['GdsApollo']['description_03'],
			implode(', ', array_map(function ($item) {
				return '<b>'.$item.'</b>';
			}, [
				'ticketing',			// this includes reissues,refunds,voids, as they get mapped on the same service in IO
				'EMD',
				'MCO',
				'hotel',
				'car',
				'surface',
			])),
		);

		$help->description.= sprintf($this->lang['index']['GdsApollo']['description_04'],
			sprintf('<a href=%s target="_blank">%s</a>',
				\Engine\Mvc\Dispatcher::getInstance()->getAppUrl('Modules/Admin/Config/Gds/Apollo', ''),
				\App\Menu\Structure\Menu::getInstance()->getStructure()->getChildByPath('Modules/Admin/Config/Gds/Apollo')->getLabel()
			),
		);

		return $help;
	}


}
