<?php
namespace App\Sabre\LineParser\Types\Line;

/**
 *
 * @author Lucian Sirbu
 */
class MY extends \App\Sabre\LineParser\Types\SabreBaseLine
{
	protected $extractRegexp = "/^(?P<rawData>.*)/sm";

	/**
	 * MY – Miscellaneous Record
	 * The MY Record will include Profile Index (PI) data included in the *PI field of the PNR and will include the
	 * Profile Type, Profile details and Associated Information when applicable.
	 */

	/**
	 * Children elements
	 */
	protected $children = [
	    ['key'=>'IUYPID',            'type'=>'Constant',     'len'=>2,       'val'=>'MY',    'label'=>'IUXMID'],    // MESSAGE ID - "MY"
	    ['key'=>'IUYPIN',            'type'=>'StringTrim',    'len'=>3,                       'label'=>'IUYPIN'],
		['key'=>'IUYTYP',            'type'=>'StringTrim',    'len'=>2,                       'label'=>'IUYTYP'],

		/* PROFILE INDEX CODE
		 * 	Corporate (CORPID)
		 * 	Operation (OPX)
		 * 	Traveler (TVL)
		 * 	TAgency (AGY)
		 * 	Group (GRP)
		 * */
		['key'=>'IUYPIC',  	   'type'=>'StringTrim',                                       'label'=>'IUYPIC'],
		['key'=>'NL',            'type'=>'NewLine', 'req'=>false,],

		['key'=>'IUYDET', 	                                       'req' =>false,          'rep'=> [1, PHP_INT_MAX], 'children' => [
			['key'=>'line',  	   'type'=>'WholeLine', 'req' => true,],
		]],
		['key'=>'IUYASP', 	                                       'req' =>false,          'rep'=> [1, PHP_INT_MAX], 'children' => [
			['key'=>'line',  	   'type'=>'WholeLine', 'req' => true,],
		]],

		['key'=>'NL_END',        'type'=>'NewLine', 'req'=>false,],
	];
}
