<?php
namespace App\Sabre\StructureParser\Structures\Ticketing;

class Agent extends \App\Sabre\StructureParser\Structures\Base\Agent
{
	protected function _getData()
	{
		list($parsedStructure, , $transactionIndexes) = $this->getTransactionDetails();

		$item = new \App\Sabre\StructureParser\Types\Agent();
		$item->bookingAgent = 	new \App\Sabre\StructureParser\Types\User();
		$item->issuingAgent = 	new \App\Sabre\StructureParser\Types\User();

		$item->bookingAgent->idSystemOffice = 	$parsedStructure['M0']['M0']['IU0BPC']['IU0PCC'];
		$item->bookingAgent->idSystemUser = 	sprintf("%s-%s", $parsedStructure['M0']['M0']['IU0BPC']['IU0IAG'], $parsedStructure['M0']['M0']['IU0BPC']['IU0PCC']);

		$item->issuingAgent->idSystemOffice = 	$parsedStructure['M0']['M0']['IU0IS4'];
		$item->issuingAgent->idSystemUser = 	sprintf("%s-%s", $parsedStructure['M0']['M0']['IU0IS3'], $parsedStructure['M0']['M0']['IU0IS4']);
		$item->issuingAgent->officeIATACode = 	preg_replace('/ /', '', $parsedStructure['M0']['M0']['IU0ATC']);

		return $item;
	}
}
