<?php

///////////////////////////////////////////////////////////////////////////////////////////////////
// Define each field of the current Entity - for each field you can set the following keys: ///////
// 'mandatory', 'invisible' and 'validation'. Use the '_special' field key code to allow adding ///
// extra validations that are not checked automatically. //////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

// serviceCode
$CFG['globalEntity']['::Service']['serviceCode']['mandatory']=true;
$CFG['globalEntity']['::Service']['serviceCode']['invisible']=false;
$CFG['globalEntity']['::Service']['serviceCode']['validation']=['maxLength'=>2];
// the "category" field - automatically determined based on external configs
// the "productType" field - automatically determined based on external configs
// the "multiplier" field - automatically determined based on external configs
// the "serviceSource" field - automatically determined based on external configs
// the "productName" and idSupplierProduct fields - automatically determined based on external configs

// departureCountry
$CFG['globalEntity']['::Service']['departureCountryCode']['mandatory']=false;
$CFG['globalEntity']['::Service']['departureCountryCode']['invisible']=false;
$CFG['globalEntity']['::Service']['departureCountryCode']['validation']=['maxLength'=>2];
// departureCity
$CFG['globalEntity']['::Service']['departureCityId']['mandatory']=false;
$CFG['globalEntity']['::Service']['departureCityId']['invisible']=false;
$CFG['globalEntity']['::Service']['departureCityId']['validation']=['type'=>'int', 'minValue'=>0];
// departureAirport
$CFG['globalEntity']['::Service']['departureStationCode']['mandatory']=false;
$CFG['globalEntity']['::Service']['departureStationCode']['invisible']=false;
$CFG['globalEntity']['::Service']['departureStationCode']['validation']=['maxLength'=>10];
// destinationCountry
$CFG['globalEntity']['::Service']['destinationCountryCode']['mandatory']=false;
$CFG['globalEntity']['::Service']['destinationCountryCode']['invisible']=false;
$CFG['globalEntity']['::Service']['destinationCountryCode']['validation']=['maxLength'=>2];
// destinationCity
$CFG['globalEntity']['::Service']['destinationCityId']['mandatory']=false;
$CFG['globalEntity']['::Service']['destinationCityId']['invisible']=false;
$CFG['globalEntity']['::Service']['destinationCityId']['validation']=['type'=>'int', 'minValue'=>0];
// destinationAirport
$CFG['globalEntity']['::Service']['destinationStationCode']['mandatory']=false;
$CFG['globalEntity']['::Service']['destinationStationCode']['invisible']=false;
$CFG['globalEntity']['::Service']['destinationStationCode']['validation']=['maxLength'=>10];

// service period
$CFG['globalEntity']['::Service']['period']['mandatory']=false;
$CFG['globalEntity']['::Service']['period']['invisible']=false;
$CFG['globalEntity']['::Service']['period']['validation']=['minValue'=>date(MYSQL_FORMAT, strtotime('-3 years')), 'maxValue'=>date(MYSQL_FORMAT, strtotime('+3 years'))];

// estimated invoice date
$CFG['globalEntity']['::Service']['estInvoiceDate']['mandatory']=false;
$CFG['globalEntity']['::Service']['estInvoiceDate']['invisible']=false;
$CFG['globalEntity']['::Service']['estInvoiceDate']['validation']=['minValue'=>date(MYSQL_FORMAT, strtotime('-6 months')), 'maxValue'=>date(MYSQL_FORMAT, strtotime('+2 years'))];

// estimated cash date
$CFG['globalEntity']['::Service']['estCashDate']['mandatory']=false;
$CFG['globalEntity']['::Service']['estCashDate']['invisible']=false;
$CFG['globalEntity']['::Service']['estCashDate']['validation']=['minValue'=>date(MYSQL_FORMAT, strtotime('-6 months')), 'maxValue'=>date(MYSQL_FORMAT, strtotime('+2 years'))];

// description
$CFG['globalEntity']['::Service']['description']['mandatory']=false;
$CFG['globalEntity']['::Service']['description']['invisible']=false;
$CFG['globalEntity']['::Service']['description']['validation']=[];

// preferences
$CFG['globalEntity']['::Service']['preferences']['mandatory']=false;
$CFG['globalEntity']['::Service']['preferences']['invisible']=false;
$CFG['globalEntity']['::Service']['preferences']['validation']=[];

// comments
$CFG['globalEntity']['::Service']['comments']['mandatory']=false;
$CFG['globalEntity']['::Service']['comments']['invisible']=false;
$CFG['globalEntity']['::Service']['comments']['validation']=[];

// remarks
$CFG['globalEntity']['::Service']['remarks']['mandatory']=false;
$CFG['globalEntity']['::Service']['remarks']['invisible']=false;
$CFG['globalEntity']['::Service']['remarks']['validation']=[];

// idUser
$CFG['globalEntity']['::Service']['idUser']['mandatory']=true;
$CFG['globalEntity']['::Service']['idUser']['invisible']=false;
$CFG['globalEntity']['::Service']['idUser']['validation']= ['type'=>'int', 'minValue'=>1];

// idOffice
$CFG['globalEntity']['::Service']['idOffice']['mandatory']=true;
$CFG['globalEntity']['::Service']['idOffice']['invisible']=false;
$CFG['globalEntity']['::Service']['idOffice']['validation']= ['type'=>'int', 'minValue'=>1];


// SPECIAL CONFIGS ////////////////////////////////////////////////////////////////////////////////

// service cancel reasons
$CFG['globalEntity']['::Service']['_special']['serviceCancelReasons'] = ['serviceRedone', 'duplicatedService', 'noOffersFound', 'priceHigh', 'justInformative', 'noConfirmFromClient', 'cancelledInExtSys', 'unknown'];

// allow cancel of orders with associated supplier invoices
$CFG['globalEntity']['::Service']['_special']['allowOrderCancelWithSupplierInvoices'] = false;


