<?php
namespace App\Bsp\HotUA\Lines\Transaction;

/**
 * Line parser
 * @author Lucian Sirbu
 */
class BKS30 extends \App\Bsp\HotUA\HOTBase
{
	protected $children = [
		['key'=>'SMSG',  'type'=>'Constant', 'val'=>'BKS',       'len'=>3,      'label'=>'Standard Message Identifier'],    // S/M/Standard Message Identifier
		['key'=>'SQNR',  'type'=>'Integer',                      'len'=>8,      'label'=>'Sequence Number'],                // S/M/Sequence Number
		['key'=>'STNQ',  'type'=>'Constant', 'val'=>'30',        'len'=>2,      'label'=>'Standard Numeric Qualifier'],     // S/M/Standard Numeric Qualifier
		['key'=>'DAIS',  'type'=>'Date',     'fmt'=>'YYMMDD',    'len'=>6,      'label'=>'Date of Issue'],                  // S/M/Date of Issue
		['key'=>'TRNN',  'type'=>'Integer',                      'len'=>6,      'label'=>'Transaction Number'],             // S/M/Transaction Number
		['key'=>'TDNR_airline',       'type'=>'StringRaw',       'len'=>3,      'label'=>'Ticket/Document Number(airline number)'],// S/M/Ticket/Document Number
		['key'=>'TDNR_ticketNumber',  'type'=>'StringRaw',       'len'=>10,     'label'=>'Ticket/Document Number'],
		['key'=>'TDNR_extra',         'type'=>'StringRaw',       'len'=>1,      'label'=>'Ticket/Document Number(extra digits)'],
		['key'=>'CDGT',  'type'=>'Digits',                       'len'=>1,      'label'=>'Check-Digit'],                    // S/M/Check-Digit
		['key'=>'COBL',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Commissionable Amount'],          // S/M/Commissionable Amount
		['key'=>'NTFA',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Net Fare Amount'],                // S/C/Net Fare Amount
		['key'=>'TMFT1', 'type'=>'StringTrim',                   'len'=>8,      'label'=>'Tax/Miscellaneous Fee Type'],     // S/C/Tax/Miscellaneous Fee Type
		['key'=>'TMFA1', 'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Tax/Miscellaneous Fee Amount'],   // S/C/Tax/Miscellaneous Fee Amount
		['key'=>'TMFT2', 'type'=>'StringTrim',                   'len'=>8,      'label'=>'Tax/Miscellaneous Fee Type'],     // S/C/Tax/Miscellaneous Fee Type
		['key'=>'TMFA2', 'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Tax/Miscellaneous Fee Amount'],   // S/C/Tax/Miscellaneous Fee Amount
		['key'=>'TMFT3', 'type'=>'StringTrim',                   'len'=>8,      'label'=>'Tax/Miscellaneous Fee Type'],     // S/C/Tax/Miscellaneous Fee Type
		['key'=>'TMFA3', 'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Tax/Miscellaneous Fee Amount'],   // S/C/Tax/Miscellaneous Fee Amount
		['key'=>'TDAM',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Ticket/Document Amount'],         // S/M/Ticket/Document Amount
		['key'=>'RESD',  'type'=>'StringTrim',                   'len'=>2,      'label'=>'Reserved Space'],                 //  /M/Reserved Space
		['key'=>'CUTP',  'type'=>'StringRaw',                    'len'=>3,      'label'=>'Currency Type'],                  // S/M/Currency Type
		['key'=>'CUTP_decimals','type'=>'Integer',               'len'=>1,      'label'=>'Currency Type(decimals)'],        // S/M/Currency Type
	];

	protected function postExtract(\App\Utils\BaseParser\TextParser\ExtractedBlock $ret)
	{
		$ret = $this->postProcessPriceAmount($ret, $this->children, $ret->extractedData['CUTP_decimals']);

		return $ret;
	}
}
