<?php

namespace App\ReportsData\EntityFields;

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

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


	protected function getCustomValues($fieldName)
	{

		switch ($fieldName) {
			case 'fullName':
				$this->values[$fieldName] = trim($this->values['firstName'].' '.$this->values['lastName']);
				return $this->values[$fieldName];
			case 'office':
				return new Office($this->values['idOffice']);
			case 'department':
				return new Department($this->values['idDepartment']);

			default:
				return parent::getCustomValues($fieldName);
		}

	}

	protected function processDefaultValues()
	{
		$this->values['processedRemarks'] = ($this->values['processedRemarks'])?json_decode($this->values['processedRemarks'], true):[];
	}
}
