<?php

namespace App\Reports\Sources\Tasks;

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

	/**
	 * The definition of report source columns.
	 * @var array
	 */
	protected array $columnsCfg = [
		'currentRowIndex'				=>['type'=>'numeric',  	'dbDef' => "INT UNSIGNED NOT NULL DEFAULT 0",    		'cat' => "general"],
		'task_id'						=>['type'=>'numeric', 	'dbDef' => "INT UNSIGNED NOT NULL DEFAULT 0", 			'cat' => "general"],
		'task_statusCode'				=>['type'=>'string', 	'dbDef' => "ENUM('notDistributed','distributed','refused','pending','inProgress','onHold','finished')", 'cat' => "general"],
		'task_statusName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(50) NOT NULL DEFAULT ''", 			'cat' => "general"],
		'task_statusDescription'		=>['type'=>'string', 	'dbDef' => "VARCHAR(250) NOT NULL DEFAULT ''", 			'cat' => "general"],
		'task_statusReasonCode'			=>['type'=>'string', 	'dbDef' => "VARCHAR(50) NOT NULL DEFAULT ''", 			'cat' => "general"],
		'task_statusReasonName'			=>['type'=>'string', 	'dbDef' => "VARCHAR(200) NOT NULL DEFAULT ''", 			'cat' => "general"],
		'task_date'						=>['type'=>'date', 		'dbDef' => "DATE NULL",  								'cat' => "general"],
		'task_dateYM'					=>['type'=>'yearMonth',	'dbDef' => "DATE NULL", 								'cat' => "general"],
		'task_dateY'					=>['type'=>'year', 		'dbDef' => "YEAR NULL",  								'cat' => "general"],
		'task_description'				=>['type'=>'string', 	'dbDef' => "TEXT NOT NULL", 							'cat' => "general"],

		'task_idDepartment'				=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0",	 	'cat' => "users"],
		'task_departmentName'			=>['type'=>'string', 	'dbDef' => "VARCHAR(100) NOT NULL DEFAULT ''", 			'cat' => "users"],
		'task_idOffice'					=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0",	 	'cat' => "users"],
		'task_officeName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(150) NOT NULL DEFAULT ''", 			'cat' => "users"],
		'task_idUser'					=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "users"],
		'task_userName'					=>['type'=>'string', 	'dbDef' => "VARCHAR(101) NOT NULL DEFAULT ''", 			'cat' => "users"],
		'task_assignorIdUser'			=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "users"],
		'task_assignorUserName'			=>['type'=>'string', 	'dbDef' => "VARCHAR(101) NOT NULL DEFAULT ''", 			'cat' => "users"],

		'task_idOperationType'			=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0",	 	'cat' => "details"],
		'task_operationTypeName'		=>['type'=>'string', 	'dbDef' => "VARCHAR(250) NOT NULL DEFAULT ''", 			'cat' => "details"],
		'task_idCategory'				=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "details"],
		'task_categoryName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(100) NOT NULL DEFAULT ''", 			'cat' => "details"],
		'task_priorityCode'				=>['type'=>'numeric', 	'dbDef' => "TINYINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "details"],
		'task_priorityName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(30) NOT NULL DEFAULT ''", 			'cat' => "details"],
		'task_comments'					=>['type'=>'string', 	'dbDef' => "TEXT NOT NULL", 							'cat' => "details"],
		'task_free'						=>['type'=>'boolean', 	'dbDef' => "TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", 	'cat' => "details"],
		'task_deadlineTime'				=>['type'=>'datetime', 	'dbDef' => "DATETIME NULL DEFAULT NULL", 				'cat' => "details"],
		'task_deadlineDate'				=>['type'=>'date', 		'dbDef' => "DATE NULL DEFAULT NULL", 					'cat' => "details"],
		'task_estimatedFinishTime'		=>['type'=>'datetime',	'dbDef' => "DATETIME NULL DEFAULT NULL", 				'cat' => "details"],
		'task_estimatedDurationMinutes'	=>['type'=>'numeric', 	'dbDef' => "MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0",	'cat' => "details"],

		'pivot_code'					=>['type'=>'string', 	'dbDef' => "VARCHAR(25) NOT NULL DEFAULT ''", 			'cat' => "pivot"],
		'pivot_name'					=>['type'=>'string', 	'dbDef' => "VARCHAR(35) NOT NULL DEFAULT ''", 			'cat' => "pivot"],
		'pivot_id'						=>['type'=>'numeric',	'dbDef' => "BIGINT(15) UNSIGNED NOT NULL DEFAULT 0", 	'cat' => "pivot"],
		'pivot_clientName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(201) NOT NULL DEFAULT ''", 			'cat' => "pivot"],

		'task_idAddUser'				=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "admin"],
		'task_addUserName'				=>['type'=>'string', 	'dbDef' => "VARCHAR(101) NOT NULL DEFAULT ''", 			'cat' => "admin"],
		'task_idUpdateUser'				=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "admin"],
		'task_updateUserName'			=>['type'=>'string', 	'dbDef' => "VARCHAR(101) NOT NULL DEFAULT ''", 			'cat' => "admin"],

		'task_addTime'					=>['type'=>'datetime', 	'dbDef' => "DATETIME NULL", 							'cat' => "admin"],
		'task_lastUpdateTime'			=>['type'=>'datetime', 	'dbDef' => "DATETIME NULL DEFAULT NULL", 				'cat' => "admin"],
		'task_updatesCount'				=>['type'=>'numeric', 	'dbDef' => "SMALLINT UNSIGNED NOT NULL DEFAULT 0", 		'cat' => "admin"],

	];

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

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

	/**
	 * The columns dependencies list.
	 * @var array
	 */
	protected array $columnsDependencies = [
		'task_statusName'		=> ['task_statusCode'],
		'task_statusReasonName'	=> ['task_statusReasonCode', 'task_statusCode'],
		'task_operationTypeName'=> ['task_idOperationType'],
		'task_categoryName'		=> ['task_idCategory'],
		'task_priorityName'		=> ['task_priorityCode'],

		'pivot_name'			=> ['pivot_code'],
		'pivot_clientName'		=> ['pivot_id','pivot_code'],

		'task_departmentName' 	=> ['task_idDepartment'],
		'task_officeName'		=> ['task_idOffice'],
		'task_userName'			=> ['task_idUser'],
		'task_assignorUserName' => ['task_assignorIdUser'],

		'task_addUserName'		=> ['task_idAddUser'],
		'task_updateUserName'	=> ['task_idUpdateUser'],
	];

}
