<?php

namespace App\Reports\Sources\CorporateContracts;

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'=>"general"],
		'cont_number'			=> ['type'=>'string', 		'dbDef'=>"VARCHAR(50) NOT NULL DEFAULT ''", 			'cat'=>"general"],
		'cont_date'				=> ['type'=>'date', 		'dbDef'=>"DATE DEFAULT NULL", 							'cat'=>"general"],
		'cont_typeCode'			=> ['type'=>'string', 		'dbDef'=>"VARCHAR(20) NOT NULL DEFAULT ''",				'cat'=>"general"],
		'cont_typeName'			=> ['type'=>'string', 		'dbDef'=>"VARCHAR(30) NOT NULL DEFAULT ''",				'cat'=>"general"],
		'cont_expireDate'		=> ['type'=>'date', 		'dbDef'=>"DATE DEFAULT NULL", 							'cat'=>"general"],
		'cont_active'			=> ['type'=>'boolean', 		'dbDef'=>"TINYINT NOT NULL DEFAULT '0'", 				'cat'=>"general"],
		'cont_serviceCode'		=> ['type'=>'string', 		'dbDef'=>"VARCHAR(2) NOT NULL DEFAULT ''", 				'cat'=>"general"],
		'cont_serviceName'		=> ['type'=>'string', 		'dbDef'=>"VARCHAR(100) NOT NULL DEFAULT ''", 			'cat'=>"general"],
		'cont_content'			=> ['type'=>'string', 		'dbDef'=>"MEDIUMTEXT NOT NULL", 						'cat'=>"general"],
		'cont_fileName'			=> ['type'=>'string',		'dbDef'=>"VARCHAR(250) NOT NULL DEFAULT ''",			'cat'=>"general"],

		'user_respIdUser'			=> ['type'=>'numeric',	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT '0'", 		'cat'=>"responsible"],
		'user_respUserName'			=> ['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 			'cat'=>"responsible"],
		'user_respIdOffice'			=> ['type'=>'numeric', 	'dbDef'=>"SMALLINT NOT NULL DEFAULT '0'", 				'cat'=>"responsible"],
		'user_respOfficeName'		=> ['type'=>'string',	'dbDef'=>"VARCHAR(150) NOT NULL DEFAULT ''", 			'cat'=>"responsible"],
		'user_respIdDepartment'		=> ['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT '0'", 		'cat'=>"responsible"],
		'user_respDepartmentName' 	=> ['type'=>'string', 	'dbDef'=>"VARCHAR(100) NOT NULL DEFAULT ''", 			'cat'=>"responsible"],

		'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_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"],

		'user_idAddUser'			=> ['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT '0'", 		'cat'=>"admin"],
		'user_addUserName'			=> ['type'=>'string', 	'dbDef'=>"VARCHAR(101) NOT NULL DEFAULT ''", 			'cat'=>"admin"],
		'user_idUpdateUser'			=> ['type'=>'numeric', 	'dbDef'=>"SMALLINT UNSIGNED NOT NULL DEFAULT '0'", 		'cat'=>"admin"],
		'user_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_typeName' 			=> ['cont_typeCode'],
		'cont_serviceName' 			=> ['cont_serviceCode'],

		'user_addUserName' 			=> ['user_idAddUser'],
		'user_updateUserName'		=> ['user_idUpdateUser'],

		'user_respUserName' 		=> ['user_respIdUser'],
		'user_respOfficeName' 		=> ['user_respIdOffice'],
		'user_respDepartmentName' 	=> ['user_respIdDepartment'],

		'corp_alias'				=> ['corp_id'],
		'corp_companyName'			=> ['corp_id'],
		'corp_idSegment'			=> ['corp_id'],
		'corp_idAccountManager'		=> ['corp_id'],
		'corp_segmentName'			=> ['corp_idSegment'],
		'corp_accountManagerName'	=> ['corp_idAccountManager'],
	];

}
