<?php

namespace App\ReportsData\EntityFields;

class Country extends \App\ReportsData\EntityFields\GeneralAbstract
{

	/**
	 * The name of the PK column name for the current entity - usually 'id'.
	 * @var string
	 */
	protected $pkColumnName = 'code';

	/**
	 * Returns the table name that will store the current entity queue.
	 * @return string
	 */
	protected function getDbTableName()
	{
		global $DBTRd_countries;
		return $DBTRd_countries;
	}

	protected function getCustomValues($fieldName)
	{
		switch ($fieldName) {
			case 'continentName':
				$_LANG = \App\Loader_Lang::getInstance()->getGlobal();
				$this->values[$fieldName] = $_LANG['continents'][$this->values['continent']];
				return $this->values[$fieldName];

			case 'continentCode2':
				$CFG = \Engine\Loader_Cfg::getInstance()->getGlobal();
				$this->values[$fieldName] = $CFG['continentCodes'][$this->values['continent']];
				return $this->values[$fieldName];

			case 'zoneName':
				$_LANG = \App\Loader_Lang::getInstance()->getGlobal();
				$this->values[$fieldName] = $_LANG['locations']['countriesZones'][$this->values['zone']];
				return $this->values[$fieldName];
			default:
				return parent::getCustomValues($fieldName);
		}
	}

}
