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

/**
 *
 * @author Lucian Sirbu
 */
class M0 extends \App\Sabre\LineParser\Types\SabreBaseLine
{
	/**
	 * M0 – Control and Constant Data Record
	 */

	/**
	 * Children elements
	 */
	protected $children = [
	    ['key'=>'IU0MID',            'type'=>'Constant',     'len'=>2,       'val'=>'M0',    'label'=>'IU0MID'],    // RECORD IDENTIFIER - "M0"
	    /**
	     * TRANSACTION TYPE,
	     * 	"1" = INVOICE/TICKET,
	     * 	"2" = INVOICE ONLY, (DIN ENTRIES),
	     * 	"3" = ITINERARY ONLY, (DIT ENTRIES), (MINI-ITIN ENTRIES),
	     * 	"4" = BOARDING PASS ONLY, (BOARDING PASS ENTRIES),
	     * 	"5" = VOID TICKET, (WV ENTRIES),
	     * 	"6" = FARE INFORMATION,
	     * 	"7" = PURGED RECORD,
	     * 	"A" = INVOICE/EMD,
	     * 	"B" = INVOICE/TICKET/EMD,
	     * 	"C" = VOID EMD, (WV ENTRIES)
		 * 	in 2020-04-15 as part of some NDC-related changes on Sabre's side, 2 new values are possible:
		 * 	“T” =INVOICE/NDC TICKET
		 * 	“E” =INVOICE/NDC EMD
	     */
	    ['key'=>'IU0TYP',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0TYP'],
	    ['key'=>'IU0VER',            'type'=>'StringTrim',    'len'=>2,                       'label'=>'IU0VER'],    // INTERFACE VERSION NUMBER
	    ['key'=>'IU0DKN',                                    'len'=>10,      'children'=> [                     // CUSTOMER NUMBER
	        ['key'=>'IU0DKB',        'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0DKB'],    // CUSTOMER BRANCH
	        ['key'=>'IU0DKC',        'type'=>'StringTrim',    'len'=>7,                       'label'=>'IU0DKC'],    // CUSTOMER NUMBER
		]],
	    ['key'=>'IU0CTJ',            'type'=>'Constant',     'len'=>5,       'val'=>'     ', 'label'=>'IU0CTJ'],    // BLANK
	    ['key'=>'IU0PIV',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0PIV'],    // PREVIOUSLY INVOICED INDICATOR, BLANK = NO, "Y"  = YES
	    ['key'=>'IU0RRC',            'type'=>'StringTrim',    'len'=>2,                       'label'=>'IU0RRC'],    // PNR RECORD CONTROL CHECK, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0QUE',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0QUE'],    // TYPE OF QUEUE PROCESSING, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0CDK',            'type'=>'Constant',     'len'=>1,       'val'=>' ',     'label'=>'IU0CDK'],    // SPARE
	    ['key'=>'IU0IVN',            'type'=>'StringTrim',    'len'=>7,                       'label'=>'IU0IVN'],    // INVOICE NUMBER, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0ATC',            'type'=>'StringTrim',    'len'=>10,                      'label'=>'IU0ATC'],    // AGENCY ARC/IATA NUMBER
	    ['key'=>'IU0PNR',            'type'=>'StringTrim',    'len'=>8,                       'label'=>'IU0PNR'],    // PNR LOCATOR
	    ['key'=>'IU0PNL',            'type'=>'StringTrim',    'len'=>8,                       'label'=>'IU0PNL'],    // LINK PNR LOCATOR, BLANK = PRINT REQUEST FOR ET, (AMTRAK RECORD LOCATOR)
	   	['key'=>'IU0OPT',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0OPT'],    // SUBSCRIBER INTERFACE OPTION INDICATOR, "5" = OPTION 5, "6" = OPTION 6
        ['key'=>'IU0F00',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F00'],    // PHONE, AND RECEIVED INDICATOR, "0" = NO, "1" = YES
        ['key'=>'IU0F01',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F01'],    // ENTITLEMENTS, "0" = NO, "1" = YES
        ['key'=>'IU0F02',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F02'],    // FARE CALCULATION, "0" = NO, "1" = YES
        ['key'=>'IU0F03',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F03'],    // INVOICE/ITINERARY REMARKS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F04',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F04'],    // INTERFACE REMARKS, "0" = NO, "1" = YES
        ['key'=>'IU0F05',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F05'],    // STATUTE MILES, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F06',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F06'],    // OPTION 6 ITINERARIES TO POS Q (DIT ENTRY), BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F07',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0F07'],    // CUSTOMER PROFITABILITY RECORDS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = ALL CUSTOMER NUMBERS, "2" = SPECIFIC BY CUSTOMER, NUMBER
        ['key'=>'IU0F08',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F08'],    // MISCELLANEOUS CHARGE ORDER RECORDS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F09',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F09'],    // PRE-PAID TICKET ADVICE RECORDS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F0A',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F0A'],    // TOUR ORDER RECORDS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        ['key'=>'IU0F0B',            'type'=>'Bool01B',      'len'=>1,                       'label'=>'IU0F0B'],    // SEGMENT ASSOCIATED REMARKS RECORDS, BLANK = PRINT REQUEST FOR ET, "0" = NO, "1" = YES
        #Array( 'key'=>'IU0F0C',            'type'=>'Constant',     'len'=>1,       'val'=>'0',     'label'=>'IU0F0C' ),    // SPARE
	    ['key'=>'IU0F0C',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F0C'],    // SPARE
        ['key'=>'IU0F0D',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F0D'],    // NAME ASSOCIATED REMARKS
        ['key'=>'IU0F0E',            'type'=>'Bool01',       'len'=>1,                       'label'=>'IU0F0E'],    // AMOUNTS MOVED TO MX RECORD
        // Array( 'key'=>'IU0F0F',            'type'=>'Constant',     'len'=>1,       'val'=>'0',     'label'=>'IU0F0F' ),    // SPARE
		['key'=>'IU0F0F',            'type'=>'Bool01',     'len'=>1,                          'label'=>'IU0F0F'],    // SPARE
	    ['key'=>'IU0ATB',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0ATB'],    // ATB INDICATORS, "0" = NON ATB, " 1" = ATB TICKET, "2" = REPRINTED ATB DOCUMENTS, "3" = ATB MINI-ITINERARY
	    ['key'=>'IU0DUP',            'type'=>'StringTrim',    'len'=>1,                       'label'=>'IU0DUP'],    // DUPLICATE INTERFACE INDICATOR, BLANK = NORMAL TRANSACTION, "D"    = DUPLICATE RECORD
	    ['key'=>'IU0BPC',                                    'len'=>10,      'children'=> [                     // BOOKING AGENT INFORMATION
	        ['key'=>'IU0PCC',        'type'=>'StringTrim',    'len'=>5,                       'label'=>'IU0PCC'],    // BOOKING AGENT LOCATION
	        ['key'=>'IU0IDC',        'type'=>'StringTrim',    'len'=>2,                       'label'=>'IU0IDC'],    // BOOKING AGENT DUTY CODE
	        ['key'=>'IU0IAG',        'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0IAG'],    // BOOKING AGENT SINE
		]],
	    ['key'=>'IU0LIN',            'type'=>'StringTrim',    'len'=>8,                       'label'=>'IU0LIN'],    // LNIATA
	    ['key'=>'IU0RPR',            'type'=>'StringTrim',    'len'=>10,                      'label'=>'IU0RPR'],    // REMOTE PRINTER ARC NUMBER, (PRESENT ONLY IF ATB REMOTE PRINT, DOCUMENTS WERE GENERATED)
	    ['key'=>'IU0PDT',            'type'=>'Date',          'len'=>5,                       'label'=>'IU0PDT', 'ref'=>'determinedFileDate','onlyPast'=>true,],    // PNR CREATION DATE, (DATE MONTH - BASED ON US CST ZONE), BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0TIM',            'type'=>'StringTrim',    'len'=>5,                       'label'=>'IU0TIM'],    // TIME PNR CREATED, (24 HOUR CLOCK- BASED ON US CST ZONE), BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0IS4',            'type'=>'StringTrim',    'len'=>5,                       'label'=>'IU0IS4'],    // INVOICING AGENCY CITY CODE
	    ['key'=>'IU0IS1',            'type'=>'StringTrim',    'len'=>2,                       'label'=>'IU0IS1'],    // INVOICING AGENT DUTY CODE, "*" OR "9 (MANAGER)"
	    ['key'=>'IU0IS3',            'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0IS3'],    // INVOICING AGENT CODE
	    ['key'=>'IU0TCO',            'type'=>'Constant',     'len'=>2,       'val'=>'  ',    'label'=>'IU0TCO'],    // SPARE
	    ['key'=>'IU0IDB',            'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0IDB'],    // BRANCH ID, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0DEP',            'type'=>'DateB',        'len'=>5,                       'label'=>'IU0DEP','ref'=>'determinedFileDate','onlyFuture'=>true,],    // DEPARTURE DATE, ST, "IU0DEP" IS TAKEN FROM THE 1 AIR SEGMENT, OF THE M3 RECORD. IF NO AIR SEGMENTS ARE, PRESENT IN THE M3 RECORD BLANKS WILL BE, PASSED.
	    ['key'=>'IU0ORG',            'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0ORG'],    // ORIGIN CITY CODE, ST, "IU0ORG" IS TAKEN FROM THE 1 AIR SEGMENT, OF THE M3 RECORD. IF NO AIR SEGMENTS ARE, PRESENT IN THE M3 RECORD BLANKS WILL BE, PASSED.
	    ['key'=>'IU0ONM',            'type'=>'StringTrim',    'len'=>17,                      'label'=>'IU0ONM'],    // ORIGIN CITY NAME, ST, "IU0OM" IS TAKEN FROM THE 1 AIR SEGMENT, OF THE M3 RECORD. IF NO AIR SEGMENTS ARE, PRESENT IN THE M3 RECORD BLANKS WILL BE, PASSED.
	    ['key'=>'IU0DST',            'type'=>'StringTrim',    'len'=>3,                       'label'=>'IU0DST'],    // DESTINATION CITY CODE, "IU0DST" IS TAKEN FROM THE LAST AIR, SEGMENT OF THE M3 RECORD. IF NO AIR, SEGMENTS ARE PRESENT IN THE M3 RECORD, BLANKS WILL BE PASSED.
	    ['key'=>'IU0DNM',            'type'=>'StringTrim',    'len'=>17,                      'label'=>'IU0DNM'],    // DESTINATION CITY NAME, "IU0DNM" IS TAKEN FROM THE LAST AIR, SEGMENT OF THE M3 RECORD. IF NO AIR, SEGMENTS ARE PRESENT IN THE M3 RECORD, BLANKS WILL BE PASSED.
	    ['key'=>'IU0NM1',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM1'],    // NUMBER OF PASSENGERS - M1
	    ['key'=>'IU0NM2',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM2'],    // NUMBER OF TICKETED PASSENGERS - M2
	    ['key'=>'IU0NM3',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM3'],    // NUMBER OF ITINERARY SEGMENTS - M3
	    ['key'=>'IU0NM4',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM4'],    // NUMBER OF ENTITLEMENTS - M4
	    ['key'=>'IU0NM5',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM5'],    // NUMBER OF ACCOUNTING LINES - M5
	    ['key'=>'IU0NM6',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM6'],    // NUMBER OF FARE CALC LINES - M6
	    ['key'=>'IU0NM7',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM7'],    // NUMBER OF ITINERARY REMARK LINES - M7
	    ['key'=>'IU0NM8',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM8'],    // NUMBER OF INVOICE REMARK LINES - M8
	    ['key'=>'IU0NM9',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NM9'],    // NUMBER OF INTERFACE REMARK LINES - M9
	    ['key'=>'IU0NMA',            'type'=>'Integer',      'len'=>3,                       'label'=>'IU0NMA'],    // NUMBER OF CUSTOMER PROFITABILITY ITEMS -, MA
	    ['key'=>'IU0ADC',            'type'=>'Constant',     'len'=>2,       'val'=>'  ',    'label'=>'IU0ADC'],    // SPARE
	    ['key'=>'IU0PHC',            'type'=>'Integer',      'len'=>2,                       'label'=>'IU0PHC'],    // NUMBER OF PHONE FIELDS PRESENT, BLANK = PRINT REQUEST FOR ET, (MAXIMUM OF 3)
	    ['key'=>'IU0TYM',            'type'=>'Time',         'len'=>5,       'fmt'=>'PHHMM', 'label'=>'IU0TYM'],    // IUR M0 RECORD CREATION TIME, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'IU0MDT',            'type'=>'Date',         'len'=>5,       'onlyPast'=>true,'label'=>'IU0MDT', 'ref'=>'fileDate',],    // IUR M0 RECORD CREATION DATE, BLANK = PRINT REQUEST FOR ET
	    ['key'=>'NL',                'type'=>'NewLine',],
	];
}
