<?php
namespace App\Amadeus\FileParser;

/**
 * The AMD block has 3 lines, thats why it does a getLine()/nextLine() combination
 * @author Lucian
 *
 */
class Line_AMD208 extends Line_AMD
{
	public function __construct($parser)
	{
		$composite = &$this->structure_findFirstElement($this->structure_MUC, [ 'name' => 'nationalSystemPNR']);
		$NSRECLOC= &$this->structure_findFirstElement($composite['childs'], [ 'name' => 'NSRECLOC']);

		unset($NSRECLOC['len']);
		$NSRECLOC['len_min'] = 1;
		$NSRECLOC['len_max'] = 20;

		$this->structure_MUC = $this->structure_insertAfterFirstElement($this->structure_MUC, [ 'name' => 'nationalSystemPNR'], [
			[ 'name' => 'DELIM',         'val' => ';',        'type' => 'AN',   'req' => '',  'len' => 1, ],
			[ 'name' => 'RSVNAC',                             'type' => 'AN',   'req' => '',  'len' => 3, ],
			[ 'name' => 'DELIM',         'val' => ';',        'type' => 'AN',   'req' => '',  'len' => 1, ],
			[ 'name' => 'RSVNNB',                             'type' => 'AN',   'req' => '',  'len_min' => 3, 'len_max' => 20, ],
		]);

		$this->structure_MUC[]= [ 'name' => 'DELIM',         'val' => ';',        'type' => 'AN',   'req' => 'M',  'len' => 1, ];
		$this->structure_MUC[]= [ 'name' => 'ORDID',                              'type' => 'AN', ];

		parent::__construct($parser);
	}
}
