<?php
namespace App\Galileo\NDCLineParser\Types;

/**
 * Data line
 * @author Lucian Sirbu
 */
class Data_EMD extends \App\Galileo\LineParser\Types\GalileoBase
{
	protected $extractRegexp = "/^(?P<rawData>FT-#TAS[0-9]+#EMD-(A|S)\/P[0-9]+\/.+)/";
	protected $useCustomRegexp = true;

	/**
	 * Children elements
	 */
	protected $children = [
		[ 'key'=>'FT',  	                     'type'=>'Constant',        			 'val'=> 'FT-',                           'label'=>'DOCI-FREETEXT-#' ],
		[ 'key'=>'TAS',                          'type'=>'Constant',                     'val'=> '#TAS', ],
		[ 'key'=>'fareNumber',                   'type'=>'Integer',              'len' => 2, ],
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '#', ],

		[ 'key'=>'EMD',                          'type'=>'Constant',                     'val'=> 'EMD-', ],
		[ 'key'=>'type',                         'type'=>'Set',              'len' => 1, 'val'=> ['A', 'S', ], ],
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/P', ],
		[ 'key'=>'passengerIdentifier',          'type'=>'integer',          'len' => 1, ],
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
		[ 'key'=>'ticketNumber',                 'type'=>'Digits', ],
	];
}
