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

/**
 *
 * @author Lucian Sirbu
 */
class RD extends \App\Worldspan\LineParser\Types\WorldspanBaseLine
{
	protected $extractRegexp = "/^(?P<rawData>D.+)/sm";

	protected $children = [
        /**
         * This record contains data required to process an exchange ticket transaction and complete the "original issue" box on the ticket
         * This record will also contain the original issue ticket/document number for the automated refund of an exchange ticket
         */

        ['key'=> 'key',                                              'type'=> 'Constant',          'len'=> 1,                    'val'=> 'D',   'req'=> true,],              // Record identifier
        ['key'=> 'DocumentTypeIndicatorTTkt',                        'type'=> 'Alphanumeric',      'len'=> 1,                                   'req'=> false,],             // Document type indicator (T=Tkt, M=MCO, O=Other, R=Automated refund of an exchange ticket)
        ['key'=> 'OriginalIssueDocumentNumber',                      'type'=> 'StringDelimitedByChar',   'len'=> [0, 14],         'val'=> '\\',  'req'=> false,],             // Original issue document number (default * if unknown)
        ['key'=> '#019',                                             'type'=> 'Separator',                                                      'req'=> false,],             // Field separator
        ['key'=> 'PlaceOfIssue',                                     'type'=> 'Alphanumeric',      'len'=> 3,                                   'req'=> false,],             // Place of issue (default * if unknown)
        ['key'=> '#021',                                             'type'=> 'Separator',                                                      'req'=> false,],             // Field separator
        ['key'=> 'OriginalIssueDate',                                'type'=> 'Date',              'len'=> 7,     'fmt'=> 'DDMMMYY',            'req'=> false,],             // Original issue date (only sent with place of issue)
        ['key'=> '#024',                                             'type'=> 'Separator',                                                      'req'=> false,],             // Field separator
        ['key'=> 'OriginalIssueAgency',                              'type'=> 'Integer',           'len'=> 7,                                   'req'=> false,],             // Original issue agency IATA (only sent with place/date of issue)
        ['key'=> 'key',                                              'type'=> 'Constant',          'len'=> 1,                    'val'=> 'D',   'req'=> false,],             // Record identifier
        ['key'=> 'key',                                              'type'=> 'Constant',          'len'=> 1,                    'val'=> 'P',   'req'=> false,],             // Document type indicator (P=print routine only)
        ['key'=> 'key',                                              'type'=> 'Constant',          'len'=> 1,                    'val'=> '*',  'req'=> false,],             // Asterisk (replaces original issue doc nbr)
        ['key'=> '#031',                                             'type'=> 'Separator',                                                      'req'=> false,],             // Field separator
        ['key'=> 'FreeformData',                                     'type'=> 'StringRaw',            'len'=> [0, 31],                        'req'=> false,],             // Freeform data to print in original issue box on tkt (default * if unknown)

	];
}
