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

/**
 * Data line
 * @author Lucian Sirbu
 */
class Data_OID extends \App\Galileo\LineParser\Types\GalileoBase
{
	protected $extractRegexp = "/^(?P<rawData>FT-#TAS[0-9]+#OID.+\/NDC)/";
	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'=>'OID',                          'type'=>'Constant',                     'val'=> 'OID', ],
		[ 'key'=>'airlineCode',                  'type'=>'StringTrim',        'len'=>2, ],
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
		[ 'key'=>'orderId',                      'type'=>'StringDelimitedByChar',        'val'=> '/' ],	// order ID
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
		[ 'key'=>'currency',                     'type'=>'StringDelimitedByChar',        'val'=> '/' ],
		[ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
		[ 'key'=>'NDC',                          'type'=>'Constant',                     'val'=> 'NDC', ],
	];
}
