SupergroupFullInfo::typeSerialize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 21
nc 2
nop 0
dl 0
loc 23
rs 9.584
c 0
b 0
f 0
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
 * Contains full information about a supergroup or channel.
13
 */
14
class SupergroupFullInfo extends TdObject
15
{
16
    public const TYPE_NAME = 'supergroupFullInfo';
17
18
    /**
19
     * Supergroup or channel description.
20
     *
21
     * @var string
22
     */
23
    protected string $description;
24
25
    /**
26
     * Number of members in the supergroup or channel; 0 if unknown.
27
     *
28
     * @var int
29
     */
30
    protected int $memberCount;
31
32
    /**
33
     * Number of privileged users in the supergroup or channel; 0 if unknown.
34
     *
35
     * @var int
36
     */
37
    protected int $administratorCount;
38
39
    /**
40
     * Number of restricted users in the supergroup; 0 if unknown.
41
     *
42
     * @var int
43
     */
44
    protected int $restrictedCount;
45
46
    /**
47
     * Number of users banned from chat; 0 if unknown.
48
     *
49
     * @var int
50
     */
51
    protected int $bannedCount;
52
53
    /**
54
     * Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown.
55
     *
56
     * @var int
57
     */
58
    protected int $linkedChatId;
59
60
    /**
61
     * Delay between consecutive sent messages for non-administrator supergroup members, in seconds.
62
     *
63
     * @var int
64
     */
65
    protected int $slowModeDelay;
66
67
    /**
68
     * Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero.
69
     *
70
     * @var float
71
     */
72
    protected float $slowModeDelayExpiresIn;
73
74
    /**
75
     * True, if members of the chat can be retrieved.
76
     *
77
     * @var bool
78
     */
79
    protected bool $canGetMembers;
80
81
    /**
82
     * True, if the chat username can be changed.
83
     *
84
     * @var bool
85
     */
86
    protected bool $canSetUsername;
87
88
    /**
89
     * True, if the supergroup sticker set can be changed.
90
     *
91
     * @var bool
92
     */
93
    protected bool $canSetStickerSet;
94
95
    /**
96
     * True, if the supergroup location can be changed.
97
     *
98
     * @var bool
99
     */
100
    protected bool $canSetLocation;
101
102
    /**
103
     * True, if the channel statistics is available.
104
     *
105
     * @var bool
106
     */
107
    protected bool $canViewStatistics;
108
109
    /**
110
     * True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators.
111
     *
112
     * @var bool
113
     */
114
    protected bool $isAllHistoryAvailable;
115
116
    /**
117
     * Identifier of the supergroup sticker set; 0 if none.
118
     *
119
     * @var string
120
     */
121
    protected string $stickerSetId;
122
123
    /**
124
     * Location to which the supergroup is connected; may be null.
125
     *
126
     * @var ChatLocation|null
127
     */
128
    protected ?ChatLocation $location;
129
130
    /**
131
     * Invite link for this chat.
132
     *
133
     * @var string
134
     */
135
    protected string $inviteLink;
136
137
    /**
138
     * Identifier of the basic group from which supergroup was upgraded; 0 if none.
139
     *
140
     * @var int
141
     */
142
    protected int $upgradedFromBasicGroupId;
143
144
    /**
145
     * Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none.
146
     *
147
     * @var int
148
     */
149
    protected int $upgradedFromMaxMessageId;
150
151
    public function __construct(
152
        string $description,
153
        int $memberCount,
154
        int $administratorCount,
155
        int $restrictedCount,
156
        int $bannedCount,
157
        int $linkedChatId,
158
        int $slowModeDelay,
159
        float $slowModeDelayExpiresIn,
160
        bool $canGetMembers,
161
        bool $canSetUsername,
162
        bool $canSetStickerSet,
163
        bool $canSetLocation,
164
        bool $canViewStatistics,
165
        bool $isAllHistoryAvailable,
166
        string $stickerSetId,
167
        ?ChatLocation $location,
168
        string $inviteLink,
169
        int $upgradedFromBasicGroupId,
170
        int $upgradedFromMaxMessageId
171
    ) {
172
        $this->description              = $description;
173
        $this->memberCount              = $memberCount;
174
        $this->administratorCount       = $administratorCount;
175
        $this->restrictedCount          = $restrictedCount;
176
        $this->bannedCount              = $bannedCount;
177
        $this->linkedChatId             = $linkedChatId;
178
        $this->slowModeDelay            = $slowModeDelay;
179
        $this->slowModeDelayExpiresIn   = $slowModeDelayExpiresIn;
180
        $this->canGetMembers            = $canGetMembers;
181
        $this->canSetUsername           = $canSetUsername;
182
        $this->canSetStickerSet         = $canSetStickerSet;
183
        $this->canSetLocation           = $canSetLocation;
184
        $this->canViewStatistics        = $canViewStatistics;
185
        $this->isAllHistoryAvailable    = $isAllHistoryAvailable;
186
        $this->stickerSetId             = $stickerSetId;
187
        $this->location                 = $location;
188
        $this->inviteLink               = $inviteLink;
189
        $this->upgradedFromBasicGroupId = $upgradedFromBasicGroupId;
190
        $this->upgradedFromMaxMessageId = $upgradedFromMaxMessageId;
191
    }
192
193
    public static function fromArray(array $array): SupergroupFullInfo
194
    {
195
        return new static(
196
            $array['description'],
197
            $array['member_count'],
198
            $array['administrator_count'],
199
            $array['restricted_count'],
200
            $array['banned_count'],
201
            $array['linked_chat_id'],
202
            $array['slow_mode_delay'],
203
            $array['slow_mode_delay_expires_in'],
204
            $array['can_get_members'],
205
            $array['can_set_username'],
206
            $array['can_set_sticker_set'],
207
            $array['can_set_location'],
208
            $array['can_view_statistics'],
209
            $array['is_all_history_available'],
210
            $array['sticker_set_id'],
211
            (isset($array['location']) ? TdSchemaRegistry::fromArray($array['location']) : null),
212
            $array['invite_link'],
213
            $array['upgraded_from_basic_group_id'],
214
            $array['upgraded_from_max_message_id'],
215
        );
216
    }
217
218
    public function typeSerialize(): array
219
    {
220
        return [
221
            '@type'                        => static::TYPE_NAME,
222
            'description'                  => $this->description,
223
            'member_count'                 => $this->memberCount,
224
            'administrator_count'          => $this->administratorCount,
225
            'restricted_count'             => $this->restrictedCount,
226
            'banned_count'                 => $this->bannedCount,
227
            'linked_chat_id'               => $this->linkedChatId,
228
            'slow_mode_delay'              => $this->slowModeDelay,
229
            'slow_mode_delay_expires_in'   => $this->slowModeDelayExpiresIn,
230
            'can_get_members'              => $this->canGetMembers,
231
            'can_set_username'             => $this->canSetUsername,
232
            'can_set_sticker_set'          => $this->canSetStickerSet,
233
            'can_set_location'             => $this->canSetLocation,
234
            'can_view_statistics'          => $this->canViewStatistics,
235
            'is_all_history_available'     => $this->isAllHistoryAvailable,
236
            'sticker_set_id'               => $this->stickerSetId,
237
            'location'                     => (isset($this->location) ? $this->location : null),
238
            'invite_link'                  => $this->inviteLink,
239
            'upgraded_from_basic_group_id' => $this->upgradedFromBasicGroupId,
240
            'upgraded_from_max_message_id' => $this->upgradedFromMaxMessageId,
241
        ];
242
    }
243
244
    public function getDescription(): string
245
    {
246
        return $this->description;
247
    }
248
249
    public function getMemberCount(): int
250
    {
251
        return $this->memberCount;
252
    }
253
254
    public function getAdministratorCount(): int
255
    {
256
        return $this->administratorCount;
257
    }
258
259
    public function getRestrictedCount(): int
260
    {
261
        return $this->restrictedCount;
262
    }
263
264
    public function getBannedCount(): int
265
    {
266
        return $this->bannedCount;
267
    }
268
269
    public function getLinkedChatId(): int
270
    {
271
        return $this->linkedChatId;
272
    }
273
274
    public function getSlowModeDelay(): int
275
    {
276
        return $this->slowModeDelay;
277
    }
278
279
    public function getSlowModeDelayExpiresIn(): float
280
    {
281
        return $this->slowModeDelayExpiresIn;
282
    }
283
284
    public function getCanGetMembers(): bool
285
    {
286
        return $this->canGetMembers;
287
    }
288
289
    public function getCanSetUsername(): bool
290
    {
291
        return $this->canSetUsername;
292
    }
293
294
    public function getCanSetStickerSet(): bool
295
    {
296
        return $this->canSetStickerSet;
297
    }
298
299
    public function getCanSetLocation(): bool
300
    {
301
        return $this->canSetLocation;
302
    }
303
304
    public function getCanViewStatistics(): bool
305
    {
306
        return $this->canViewStatistics;
307
    }
308
309
    public function getIsAllHistoryAvailable(): bool
310
    {
311
        return $this->isAllHistoryAvailable;
312
    }
313
314
    public function getStickerSetId(): string
315
    {
316
        return $this->stickerSetId;
317
    }
318
319
    public function getLocation(): ?ChatLocation
320
    {
321
        return $this->location;
322
    }
323
324
    public function getInviteLink(): string
325
    {
326
        return $this->inviteLink;
327
    }
328
329
    public function getUpgradedFromBasicGroupId(): int
330
    {
331
        return $this->upgradedFromBasicGroupId;
332
    }
333
334
    public function getUpgradedFromMaxMessageId(): int
335
    {
336
        return $this->upgradedFromMaxMessageId;
337
    }
338
}
339