<?php
namespace App\Amadeus\FileParser;

class Line_RIU extends \App\Amadeus\FileParser\Line_FPAbstract
{
	/**
	 * 4.167. RIU Invoice Auxiliary Form of Payment Remark
	 * see page 399(441)
	 *
	 * The RIU Invoice Remark is used when an All Auxiliary Invoice is needed and no TST exists in the PNR.
	 */
	protected $structure = [
		[ 'name'=> 'MSGTAG',  'val' => 'RIU',   'type' => 'AN',                     'len' => 3,],                          // 1 : Message Tag (RIU)
		[ 'name'=> 'INVTRM',                    'type' => 'AN',                     'len_min' => 1,   'len_max' => 64,],   // 2 : Free flow
		[ 'name'=> 'SEGASS',  'val' => ';S', 	'type' => 'ASSOC',                  ],
		[ 'name'=> 'PSGASS',  'val' => ';P',    'type' => 'ASSOC',                	],
	];

	protected function postParse()
	{
		parent::postParse();

		$FP = $this->FP_parse($this->tree['INVTRM'], $this->parser);

		// load data from $FP
		$this->tree['INVTRM_'] = [];
		foreach ($FP as $k=>$v){
			$this->tree['INVTRM_'][$k] = $v;
		}
	}
}
