<?php
namespace App\Galileo\StructureParser\Structures\Car;

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

		$item = new \App\Galileo\StructureParser\Types\Price();

		if (count($parsedStructure['A168'])>1) {
			$this->transaction->getMessagesCollector()->addWarning(sprintf("[%s] There are multiple A168 lines defined. Using only the first one", __METHOD__)); // TODO: [cleanMsgs-transactionGDSs] refactor this from GDSs
		}

		$A16 = $parsedStructure['A168'][0];

		$item->componentSetAndUpdateTotal(new \App\Utils\BaseParser\Structure\StructureParser\Types\PriceComponent(
			'supplier',
			'A16ODD_:rateQuoted',
			$A16['A168OD']['A16ODD_']['rateQuoted']['amount'],
			null,
			$A16['A168OD']['A16ODD_']['rateQuoted']['currency']
		));

		return $item;
	}
}
