26 'collab' => [
'instanceof' => CollabChat::class],
28 'call' => [
'entity' =>
'CALL'],
29 'crm' => [
'entity' =>
'CRM'],
30 'mail' => [
'entity' =>
'MAIL'],
31 'sonetGroup' => [
'entity' =>
'SONET_GROUP'],
32 'tasks' => [
'entity' =>
'TASKS'],
34 'calendar' => [
'entity' =>
'CALENDAR'],
35 'support24Notifier' => [
'entity' =>
'SUPPORT24_NOTIFIER'],
36 'support24Question' => [
'entity' =>
'SUPPORT24_QUESTION'],
37 'thread' => [
'entity' =>
'THREAD'],
38 'announcement' => [
'entity' =>
'ANNOUNCEMENT'],
40 'generalChannel' => [
'instanceof' => GeneralChat::class],
41 'openChannel' => [
'instanceof' => OpenChannelChat::class],
42 'channel' => [
'instanceof' => ChannelChat::class],
44 'comment' => [
'instanceof' => CommentChat::class],
45 'open' => [
'instanceof' => OpenChat::class],
46 'general' => [
'instanceof' => GeneralChat::class],
47 'videoconf' => [
'instanceof' => VideoConfChat::class],
48 'copilot' => [
'instanceof' => CopilotChat::class],
49 'chat' => [
'instanceof' => GroupChat::class],
50 'user' => [
'instanceof' => PrivateChat::class],
53 'chatType_collab' => [
'instanceof' => CollabChat::class],
55 'chatType_call' => [
'entity' =>
'CALL'],
56 'chatType_crm' => [
'entity' =>
'CRM'],
57 'chatType_mail' => [
'entity' =>
'MAIL'],
58 'chatType_sonetGroup' => [
'entity' =>
'SONET_GROUP'],
59 'chatType_tasks' => [
'entity' =>
'TASKS'],
60 'chatType_calendar' => [
'entity' =>
'CALENDAR'],
62 'chatType_generalChannel' => [
'instanceof' => GeneralChannel::class],
63 'chatType_openChannel' => [
'instanceof' => OpenChannelChat::class],
64 'chatType_channel' => [
'instanceof' => ChannelChat::class],
66 'chatType_comments' => [
'instanceof' => CommentChat::class],
67 'chatType_open' => [
'instanceof' => OpenChat::class],
68 'chatType_general' => [
'instanceof' => GeneralChat::class],
69 'chatType_videoconf' => [
'instanceof' => VideoConfChat::class],
70 'chatType_copilot' => [
'instanceof' => CopilotChat::class],
71 'chatType_chat' => [
'instanceof' => GroupChat::class],
73 'chatType_notes' => [
'instanceof' => FavoriteChat::class],
74 'chatType_user' => [
'instanceof' => PrivateChat::class],
91 $entityType = $this->chat->getEntityType();
92 foreach (self::CHAT_TYPE_CONDITIONS as $typeName => $conditions)
94 if (array_key_exists(
'entity', $conditions) && $conditions[
'entity'] === $entityType)
96 $this->type = $typeName;
101 if (array_key_exists(
'instanceof', $conditions))
103 if (!is_array($conditions[
'instanceof']))
105 $conditions[
'instanceof'] = [$conditions[
'instanceof']];
108 foreach ($conditions[
'instanceof'] as $condition)
110 if ($this->chat instanceof $condition)
112 $this->type = $typeName;
127 $entityType = $this->chat->getEntityType();
129 foreach (self::CHAT_P1_CONDITIONS as $typeName => $conditions)
131 if (array_key_exists(
'entity', $conditions) && $conditions[
'entity'] === $entityType)
133 $this->p1 = $typeName;
138 if (array_key_exists(
'instanceof', $conditions) && $this->chat instanceof $conditions[
'instanceof'])
140 $this->p1 = $typeName;
146 $this->p1 =
'custom';
155 $engineCode = $this->chat->getEngineCode() ?? EngineManager::getDefaultEngineCode();
156 $engineName = (
new EngineManager())->getEngineNameByCode($engineCode) ??
'';
163 $currentUser = $this->chat->getContext()->getUser();
165 $this->p2 = match (
true)
167 $currentUser instanceof
UserCollaber =>
'user_collaber',
168 $currentUser instanceof
UserExternal =>
'user_extranet',
169 default =>
'user_intranet',
179 $this->p4 =
'collabId_' . ($this->chat->getEntityId() ?? 0);
186 $role = (
new RoleManager())->getMainRole($this->chat->getChatId()) ??
'';
187 $this->p4 =
'role_' . self::convertUnderscore($role);
193 $parentChatId = $this->chat->getParentChatId();
194 $this->p4 =
'parentChatId_' . ($parentChatId ?? 0);
201 if ($this->chat->getChatId() !==
null)
203 $this->p5 =
'chatId_' . $this->chat->getChatId();
222 $this->chat instanceof
CollabChat =>
'collab',
223 $this->chat instanceof
VideoConfChat && $additionalCategories =>
'videoconf',