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

/**
 * Line parser
 * @author Lucian Sirbu
 */
class BKS39 extends \App\Bsp\Hot230\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'=>'39',        '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'=>'STAT',  'type'=>'StringTrim',                   'len'=>3,      'label'=>'Statistical Code', ],               // S/C/Statistical Code
		[ 'key'=>'COTP',  'type'=>'StringTrim',                   'len'=>6,      'label'=>'Commission Type', ],                // S/C/Commission Type
		[ 'key'=>'CORT',  'type'=>'Integer',                      'len'=>5,      'label'=>'Commission Rate', ],                // S/M/Commission Rate
		[ 'key'=>'COAM',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Commission Amount', ],              // S/M/Commission Amount
		[ 'key'=>'SPTP',  'type'=>'StringRaw',                    'len'=>6,      'label'=>'Supplementary Type', ],             // S/C/Supplementary Type
		[ 'key'=>'SPRT',  'type'=>'Integer',                      'len'=>5,      'label'=>'Supplementary Rate', ],             // S/C/Supplementary Rate
		[ 'key'=>'SPAM',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Supplementary Amount', ],           // S/C/Supplementary Amount
		[ 'key'=>'EFRT',  'type'=>'Integer',                      'len'=>5,      'label'=>'Effective Commission Rate', ],      // S/M/Effective Commission Rate
		[ 'key'=>'EFCO',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Effective Commission Amount', ],    // S/M/Effective Commission Amount
		[ 'key'=>'APBC',  'type'=>'PriceAmount',                  'len'=>11,     'label'=>'Amount Paid by Customer', ],        // S/C/Amount Paid by Customer
		[ 'key'=>'RDII',  'type'=>'StringRaw',                    'len'=>1,      'label'=>'Routing domestic/international indicator', ],
		[ 'key'=>'CCAI',  'type'=>'StringRaw',                    'len'=>1,      'label'=>'Commission Control Adjustment Indicato', ],
		[ 'key'=>'RESD',  'type'=>'StringTrim',                   'len'=>16,     'label'=>'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;
	}
}
