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

/**
 * SSR line, no docs for it
 * @author Lucian Sirbu
 */
class Data_SSR extends \App\Galileo\LineParser\Types\GalileoBase
{
    // FT-#TAS01#SSR/P2/S1/SURE/0.00/1
    protected $extractRegexp = "/^(?P<rawData>FT-#TAS[0-9]+#SSR\/P[0-9\-\,\.]+\/S[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'=>'SSR',                          'type'=>'Constant',                     'val'=> 'SSR', ],
        [ 'key'=>'passengerIdentifier',          'type'=>'Constant',                     'val'=> '/P', ],
        [ 'key'=>'passengerIdentifier',          'type'=>'Association', ],
        [ 'key'=>'segmentNumber',                'type'=>'Constant',                     'val'=> '/S', ],
        [ 'key'=>'segmentNumber',                'type'=>'Association', ],
        [ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
        [ 'key'=>'SSR',                          'type'=>'StringDelimitedByChar',        'val'=> '/', ],
        [ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
        [ 'key'=>'unitCost',                     'type'=>'Price',                     ],
        [ 'key'=>'separator',                    'type'=>'Constant',                     'val'=> '/', ],
        [ 'key'=>'unknown01',                    'type'=>'StringRaw',                     ],
    ];
}
