<?php

namespace App\Reports\Sources\CorporateContacts;

class ColumnsManager extends \App\Reports\Sources\ColumnsManagerAbstract
{

	/**
	 * The definition of report source columns.
	 * @var array
	 */
	protected array $columnsCfg = [
		'cont_id'					=>['type'=>'numeric', 	'dbDef'=>"INT UNSIGNED NOT NULL", 					'cat'=>"contact"],
		'cont_type'					=>['type'=>'string', 	'dbDef'=>"VARCHAR(20) NOT NULL DEFAULT ''", 		'cat'=>"contact"],
		'cont_datetime'				=>['type'=>'datetime', 	'dbDef'=>"DATETIME NULL DEFAULT NULL", 				'cat'=>"contact"],
		'cont_duration'				=>['type'=>'string', 	'dbDef'=>"TIME NULL DEFAULT NULL", 					'cat'=>"contact"],
		'cont_topics'				=>['type'=>'string', 	'dbDef'=>"TEXT NOT NULL", 							'cat'=>"contact"],
		'cont_description'			=>['type'=>'string', 	'dbDef'=>"TEXT NOT NULL", 							'cat'=>"contact"],
		'cont_comments'				=>['type'=>'string', 	'dbDef'=>"TEXT NOT NULL", 							'cat'=>"contact"],
		'cont_idContactPerson'		=>['type'=>'numeric', 	'dbDef'=>"INT UNSIGNED NOT NULL DEFAULT 0", 		'cat'=>"contact"],
		'cont_contactPersonName'	=>['type'=>'string', 	'dbDef'=>"VARCHAR(201) NOT NULL DEFAULT ''", 		'cat'=>"contact"],

		'cont_idUser'			=>['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT 0", 				'cat'=>"contact"],
		'cont_userName'			=>['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 			'cat'=>"contact"],
		'user_idOffice'			=>['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat'=>"contact"],
		'user_officeName'		=>['type'=>'string', 	'dbDef'=>"varchar(150) NOT NULL DEFAULT ''", 			'cat'=>"contact"],
		'user_idDepartment'		=>['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat'=>"contact"],
		'user_departmentName'	=>['type'=>'string', 	'dbDef'=>"varchar(100) NOT NULL DEFAULT ''", 			'cat'=>"contact"],


		'corp_id'				=>['type'=>'numeric', 	'dbDef'=>"INT UNSIGNED NOT NULL DEFAULT 0", 			'cat'=>"corporate"],
		'corp_alias'			=>['type'=>'string', 	'dbDef'=>"VARCHAR(100) NULL DEFAULT NULL", 				'cat'=>"corporate"],
		'corp_companyName'		=>['type'=>'string', 	'dbDef'=>"VARCHAR(170) NULL DEFAULT NULL", 				'cat'=>"corporate"],
		'corp_locked'			=>['type'=>'boolean', 	'dbDef'=>"TINYINT UNSIGNED NOT NULL DEFAULT 0", 		'cat'=>"corporate"],
		'corp_lockedComments'	=>['type'=>'string', 	'dbDef'=>"TEXT NOT NULL", 								'cat'=>"corporate"],

		'corp_status'				=>['type'=>'string', 	'dbDef'=>"VARCHAR(50) NOT NULL DEFAULT ''", 				'cat'=>"corporate"],
		'corp_idSegment'			=>['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT 0", 			'cat'=>"corporate"],
		'corp_segmentName'			=>['type'=>'string', 	'dbDef'=>"VARCHAR(100) NOT NULL DEFAULT ''", 				'cat'=>"corporate"],
		'corp_idAccountManager'		=>['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT 0", 			'cat'=>"corporate"],
		'corp_accountManagerName'	=>['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 				'cat'=>"corporate"],
		'corp_duplicated'			=>['type' => 'boolean',	'dbDef' => "TINYINT UNSIGNED NOT NULL DEFAULT 0",			'cat'=>"corporate"],
		'corp_idOriginal'			=>['type' => 'numeric',	'dbDef' => "INT UNSIGNED NOT NULL DEFAULT 0",				'cat'=>"corporate"],

		'cont_idAddUser'				=>['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT 0", 			'cat'=>"admin"],
		'cont_addUserName'				=>['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 		'cat'=>"admin"],
		'cont_addUserOfficeId'			=>['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT 0", 			'cat'=>"admin"],
		'cont_addUserOfficeName'		=>['type'=>'string', 	'dbDef'=>"VARCHAR(150) NOT NULL DEFAULT ''", 		'cat'=>"admin"],

		'cont_idUpdateUser'				=>['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT 0", 			'cat'=>"admin"],
		'cont_updateUserName'			=>['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 		'cat'=>"admin"],

		'cont_addTime'			=>['type'=>'datetime', 	'dbDef'=>"DATETIME NULL", 							'cat'=>"admin"],
		'cont_lastUpdateTime'	=>['type'=>'datetime', 	'dbDef'=>"DATETIME NULL DEFAULT NULL", 				'cat'=>"admin"],
		'cont_updatesCount'		=>['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT 0", 			'cat'=>"admin"],
	];

	/**
	 * The primary key column.
	 * @var string
	 */
	protected string $primaryKeyColumn = 'cont_id';

	/**
	 * The columns that are forced into the report.
	 * @var array
	 */
	protected array $forcedColumns = [];

	/**
	 * The columns dependencies list.
	 * @var array
	 */
	protected array $columnsDependencies = [
		'cont_contactPersonName'	=> ['cont_idContactPerson'],
		'corp_alias'				=> ['corp_id'],
		'corp_companyName'			=> ['corp_id'],
		'corp_locked'				=> ['corp_id'],
		'corp_lockedComments'		=> ['corp_id'],
		'corp_status'				=> ['corp_id'],
		'corp_idSegment'			=> ['corp_id'],
		'corp_segmentName'			=> ['corp_idSegment'],
		'corp_idAccountManager'		=> ['corp_id'],
		'corp_accountManagerName'	=> ['corp_idAccountManager'],

		'user_officeName'			=> ['user_idOffice'],
		'user_departmentName'		=> ['user_idDepartment'],

		'cont_addUserName'			=> ['cont_idAddUser'],
		'cont_addUserOfficeId'		=> ['cont_idAddUser'],
		'cont_addUserOfficeName'	=> ['cont_addUserOfficeId'],

		'cont_updateUserName'		=> ['cont_idUpdateUser'],
	];

}
