|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This phpFile is auto-generated. |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
declare(strict_types=1); |
|
8
|
|
|
|
|
9
|
|
|
namespace AurimasNiekis\TdLibSchema; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users). |
|
13
|
|
|
*/ |
|
14
|
|
|
class BasicGroup extends TdObject |
|
15
|
|
|
{ |
|
16
|
|
|
public const TYPE_NAME = 'basicGroup'; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Group identifier. |
|
20
|
|
|
* |
|
21
|
|
|
* @var int |
|
22
|
|
|
*/ |
|
23
|
|
|
protected int $id; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Number of members in the group. |
|
27
|
|
|
* |
|
28
|
|
|
* @var int |
|
29
|
|
|
*/ |
|
30
|
|
|
protected int $memberCount; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Status of the current user in the group. |
|
34
|
|
|
* |
|
35
|
|
|
* @var ChatMemberStatus |
|
36
|
|
|
*/ |
|
37
|
|
|
protected ChatMemberStatus $status; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* True, if the group is active. |
|
41
|
|
|
* |
|
42
|
|
|
* @var bool |
|
43
|
|
|
*/ |
|
44
|
|
|
protected bool $isActive; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Identifier of the supergroup to which this group was upgraded; 0 if none. |
|
48
|
|
|
* |
|
49
|
|
|
* @var int |
|
50
|
|
|
*/ |
|
51
|
|
|
protected int $upgradedToSupergroupId; |
|
52
|
|
|
|
|
53
|
|
|
public function __construct(int $id, int $memberCount, ChatMemberStatus $status, bool $isActive, int $upgradedToSupergroupId) |
|
54
|
|
|
{ |
|
55
|
|
|
$this->id = $id; |
|
56
|
|
|
$this->memberCount = $memberCount; |
|
57
|
|
|
$this->status = $status; |
|
58
|
|
|
$this->isActive = $isActive; |
|
59
|
|
|
$this->upgradedToSupergroupId = $upgradedToSupergroupId; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public static function fromArray(array $array): BasicGroup |
|
63
|
|
|
{ |
|
64
|
|
|
return new static( |
|
65
|
|
|
$array['id'], |
|
66
|
|
|
$array['member_count'], |
|
67
|
|
|
TdSchemaRegistry::fromArray($array['status']), |
|
68
|
|
|
$array['is_active'], |
|
69
|
|
|
$array['upgraded_to_supergroup_id'], |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function typeSerialize(): array |
|
74
|
|
|
{ |
|
75
|
|
|
return [ |
|
76
|
|
|
'@type' => static::TYPE_NAME, |
|
77
|
|
|
'id' => $this->id, |
|
78
|
|
|
'member_count' => $this->memberCount, |
|
79
|
|
|
'status' => $this->status->typeSerialize(), |
|
80
|
|
|
'is_active' => $this->isActive, |
|
81
|
|
|
'upgraded_to_supergroup_id' => $this->upgradedToSupergroupId, |
|
82
|
|
|
]; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getId(): int |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->id; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
public function getMemberCount(): int |
|
91
|
|
|
{ |
|
92
|
|
|
return $this->memberCount; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function getStatus(): ChatMemberStatus |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->status; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getIsActive(): bool |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->isActive; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
public function getUpgradedToSupergroupId(): int |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->upgradedToSupergroupId; |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|