rtdlib 1.8.69

TDLib for rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
use crate::errors::*;
use crate::types::*;
use uuid::Uuid;

use serde::de::{Deserialize, Deserializer};
use std::fmt::Debug;

/// TRAIT | Describes a feature available to Premium users
pub trait TDPremiumFeature: Debug + RObject {}

/// Describes a feature available to Premium users
#[derive(Debug, Clone, Serialize)]
#[serde(untagged)]
pub enum PremiumFeature {
  #[doc(hidden)]
  _Default(()),
  /// The ability to choose accent color for replies and user profile
  AccentColor(PremiumFeatureAccentColor),
  /// Ability to change position of the main chat list, archive and mute all new chats from non-contacts, and completely disable notifications about the user's contacts joined Telegram
  AdvancedChatManagement(PremiumFeatureAdvancedChatManagement),
  /// Profile photo animation on message and chat screens
  AnimatedProfilePhoto(PremiumFeatureAnimatedProfilePhoto),
  /// Allowed to set premium application icons
  AppIcons(PremiumFeatureAppIcons),
  /// The ability to set private chat background for both users
  BackgroundForBoth(PremiumFeatureBackgroundForBoth),
  /// The ability to use Business features
  Business(PremiumFeatureBusiness),
  /// The ability to boost chats
  ChatBoost(PremiumFeatureChatBoost),
  /// The ability to create and use checklist messages
  Checklists(PremiumFeatureChecklists),
  /// Allowed to use custom emoji stickers in message texts and captions
  CustomEmoji(PremiumFeatureCustomEmoji),
  /// Disabled ads
  DisabledAds(PremiumFeatureDisabledAds),
  /// The ability to show an emoji status along with the user's name
  EmojiStatus(PremiumFeatureEmojiStatus),
  /// The ability to set a custom emoji as a forum topic icon
  ForumTopicIcon(PremiumFeatureForumTopicIcon),
  /// Improved download speed
  ImprovedDownloadSpeed(PremiumFeatureImprovedDownloadSpeed),
  /// Increased limits
  IncreasedLimits(PremiumFeatureIncreasedLimits),
  /// Increased maximum upload file size
  IncreasedUploadFileSize(PremiumFeatureIncreasedUploadFileSize),
  /// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user
  LastSeenTimes(PremiumFeatureLastSeenTimes),
  /// The ability to use all available message effects
  MessageEffects(PremiumFeatureMessageEffects),
  /// The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages and to restrict incoming messages from non-contacts using setNewChatPrivacySettings
  MessagePrivacy(PremiumFeatureMessagePrivacy),
  /// The ability to require a payment for incoming messages in new chats
  PaidMessages(PremiumFeaturePaidMessages),
  /// A badge in the user's profile
  ProfileBadge(PremiumFeatureProfileBadge),
  /// The ability to enable content protection in private chats
  ProtectPrivateChatContent(PremiumFeatureProtectPrivateChatContent),
  /// Allowed to translate chat messages real-time
  RealTimeChatTranslation(PremiumFeatureRealTimeChatTranslation),
  /// The ability to send rich messages
  RichMessages(PremiumFeatureRichMessages),
  /// The ability to use tags in Saved Messages
  SavedMessagesTags(PremiumFeatureSavedMessagesTags),
  /// The ability to compose text with AI
  TextComposition(PremiumFeatureTextComposition),
  /// Allowed to use more reactions
  UniqueReactions(PremiumFeatureUniqueReactions),
  /// Allowed to use premium stickers with unique effects
  UniqueStickers(PremiumFeatureUniqueStickers),
  /// Allowed to use many additional features for stories
  UpgradedStories(PremiumFeatureUpgradedStories),
  /// The ability to convert voice notes to text
  VoiceRecognition(PremiumFeatureVoiceRecognition),
}

impl Default for PremiumFeature {
  fn default() -> Self {
    PremiumFeature::_Default(())
  }
}

impl<'de> Deserialize<'de> for PremiumFeature {
  fn deserialize<D>(deserializer: D) -> Result<PremiumFeature, D::Error>
  where
    D: Deserializer<'de>,
  {
    use serde::de::Error;
    rtd_enum_deserialize!(
      PremiumFeature,
      (premiumFeatureAccentColor, AccentColor);
      (premiumFeatureAdvancedChatManagement, AdvancedChatManagement);
      (premiumFeatureAnimatedProfilePhoto, AnimatedProfilePhoto);
      (premiumFeatureAppIcons, AppIcons);
      (premiumFeatureBackgroundForBoth, BackgroundForBoth);
      (premiumFeatureBusiness, Business);
      (premiumFeatureChatBoost, ChatBoost);
      (premiumFeatureChecklists, Checklists);
      (premiumFeatureCustomEmoji, CustomEmoji);
      (premiumFeatureDisabledAds, DisabledAds);
      (premiumFeatureEmojiStatus, EmojiStatus);
      (premiumFeatureForumTopicIcon, ForumTopicIcon);
      (premiumFeatureImprovedDownloadSpeed, ImprovedDownloadSpeed);
      (premiumFeatureIncreasedLimits, IncreasedLimits);
      (premiumFeatureIncreasedUploadFileSize, IncreasedUploadFileSize);
      (premiumFeatureLastSeenTimes, LastSeenTimes);
      (premiumFeatureMessageEffects, MessageEffects);
      (premiumFeatureMessagePrivacy, MessagePrivacy);
      (premiumFeaturePaidMessages, PaidMessages);
      (premiumFeatureProfileBadge, ProfileBadge);
      (premiumFeatureProtectPrivateChatContent, ProtectPrivateChatContent);
      (premiumFeatureRealTimeChatTranslation, RealTimeChatTranslation);
      (premiumFeatureRichMessages, RichMessages);
      (premiumFeatureSavedMessagesTags, SavedMessagesTags);
      (premiumFeatureTextComposition, TextComposition);
      (premiumFeatureUniqueReactions, UniqueReactions);
      (premiumFeatureUniqueStickers, UniqueStickers);
      (premiumFeatureUpgradedStories, UpgradedStories);
      (premiumFeatureVoiceRecognition, VoiceRecognition);

    )(deserializer)
  }
}

impl RObject for PremiumFeature {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    match self {
      PremiumFeature::AccentColor(t) => t.td_name(),
      PremiumFeature::AdvancedChatManagement(t) => t.td_name(),
      PremiumFeature::AnimatedProfilePhoto(t) => t.td_name(),
      PremiumFeature::AppIcons(t) => t.td_name(),
      PremiumFeature::BackgroundForBoth(t) => t.td_name(),
      PremiumFeature::Business(t) => t.td_name(),
      PremiumFeature::ChatBoost(t) => t.td_name(),
      PremiumFeature::Checklists(t) => t.td_name(),
      PremiumFeature::CustomEmoji(t) => t.td_name(),
      PremiumFeature::DisabledAds(t) => t.td_name(),
      PremiumFeature::EmojiStatus(t) => t.td_name(),
      PremiumFeature::ForumTopicIcon(t) => t.td_name(),
      PremiumFeature::ImprovedDownloadSpeed(t) => t.td_name(),
      PremiumFeature::IncreasedLimits(t) => t.td_name(),
      PremiumFeature::IncreasedUploadFileSize(t) => t.td_name(),
      PremiumFeature::LastSeenTimes(t) => t.td_name(),
      PremiumFeature::MessageEffects(t) => t.td_name(),
      PremiumFeature::MessagePrivacy(t) => t.td_name(),
      PremiumFeature::PaidMessages(t) => t.td_name(),
      PremiumFeature::ProfileBadge(t) => t.td_name(),
      PremiumFeature::ProtectPrivateChatContent(t) => t.td_name(),
      PremiumFeature::RealTimeChatTranslation(t) => t.td_name(),
      PremiumFeature::RichMessages(t) => t.td_name(),
      PremiumFeature::SavedMessagesTags(t) => t.td_name(),
      PremiumFeature::TextComposition(t) => t.td_name(),
      PremiumFeature::UniqueReactions(t) => t.td_name(),
      PremiumFeature::UniqueStickers(t) => t.td_name(),
      PremiumFeature::UpgradedStories(t) => t.td_name(),
      PremiumFeature::VoiceRecognition(t) => t.td_name(),

      _ => "-1",
    }
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    match self {
      PremiumFeature::AccentColor(t) => t.extra(),
      PremiumFeature::AdvancedChatManagement(t) => t.extra(),
      PremiumFeature::AnimatedProfilePhoto(t) => t.extra(),
      PremiumFeature::AppIcons(t) => t.extra(),
      PremiumFeature::BackgroundForBoth(t) => t.extra(),
      PremiumFeature::Business(t) => t.extra(),
      PremiumFeature::ChatBoost(t) => t.extra(),
      PremiumFeature::Checklists(t) => t.extra(),
      PremiumFeature::CustomEmoji(t) => t.extra(),
      PremiumFeature::DisabledAds(t) => t.extra(),
      PremiumFeature::EmojiStatus(t) => t.extra(),
      PremiumFeature::ForumTopicIcon(t) => t.extra(),
      PremiumFeature::ImprovedDownloadSpeed(t) => t.extra(),
      PremiumFeature::IncreasedLimits(t) => t.extra(),
      PremiumFeature::IncreasedUploadFileSize(t) => t.extra(),
      PremiumFeature::LastSeenTimes(t) => t.extra(),
      PremiumFeature::MessageEffects(t) => t.extra(),
      PremiumFeature::MessagePrivacy(t) => t.extra(),
      PremiumFeature::PaidMessages(t) => t.extra(),
      PremiumFeature::ProfileBadge(t) => t.extra(),
      PremiumFeature::ProtectPrivateChatContent(t) => t.extra(),
      PremiumFeature::RealTimeChatTranslation(t) => t.extra(),
      PremiumFeature::RichMessages(t) => t.extra(),
      PremiumFeature::SavedMessagesTags(t) => t.extra(),
      PremiumFeature::TextComposition(t) => t.extra(),
      PremiumFeature::UniqueReactions(t) => t.extra(),
      PremiumFeature::UniqueStickers(t) => t.extra(),
      PremiumFeature::UpgradedStories(t) => t.extra(),
      PremiumFeature::VoiceRecognition(t) => t.extra(),

      _ => None,
    }
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl PremiumFeature {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  #[doc(hidden)]
  pub fn _is_default(&self) -> bool {
    matches!(self, PremiumFeature::_Default(_))
  }

  pub fn is_accent_color(&self) -> bool {
    matches!(self, PremiumFeature::AccentColor(_))
  }
  pub fn is_advanced_chat_management(&self) -> bool {
    matches!(self, PremiumFeature::AdvancedChatManagement(_))
  }
  pub fn is_animated_profile_photo(&self) -> bool {
    matches!(self, PremiumFeature::AnimatedProfilePhoto(_))
  }
  pub fn is_app_icons(&self) -> bool {
    matches!(self, PremiumFeature::AppIcons(_))
  }
  pub fn is_background_for_both(&self) -> bool {
    matches!(self, PremiumFeature::BackgroundForBoth(_))
  }
  pub fn is_business(&self) -> bool {
    matches!(self, PremiumFeature::Business(_))
  }
  pub fn is_chat_boost(&self) -> bool {
    matches!(self, PremiumFeature::ChatBoost(_))
  }
  pub fn is_checklists(&self) -> bool {
    matches!(self, PremiumFeature::Checklists(_))
  }
  pub fn is_custom_emoji(&self) -> bool {
    matches!(self, PremiumFeature::CustomEmoji(_))
  }
  pub fn is_disabled_ads(&self) -> bool {
    matches!(self, PremiumFeature::DisabledAds(_))
  }
  pub fn is_emoji_status(&self) -> bool {
    matches!(self, PremiumFeature::EmojiStatus(_))
  }
  pub fn is_forum_topic_icon(&self) -> bool {
    matches!(self, PremiumFeature::ForumTopicIcon(_))
  }
  pub fn is_improved_download_speed(&self) -> bool {
    matches!(self, PremiumFeature::ImprovedDownloadSpeed(_))
  }
  pub fn is_increased_limits(&self) -> bool {
    matches!(self, PremiumFeature::IncreasedLimits(_))
  }
  pub fn is_increased_upload_file_size(&self) -> bool {
    matches!(self, PremiumFeature::IncreasedUploadFileSize(_))
  }
  pub fn is_last_seen_times(&self) -> bool {
    matches!(self, PremiumFeature::LastSeenTimes(_))
  }
  pub fn is_message_effects(&self) -> bool {
    matches!(self, PremiumFeature::MessageEffects(_))
  }
  pub fn is_message_privacy(&self) -> bool {
    matches!(self, PremiumFeature::MessagePrivacy(_))
  }
  pub fn is_paid_messages(&self) -> bool {
    matches!(self, PremiumFeature::PaidMessages(_))
  }
  pub fn is_profile_badge(&self) -> bool {
    matches!(self, PremiumFeature::ProfileBadge(_))
  }
  pub fn is_protect_private_chat_content(&self) -> bool {
    matches!(self, PremiumFeature::ProtectPrivateChatContent(_))
  }
  pub fn is_real_time_chat_translation(&self) -> bool {
    matches!(self, PremiumFeature::RealTimeChatTranslation(_))
  }
  pub fn is_rich_messages(&self) -> bool {
    matches!(self, PremiumFeature::RichMessages(_))
  }
  pub fn is_saved_messages_tags(&self) -> bool {
    matches!(self, PremiumFeature::SavedMessagesTags(_))
  }
  pub fn is_text_composition(&self) -> bool {
    matches!(self, PremiumFeature::TextComposition(_))
  }
  pub fn is_unique_reactions(&self) -> bool {
    matches!(self, PremiumFeature::UniqueReactions(_))
  }
  pub fn is_unique_stickers(&self) -> bool {
    matches!(self, PremiumFeature::UniqueStickers(_))
  }
  pub fn is_upgraded_stories(&self) -> bool {
    matches!(self, PremiumFeature::UpgradedStories(_))
  }
  pub fn is_voice_recognition(&self) -> bool {
    matches!(self, PremiumFeature::VoiceRecognition(_))
  }

  pub fn on_accent_color<F: FnOnce(&PremiumFeatureAccentColor)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::AccentColor(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_advanced_chat_management<F: FnOnce(&PremiumFeatureAdvancedChatManagement)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::AdvancedChatManagement(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_animated_profile_photo<F: FnOnce(&PremiumFeatureAnimatedProfilePhoto)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::AnimatedProfilePhoto(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_app_icons<F: FnOnce(&PremiumFeatureAppIcons)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::AppIcons(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_background_for_both<F: FnOnce(&PremiumFeatureBackgroundForBoth)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::BackgroundForBoth(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_business<F: FnOnce(&PremiumFeatureBusiness)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::Business(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_chat_boost<F: FnOnce(&PremiumFeatureChatBoost)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::ChatBoost(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_checklists<F: FnOnce(&PremiumFeatureChecklists)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::Checklists(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_custom_emoji<F: FnOnce(&PremiumFeatureCustomEmoji)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::CustomEmoji(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_disabled_ads<F: FnOnce(&PremiumFeatureDisabledAds)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::DisabledAds(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_emoji_status<F: FnOnce(&PremiumFeatureEmojiStatus)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::EmojiStatus(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_forum_topic_icon<F: FnOnce(&PremiumFeatureForumTopicIcon)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::ForumTopicIcon(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_improved_download_speed<F: FnOnce(&PremiumFeatureImprovedDownloadSpeed)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::ImprovedDownloadSpeed(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_increased_limits<F: FnOnce(&PremiumFeatureIncreasedLimits)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::IncreasedLimits(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_increased_upload_file_size<F: FnOnce(&PremiumFeatureIncreasedUploadFileSize)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::IncreasedUploadFileSize(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_last_seen_times<F: FnOnce(&PremiumFeatureLastSeenTimes)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::LastSeenTimes(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_message_effects<F: FnOnce(&PremiumFeatureMessageEffects)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::MessageEffects(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_message_privacy<F: FnOnce(&PremiumFeatureMessagePrivacy)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::MessagePrivacy(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_paid_messages<F: FnOnce(&PremiumFeaturePaidMessages)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::PaidMessages(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_profile_badge<F: FnOnce(&PremiumFeatureProfileBadge)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::ProfileBadge(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_protect_private_chat_content<F: FnOnce(&PremiumFeatureProtectPrivateChatContent)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::ProtectPrivateChatContent(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_real_time_chat_translation<F: FnOnce(&PremiumFeatureRealTimeChatTranslation)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::RealTimeChatTranslation(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_rich_messages<F: FnOnce(&PremiumFeatureRichMessages)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::RichMessages(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_saved_messages_tags<F: FnOnce(&PremiumFeatureSavedMessagesTags)>(
    &self,
    fnc: F,
  ) -> &Self {
    if let PremiumFeature::SavedMessagesTags(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_text_composition<F: FnOnce(&PremiumFeatureTextComposition)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::TextComposition(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_unique_reactions<F: FnOnce(&PremiumFeatureUniqueReactions)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::UniqueReactions(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_unique_stickers<F: FnOnce(&PremiumFeatureUniqueStickers)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::UniqueStickers(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_upgraded_stories<F: FnOnce(&PremiumFeatureUpgradedStories)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::UpgradedStories(t) = self {
      fnc(t)
    };
    self
  }
  pub fn on_voice_recognition<F: FnOnce(&PremiumFeatureVoiceRecognition)>(&self, fnc: F) -> &Self {
    if let PremiumFeature::VoiceRecognition(t) = self {
      fnc(t)
    };
    self
  }

  pub fn as_accent_color(&self) -> Option<&PremiumFeatureAccentColor> {
    if let PremiumFeature::AccentColor(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_advanced_chat_management(&self) -> Option<&PremiumFeatureAdvancedChatManagement> {
    if let PremiumFeature::AdvancedChatManagement(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_animated_profile_photo(&self) -> Option<&PremiumFeatureAnimatedProfilePhoto> {
    if let PremiumFeature::AnimatedProfilePhoto(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_app_icons(&self) -> Option<&PremiumFeatureAppIcons> {
    if let PremiumFeature::AppIcons(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_background_for_both(&self) -> Option<&PremiumFeatureBackgroundForBoth> {
    if let PremiumFeature::BackgroundForBoth(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_business(&self) -> Option<&PremiumFeatureBusiness> {
    if let PremiumFeature::Business(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_chat_boost(&self) -> Option<&PremiumFeatureChatBoost> {
    if let PremiumFeature::ChatBoost(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_checklists(&self) -> Option<&PremiumFeatureChecklists> {
    if let PremiumFeature::Checklists(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_custom_emoji(&self) -> Option<&PremiumFeatureCustomEmoji> {
    if let PremiumFeature::CustomEmoji(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_disabled_ads(&self) -> Option<&PremiumFeatureDisabledAds> {
    if let PremiumFeature::DisabledAds(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_emoji_status(&self) -> Option<&PremiumFeatureEmojiStatus> {
    if let PremiumFeature::EmojiStatus(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_forum_topic_icon(&self) -> Option<&PremiumFeatureForumTopicIcon> {
    if let PremiumFeature::ForumTopicIcon(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_improved_download_speed(&self) -> Option<&PremiumFeatureImprovedDownloadSpeed> {
    if let PremiumFeature::ImprovedDownloadSpeed(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_increased_limits(&self) -> Option<&PremiumFeatureIncreasedLimits> {
    if let PremiumFeature::IncreasedLimits(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_increased_upload_file_size(&self) -> Option<&PremiumFeatureIncreasedUploadFileSize> {
    if let PremiumFeature::IncreasedUploadFileSize(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_last_seen_times(&self) -> Option<&PremiumFeatureLastSeenTimes> {
    if let PremiumFeature::LastSeenTimes(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_message_effects(&self) -> Option<&PremiumFeatureMessageEffects> {
    if let PremiumFeature::MessageEffects(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_message_privacy(&self) -> Option<&PremiumFeatureMessagePrivacy> {
    if let PremiumFeature::MessagePrivacy(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_paid_messages(&self) -> Option<&PremiumFeaturePaidMessages> {
    if let PremiumFeature::PaidMessages(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_profile_badge(&self) -> Option<&PremiumFeatureProfileBadge> {
    if let PremiumFeature::ProfileBadge(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_protect_private_chat_content(
    &self,
  ) -> Option<&PremiumFeatureProtectPrivateChatContent> {
    if let PremiumFeature::ProtectPrivateChatContent(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_real_time_chat_translation(&self) -> Option<&PremiumFeatureRealTimeChatTranslation> {
    if let PremiumFeature::RealTimeChatTranslation(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_rich_messages(&self) -> Option<&PremiumFeatureRichMessages> {
    if let PremiumFeature::RichMessages(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_saved_messages_tags(&self) -> Option<&PremiumFeatureSavedMessagesTags> {
    if let PremiumFeature::SavedMessagesTags(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_text_composition(&self) -> Option<&PremiumFeatureTextComposition> {
    if let PremiumFeature::TextComposition(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_unique_reactions(&self) -> Option<&PremiumFeatureUniqueReactions> {
    if let PremiumFeature::UniqueReactions(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_unique_stickers(&self) -> Option<&PremiumFeatureUniqueStickers> {
    if let PremiumFeature::UniqueStickers(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_upgraded_stories(&self) -> Option<&PremiumFeatureUpgradedStories> {
    if let PremiumFeature::UpgradedStories(t) = self {
      return Some(t);
    }
    None
  }
  pub fn as_voice_recognition(&self) -> Option<&PremiumFeatureVoiceRecognition> {
    if let PremiumFeature::VoiceRecognition(t) = self {
      return Some(t);
    }
    None
  }

  pub fn accent_color<T: AsRef<PremiumFeatureAccentColor>>(t: T) -> Self {
    PremiumFeature::AccentColor(t.as_ref().clone())
  }

  pub fn advanced_chat_management<T: AsRef<PremiumFeatureAdvancedChatManagement>>(t: T) -> Self {
    PremiumFeature::AdvancedChatManagement(t.as_ref().clone())
  }

  pub fn animated_profile_photo<T: AsRef<PremiumFeatureAnimatedProfilePhoto>>(t: T) -> Self {
    PremiumFeature::AnimatedProfilePhoto(t.as_ref().clone())
  }

  pub fn app_icons<T: AsRef<PremiumFeatureAppIcons>>(t: T) -> Self {
    PremiumFeature::AppIcons(t.as_ref().clone())
  }

  pub fn background_for_both<T: AsRef<PremiumFeatureBackgroundForBoth>>(t: T) -> Self {
    PremiumFeature::BackgroundForBoth(t.as_ref().clone())
  }

  pub fn business<T: AsRef<PremiumFeatureBusiness>>(t: T) -> Self {
    PremiumFeature::Business(t.as_ref().clone())
  }

  pub fn chat_boost<T: AsRef<PremiumFeatureChatBoost>>(t: T) -> Self {
    PremiumFeature::ChatBoost(t.as_ref().clone())
  }

  pub fn checklists<T: AsRef<PremiumFeatureChecklists>>(t: T) -> Self {
    PremiumFeature::Checklists(t.as_ref().clone())
  }

  pub fn custom_emoji<T: AsRef<PremiumFeatureCustomEmoji>>(t: T) -> Self {
    PremiumFeature::CustomEmoji(t.as_ref().clone())
  }

  pub fn disabled_ads<T: AsRef<PremiumFeatureDisabledAds>>(t: T) -> Self {
    PremiumFeature::DisabledAds(t.as_ref().clone())
  }

  pub fn emoji_status<T: AsRef<PremiumFeatureEmojiStatus>>(t: T) -> Self {
    PremiumFeature::EmojiStatus(t.as_ref().clone())
  }

  pub fn forum_topic_icon<T: AsRef<PremiumFeatureForumTopicIcon>>(t: T) -> Self {
    PremiumFeature::ForumTopicIcon(t.as_ref().clone())
  }

  pub fn improved_download_speed<T: AsRef<PremiumFeatureImprovedDownloadSpeed>>(t: T) -> Self {
    PremiumFeature::ImprovedDownloadSpeed(t.as_ref().clone())
  }

  pub fn increased_limits<T: AsRef<PremiumFeatureIncreasedLimits>>(t: T) -> Self {
    PremiumFeature::IncreasedLimits(t.as_ref().clone())
  }

  pub fn increased_upload_file_size<T: AsRef<PremiumFeatureIncreasedUploadFileSize>>(t: T) -> Self {
    PremiumFeature::IncreasedUploadFileSize(t.as_ref().clone())
  }

  pub fn last_seen_times<T: AsRef<PremiumFeatureLastSeenTimes>>(t: T) -> Self {
    PremiumFeature::LastSeenTimes(t.as_ref().clone())
  }

  pub fn message_effects<T: AsRef<PremiumFeatureMessageEffects>>(t: T) -> Self {
    PremiumFeature::MessageEffects(t.as_ref().clone())
  }

  pub fn message_privacy<T: AsRef<PremiumFeatureMessagePrivacy>>(t: T) -> Self {
    PremiumFeature::MessagePrivacy(t.as_ref().clone())
  }

  pub fn paid_messages<T: AsRef<PremiumFeaturePaidMessages>>(t: T) -> Self {
    PremiumFeature::PaidMessages(t.as_ref().clone())
  }

  pub fn profile_badge<T: AsRef<PremiumFeatureProfileBadge>>(t: T) -> Self {
    PremiumFeature::ProfileBadge(t.as_ref().clone())
  }

  pub fn protect_private_chat_content<T: AsRef<PremiumFeatureProtectPrivateChatContent>>(
    t: T,
  ) -> Self {
    PremiumFeature::ProtectPrivateChatContent(t.as_ref().clone())
  }

  pub fn real_time_chat_translation<T: AsRef<PremiumFeatureRealTimeChatTranslation>>(t: T) -> Self {
    PremiumFeature::RealTimeChatTranslation(t.as_ref().clone())
  }

  pub fn rich_messages<T: AsRef<PremiumFeatureRichMessages>>(t: T) -> Self {
    PremiumFeature::RichMessages(t.as_ref().clone())
  }

  pub fn saved_messages_tags<T: AsRef<PremiumFeatureSavedMessagesTags>>(t: T) -> Self {
    PremiumFeature::SavedMessagesTags(t.as_ref().clone())
  }

  pub fn text_composition<T: AsRef<PremiumFeatureTextComposition>>(t: T) -> Self {
    PremiumFeature::TextComposition(t.as_ref().clone())
  }

  pub fn unique_reactions<T: AsRef<PremiumFeatureUniqueReactions>>(t: T) -> Self {
    PremiumFeature::UniqueReactions(t.as_ref().clone())
  }

  pub fn unique_stickers<T: AsRef<PremiumFeatureUniqueStickers>>(t: T) -> Self {
    PremiumFeature::UniqueStickers(t.as_ref().clone())
  }

  pub fn upgraded_stories<T: AsRef<PremiumFeatureUpgradedStories>>(t: T) -> Self {
    PremiumFeature::UpgradedStories(t.as_ref().clone())
  }

  pub fn voice_recognition<T: AsRef<PremiumFeatureVoiceRecognition>>(t: T) -> Self {
    PremiumFeature::VoiceRecognition(t.as_ref().clone())
  }
}

impl AsRef<PremiumFeature> for PremiumFeature {
  fn as_ref(&self) -> &PremiumFeature {
    self
  }
}

/// The ability to choose accent color for replies and user profile
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureAccentColor {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureAccentColor {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureAccentColor"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureAccentColor {}

impl PremiumFeatureAccentColor {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureAccentColorBuilder {
    let inner = PremiumFeatureAccentColor {
      td_name: "premiumFeatureAccentColor".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureAccentColorBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureAccentColorBuilder {
  inner: PremiumFeatureAccentColor,
}

impl RTDPremiumFeatureAccentColorBuilder {
  pub fn build(&self) -> PremiumFeatureAccentColor {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureAccentColor> for PremiumFeatureAccentColor {
  fn as_ref(&self) -> &PremiumFeatureAccentColor {
    self
  }
}

impl AsRef<PremiumFeatureAccentColor> for RTDPremiumFeatureAccentColorBuilder {
  fn as_ref(&self) -> &PremiumFeatureAccentColor {
    &self.inner
  }
}

/// Ability to change position of the main chat list, archive and mute all new chats from non-contacts, and completely disable notifications about the user's contacts joined Telegram
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureAdvancedChatManagement {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureAdvancedChatManagement {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureAdvancedChatManagement"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureAdvancedChatManagement {}

impl PremiumFeatureAdvancedChatManagement {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureAdvancedChatManagementBuilder {
    let inner = PremiumFeatureAdvancedChatManagement {
      td_name: "premiumFeatureAdvancedChatManagement".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureAdvancedChatManagementBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureAdvancedChatManagementBuilder {
  inner: PremiumFeatureAdvancedChatManagement,
}

impl RTDPremiumFeatureAdvancedChatManagementBuilder {
  pub fn build(&self) -> PremiumFeatureAdvancedChatManagement {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureAdvancedChatManagement> for PremiumFeatureAdvancedChatManagement {
  fn as_ref(&self) -> &PremiumFeatureAdvancedChatManagement {
    self
  }
}

impl AsRef<PremiumFeatureAdvancedChatManagement>
  for RTDPremiumFeatureAdvancedChatManagementBuilder
{
  fn as_ref(&self) -> &PremiumFeatureAdvancedChatManagement {
    &self.inner
  }
}

/// Profile photo animation on message and chat screens
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureAnimatedProfilePhoto {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureAnimatedProfilePhoto {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureAnimatedProfilePhoto"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureAnimatedProfilePhoto {}

impl PremiumFeatureAnimatedProfilePhoto {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureAnimatedProfilePhotoBuilder {
    let inner = PremiumFeatureAnimatedProfilePhoto {
      td_name: "premiumFeatureAnimatedProfilePhoto".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureAnimatedProfilePhotoBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureAnimatedProfilePhotoBuilder {
  inner: PremiumFeatureAnimatedProfilePhoto,
}

impl RTDPremiumFeatureAnimatedProfilePhotoBuilder {
  pub fn build(&self) -> PremiumFeatureAnimatedProfilePhoto {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureAnimatedProfilePhoto> for PremiumFeatureAnimatedProfilePhoto {
  fn as_ref(&self) -> &PremiumFeatureAnimatedProfilePhoto {
    self
  }
}

impl AsRef<PremiumFeatureAnimatedProfilePhoto> for RTDPremiumFeatureAnimatedProfilePhotoBuilder {
  fn as_ref(&self) -> &PremiumFeatureAnimatedProfilePhoto {
    &self.inner
  }
}

/// Allowed to set premium application icons
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureAppIcons {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureAppIcons {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureAppIcons"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureAppIcons {}

impl PremiumFeatureAppIcons {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureAppIconsBuilder {
    let inner = PremiumFeatureAppIcons {
      td_name: "premiumFeatureAppIcons".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureAppIconsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureAppIconsBuilder {
  inner: PremiumFeatureAppIcons,
}

impl RTDPremiumFeatureAppIconsBuilder {
  pub fn build(&self) -> PremiumFeatureAppIcons {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureAppIcons> for PremiumFeatureAppIcons {
  fn as_ref(&self) -> &PremiumFeatureAppIcons {
    self
  }
}

impl AsRef<PremiumFeatureAppIcons> for RTDPremiumFeatureAppIconsBuilder {
  fn as_ref(&self) -> &PremiumFeatureAppIcons {
    &self.inner
  }
}

/// The ability to set private chat background for both users
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureBackgroundForBoth {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureBackgroundForBoth {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureBackgroundForBoth"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureBackgroundForBoth {}

impl PremiumFeatureBackgroundForBoth {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureBackgroundForBothBuilder {
    let inner = PremiumFeatureBackgroundForBoth {
      td_name: "premiumFeatureBackgroundForBoth".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureBackgroundForBothBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureBackgroundForBothBuilder {
  inner: PremiumFeatureBackgroundForBoth,
}

impl RTDPremiumFeatureBackgroundForBothBuilder {
  pub fn build(&self) -> PremiumFeatureBackgroundForBoth {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureBackgroundForBoth> for PremiumFeatureBackgroundForBoth {
  fn as_ref(&self) -> &PremiumFeatureBackgroundForBoth {
    self
  }
}

impl AsRef<PremiumFeatureBackgroundForBoth> for RTDPremiumFeatureBackgroundForBothBuilder {
  fn as_ref(&self) -> &PremiumFeatureBackgroundForBoth {
    &self.inner
  }
}

/// The ability to use Business features
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureBusiness {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureBusiness {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureBusiness"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureBusiness {}

impl PremiumFeatureBusiness {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureBusinessBuilder {
    let inner = PremiumFeatureBusiness {
      td_name: "premiumFeatureBusiness".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureBusinessBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureBusinessBuilder {
  inner: PremiumFeatureBusiness,
}

impl RTDPremiumFeatureBusinessBuilder {
  pub fn build(&self) -> PremiumFeatureBusiness {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureBusiness> for PremiumFeatureBusiness {
  fn as_ref(&self) -> &PremiumFeatureBusiness {
    self
  }
}

impl AsRef<PremiumFeatureBusiness> for RTDPremiumFeatureBusinessBuilder {
  fn as_ref(&self) -> &PremiumFeatureBusiness {
    &self.inner
  }
}

/// The ability to boost chats
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureChatBoost {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureChatBoost {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureChatBoost"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureChatBoost {}

impl PremiumFeatureChatBoost {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureChatBoostBuilder {
    let inner = PremiumFeatureChatBoost {
      td_name: "premiumFeatureChatBoost".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureChatBoostBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureChatBoostBuilder {
  inner: PremiumFeatureChatBoost,
}

impl RTDPremiumFeatureChatBoostBuilder {
  pub fn build(&self) -> PremiumFeatureChatBoost {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureChatBoost> for PremiumFeatureChatBoost {
  fn as_ref(&self) -> &PremiumFeatureChatBoost {
    self
  }
}

impl AsRef<PremiumFeatureChatBoost> for RTDPremiumFeatureChatBoostBuilder {
  fn as_ref(&self) -> &PremiumFeatureChatBoost {
    &self.inner
  }
}

/// The ability to create and use checklist messages
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureChecklists {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureChecklists {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureChecklists"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureChecklists {}

impl PremiumFeatureChecklists {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureChecklistsBuilder {
    let inner = PremiumFeatureChecklists {
      td_name: "premiumFeatureChecklists".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureChecklistsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureChecklistsBuilder {
  inner: PremiumFeatureChecklists,
}

impl RTDPremiumFeatureChecklistsBuilder {
  pub fn build(&self) -> PremiumFeatureChecklists {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureChecklists> for PremiumFeatureChecklists {
  fn as_ref(&self) -> &PremiumFeatureChecklists {
    self
  }
}

impl AsRef<PremiumFeatureChecklists> for RTDPremiumFeatureChecklistsBuilder {
  fn as_ref(&self) -> &PremiumFeatureChecklists {
    &self.inner
  }
}

/// Allowed to use custom emoji stickers in message texts and captions
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureCustomEmoji {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureCustomEmoji {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureCustomEmoji"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureCustomEmoji {}

impl PremiumFeatureCustomEmoji {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureCustomEmojiBuilder {
    let inner = PremiumFeatureCustomEmoji {
      td_name: "premiumFeatureCustomEmoji".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureCustomEmojiBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureCustomEmojiBuilder {
  inner: PremiumFeatureCustomEmoji,
}

impl RTDPremiumFeatureCustomEmojiBuilder {
  pub fn build(&self) -> PremiumFeatureCustomEmoji {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureCustomEmoji> for PremiumFeatureCustomEmoji {
  fn as_ref(&self) -> &PremiumFeatureCustomEmoji {
    self
  }
}

impl AsRef<PremiumFeatureCustomEmoji> for RTDPremiumFeatureCustomEmojiBuilder {
  fn as_ref(&self) -> &PremiumFeatureCustomEmoji {
    &self.inner
  }
}

/// Disabled ads
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureDisabledAds {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureDisabledAds {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureDisabledAds"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureDisabledAds {}

impl PremiumFeatureDisabledAds {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureDisabledAdsBuilder {
    let inner = PremiumFeatureDisabledAds {
      td_name: "premiumFeatureDisabledAds".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureDisabledAdsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureDisabledAdsBuilder {
  inner: PremiumFeatureDisabledAds,
}

impl RTDPremiumFeatureDisabledAdsBuilder {
  pub fn build(&self) -> PremiumFeatureDisabledAds {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureDisabledAds> for PremiumFeatureDisabledAds {
  fn as_ref(&self) -> &PremiumFeatureDisabledAds {
    self
  }
}

impl AsRef<PremiumFeatureDisabledAds> for RTDPremiumFeatureDisabledAdsBuilder {
  fn as_ref(&self) -> &PremiumFeatureDisabledAds {
    &self.inner
  }
}

/// The ability to show an emoji status along with the user's name
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureEmojiStatus {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureEmojiStatus {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureEmojiStatus"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureEmojiStatus {}

impl PremiumFeatureEmojiStatus {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureEmojiStatusBuilder {
    let inner = PremiumFeatureEmojiStatus {
      td_name: "premiumFeatureEmojiStatus".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureEmojiStatusBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureEmojiStatusBuilder {
  inner: PremiumFeatureEmojiStatus,
}

impl RTDPremiumFeatureEmojiStatusBuilder {
  pub fn build(&self) -> PremiumFeatureEmojiStatus {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureEmojiStatus> for PremiumFeatureEmojiStatus {
  fn as_ref(&self) -> &PremiumFeatureEmojiStatus {
    self
  }
}

impl AsRef<PremiumFeatureEmojiStatus> for RTDPremiumFeatureEmojiStatusBuilder {
  fn as_ref(&self) -> &PremiumFeatureEmojiStatus {
    &self.inner
  }
}

/// The ability to set a custom emoji as a forum topic icon
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureForumTopicIcon {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureForumTopicIcon {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureForumTopicIcon"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureForumTopicIcon {}

impl PremiumFeatureForumTopicIcon {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureForumTopicIconBuilder {
    let inner = PremiumFeatureForumTopicIcon {
      td_name: "premiumFeatureForumTopicIcon".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureForumTopicIconBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureForumTopicIconBuilder {
  inner: PremiumFeatureForumTopicIcon,
}

impl RTDPremiumFeatureForumTopicIconBuilder {
  pub fn build(&self) -> PremiumFeatureForumTopicIcon {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureForumTopicIcon> for PremiumFeatureForumTopicIcon {
  fn as_ref(&self) -> &PremiumFeatureForumTopicIcon {
    self
  }
}

impl AsRef<PremiumFeatureForumTopicIcon> for RTDPremiumFeatureForumTopicIconBuilder {
  fn as_ref(&self) -> &PremiumFeatureForumTopicIcon {
    &self.inner
  }
}

/// Improved download speed
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureImprovedDownloadSpeed {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureImprovedDownloadSpeed {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureImprovedDownloadSpeed"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureImprovedDownloadSpeed {}

impl PremiumFeatureImprovedDownloadSpeed {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureImprovedDownloadSpeedBuilder {
    let inner = PremiumFeatureImprovedDownloadSpeed {
      td_name: "premiumFeatureImprovedDownloadSpeed".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureImprovedDownloadSpeedBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureImprovedDownloadSpeedBuilder {
  inner: PremiumFeatureImprovedDownloadSpeed,
}

impl RTDPremiumFeatureImprovedDownloadSpeedBuilder {
  pub fn build(&self) -> PremiumFeatureImprovedDownloadSpeed {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureImprovedDownloadSpeed> for PremiumFeatureImprovedDownloadSpeed {
  fn as_ref(&self) -> &PremiumFeatureImprovedDownloadSpeed {
    self
  }
}

impl AsRef<PremiumFeatureImprovedDownloadSpeed> for RTDPremiumFeatureImprovedDownloadSpeedBuilder {
  fn as_ref(&self) -> &PremiumFeatureImprovedDownloadSpeed {
    &self.inner
  }
}

/// Increased limits
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureIncreasedLimits {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureIncreasedLimits {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureIncreasedLimits"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureIncreasedLimits {}

impl PremiumFeatureIncreasedLimits {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureIncreasedLimitsBuilder {
    let inner = PremiumFeatureIncreasedLimits {
      td_name: "premiumFeatureIncreasedLimits".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureIncreasedLimitsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureIncreasedLimitsBuilder {
  inner: PremiumFeatureIncreasedLimits,
}

impl RTDPremiumFeatureIncreasedLimitsBuilder {
  pub fn build(&self) -> PremiumFeatureIncreasedLimits {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureIncreasedLimits> for PremiumFeatureIncreasedLimits {
  fn as_ref(&self) -> &PremiumFeatureIncreasedLimits {
    self
  }
}

impl AsRef<PremiumFeatureIncreasedLimits> for RTDPremiumFeatureIncreasedLimitsBuilder {
  fn as_ref(&self) -> &PremiumFeatureIncreasedLimits {
    &self.inner
  }
}

/// Increased maximum upload file size
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureIncreasedUploadFileSize {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureIncreasedUploadFileSize {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureIncreasedUploadFileSize"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureIncreasedUploadFileSize {}

impl PremiumFeatureIncreasedUploadFileSize {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureIncreasedUploadFileSizeBuilder {
    let inner = PremiumFeatureIncreasedUploadFileSize {
      td_name: "premiumFeatureIncreasedUploadFileSize".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureIncreasedUploadFileSizeBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureIncreasedUploadFileSizeBuilder {
  inner: PremiumFeatureIncreasedUploadFileSize,
}

impl RTDPremiumFeatureIncreasedUploadFileSizeBuilder {
  pub fn build(&self) -> PremiumFeatureIncreasedUploadFileSize {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureIncreasedUploadFileSize> for PremiumFeatureIncreasedUploadFileSize {
  fn as_ref(&self) -> &PremiumFeatureIncreasedUploadFileSize {
    self
  }
}

impl AsRef<PremiumFeatureIncreasedUploadFileSize>
  for RTDPremiumFeatureIncreasedUploadFileSizeBuilder
{
  fn as_ref(&self) -> &PremiumFeatureIncreasedUploadFileSize {
    &self.inner
  }
}

/// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureLastSeenTimes {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureLastSeenTimes {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureLastSeenTimes"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureLastSeenTimes {}

impl PremiumFeatureLastSeenTimes {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureLastSeenTimesBuilder {
    let inner = PremiumFeatureLastSeenTimes {
      td_name: "premiumFeatureLastSeenTimes".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureLastSeenTimesBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureLastSeenTimesBuilder {
  inner: PremiumFeatureLastSeenTimes,
}

impl RTDPremiumFeatureLastSeenTimesBuilder {
  pub fn build(&self) -> PremiumFeatureLastSeenTimes {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureLastSeenTimes> for PremiumFeatureLastSeenTimes {
  fn as_ref(&self) -> &PremiumFeatureLastSeenTimes {
    self
  }
}

impl AsRef<PremiumFeatureLastSeenTimes> for RTDPremiumFeatureLastSeenTimesBuilder {
  fn as_ref(&self) -> &PremiumFeatureLastSeenTimes {
    &self.inner
  }
}

/// The ability to use all available message effects
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureMessageEffects {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureMessageEffects {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureMessageEffects"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureMessageEffects {}

impl PremiumFeatureMessageEffects {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureMessageEffectsBuilder {
    let inner = PremiumFeatureMessageEffects {
      td_name: "premiumFeatureMessageEffects".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureMessageEffectsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureMessageEffectsBuilder {
  inner: PremiumFeatureMessageEffects,
}

impl RTDPremiumFeatureMessageEffectsBuilder {
  pub fn build(&self) -> PremiumFeatureMessageEffects {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureMessageEffects> for PremiumFeatureMessageEffects {
  fn as_ref(&self) -> &PremiumFeatureMessageEffects {
    self
  }
}

impl AsRef<PremiumFeatureMessageEffects> for RTDPremiumFeatureMessageEffectsBuilder {
  fn as_ref(&self) -> &PremiumFeatureMessageEffects {
    &self.inner
  }
}

/// The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages and to restrict incoming messages from non-contacts using setNewChatPrivacySettings
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureMessagePrivacy {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureMessagePrivacy {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureMessagePrivacy"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureMessagePrivacy {}

impl PremiumFeatureMessagePrivacy {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureMessagePrivacyBuilder {
    let inner = PremiumFeatureMessagePrivacy {
      td_name: "premiumFeatureMessagePrivacy".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureMessagePrivacyBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureMessagePrivacyBuilder {
  inner: PremiumFeatureMessagePrivacy,
}

impl RTDPremiumFeatureMessagePrivacyBuilder {
  pub fn build(&self) -> PremiumFeatureMessagePrivacy {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureMessagePrivacy> for PremiumFeatureMessagePrivacy {
  fn as_ref(&self) -> &PremiumFeatureMessagePrivacy {
    self
  }
}

impl AsRef<PremiumFeatureMessagePrivacy> for RTDPremiumFeatureMessagePrivacyBuilder {
  fn as_ref(&self) -> &PremiumFeatureMessagePrivacy {
    &self.inner
  }
}

/// The ability to require a payment for incoming messages in new chats
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeaturePaidMessages {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeaturePaidMessages {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeaturePaidMessages"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeaturePaidMessages {}

impl PremiumFeaturePaidMessages {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeaturePaidMessagesBuilder {
    let inner = PremiumFeaturePaidMessages {
      td_name: "premiumFeaturePaidMessages".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeaturePaidMessagesBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeaturePaidMessagesBuilder {
  inner: PremiumFeaturePaidMessages,
}

impl RTDPremiumFeaturePaidMessagesBuilder {
  pub fn build(&self) -> PremiumFeaturePaidMessages {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeaturePaidMessages> for PremiumFeaturePaidMessages {
  fn as_ref(&self) -> &PremiumFeaturePaidMessages {
    self
  }
}

impl AsRef<PremiumFeaturePaidMessages> for RTDPremiumFeaturePaidMessagesBuilder {
  fn as_ref(&self) -> &PremiumFeaturePaidMessages {
    &self.inner
  }
}

/// A badge in the user's profile
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureProfileBadge {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureProfileBadge {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureProfileBadge"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureProfileBadge {}

impl PremiumFeatureProfileBadge {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureProfileBadgeBuilder {
    let inner = PremiumFeatureProfileBadge {
      td_name: "premiumFeatureProfileBadge".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureProfileBadgeBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureProfileBadgeBuilder {
  inner: PremiumFeatureProfileBadge,
}

impl RTDPremiumFeatureProfileBadgeBuilder {
  pub fn build(&self) -> PremiumFeatureProfileBadge {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureProfileBadge> for PremiumFeatureProfileBadge {
  fn as_ref(&self) -> &PremiumFeatureProfileBadge {
    self
  }
}

impl AsRef<PremiumFeatureProfileBadge> for RTDPremiumFeatureProfileBadgeBuilder {
  fn as_ref(&self) -> &PremiumFeatureProfileBadge {
    &self.inner
  }
}

/// The ability to enable content protection in private chats
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureProtectPrivateChatContent {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureProtectPrivateChatContent {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureProtectPrivateChatContent"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureProtectPrivateChatContent {}

impl PremiumFeatureProtectPrivateChatContent {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureProtectPrivateChatContentBuilder {
    let inner = PremiumFeatureProtectPrivateChatContent {
      td_name: "premiumFeatureProtectPrivateChatContent".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureProtectPrivateChatContentBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureProtectPrivateChatContentBuilder {
  inner: PremiumFeatureProtectPrivateChatContent,
}

impl RTDPremiumFeatureProtectPrivateChatContentBuilder {
  pub fn build(&self) -> PremiumFeatureProtectPrivateChatContent {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureProtectPrivateChatContent> for PremiumFeatureProtectPrivateChatContent {
  fn as_ref(&self) -> &PremiumFeatureProtectPrivateChatContent {
    self
  }
}

impl AsRef<PremiumFeatureProtectPrivateChatContent>
  for RTDPremiumFeatureProtectPrivateChatContentBuilder
{
  fn as_ref(&self) -> &PremiumFeatureProtectPrivateChatContent {
    &self.inner
  }
}

/// Allowed to translate chat messages real-time
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureRealTimeChatTranslation {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureRealTimeChatTranslation {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureRealTimeChatTranslation"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureRealTimeChatTranslation {}

impl PremiumFeatureRealTimeChatTranslation {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureRealTimeChatTranslationBuilder {
    let inner = PremiumFeatureRealTimeChatTranslation {
      td_name: "premiumFeatureRealTimeChatTranslation".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureRealTimeChatTranslationBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureRealTimeChatTranslationBuilder {
  inner: PremiumFeatureRealTimeChatTranslation,
}

impl RTDPremiumFeatureRealTimeChatTranslationBuilder {
  pub fn build(&self) -> PremiumFeatureRealTimeChatTranslation {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureRealTimeChatTranslation> for PremiumFeatureRealTimeChatTranslation {
  fn as_ref(&self) -> &PremiumFeatureRealTimeChatTranslation {
    self
  }
}

impl AsRef<PremiumFeatureRealTimeChatTranslation>
  for RTDPremiumFeatureRealTimeChatTranslationBuilder
{
  fn as_ref(&self) -> &PremiumFeatureRealTimeChatTranslation {
    &self.inner
  }
}

/// The ability to send rich messages
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureRichMessages {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureRichMessages {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureRichMessages"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureRichMessages {}

impl PremiumFeatureRichMessages {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureRichMessagesBuilder {
    let inner = PremiumFeatureRichMessages {
      td_name: "premiumFeatureRichMessages".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureRichMessagesBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureRichMessagesBuilder {
  inner: PremiumFeatureRichMessages,
}

impl RTDPremiumFeatureRichMessagesBuilder {
  pub fn build(&self) -> PremiumFeatureRichMessages {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureRichMessages> for PremiumFeatureRichMessages {
  fn as_ref(&self) -> &PremiumFeatureRichMessages {
    self
  }
}

impl AsRef<PremiumFeatureRichMessages> for RTDPremiumFeatureRichMessagesBuilder {
  fn as_ref(&self) -> &PremiumFeatureRichMessages {
    &self.inner
  }
}

/// The ability to use tags in Saved Messages
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureSavedMessagesTags {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureSavedMessagesTags {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureSavedMessagesTags"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureSavedMessagesTags {}

impl PremiumFeatureSavedMessagesTags {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureSavedMessagesTagsBuilder {
    let inner = PremiumFeatureSavedMessagesTags {
      td_name: "premiumFeatureSavedMessagesTags".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureSavedMessagesTagsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureSavedMessagesTagsBuilder {
  inner: PremiumFeatureSavedMessagesTags,
}

impl RTDPremiumFeatureSavedMessagesTagsBuilder {
  pub fn build(&self) -> PremiumFeatureSavedMessagesTags {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureSavedMessagesTags> for PremiumFeatureSavedMessagesTags {
  fn as_ref(&self) -> &PremiumFeatureSavedMessagesTags {
    self
  }
}

impl AsRef<PremiumFeatureSavedMessagesTags> for RTDPremiumFeatureSavedMessagesTagsBuilder {
  fn as_ref(&self) -> &PremiumFeatureSavedMessagesTags {
    &self.inner
  }
}

/// The ability to compose text with AI
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureTextComposition {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureTextComposition {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureTextComposition"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureTextComposition {}

impl PremiumFeatureTextComposition {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureTextCompositionBuilder {
    let inner = PremiumFeatureTextComposition {
      td_name: "premiumFeatureTextComposition".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureTextCompositionBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureTextCompositionBuilder {
  inner: PremiumFeatureTextComposition,
}

impl RTDPremiumFeatureTextCompositionBuilder {
  pub fn build(&self) -> PremiumFeatureTextComposition {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureTextComposition> for PremiumFeatureTextComposition {
  fn as_ref(&self) -> &PremiumFeatureTextComposition {
    self
  }
}

impl AsRef<PremiumFeatureTextComposition> for RTDPremiumFeatureTextCompositionBuilder {
  fn as_ref(&self) -> &PremiumFeatureTextComposition {
    &self.inner
  }
}

/// Allowed to use more reactions
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureUniqueReactions {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureUniqueReactions {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureUniqueReactions"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureUniqueReactions {}

impl PremiumFeatureUniqueReactions {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureUniqueReactionsBuilder {
    let inner = PremiumFeatureUniqueReactions {
      td_name: "premiumFeatureUniqueReactions".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureUniqueReactionsBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureUniqueReactionsBuilder {
  inner: PremiumFeatureUniqueReactions,
}

impl RTDPremiumFeatureUniqueReactionsBuilder {
  pub fn build(&self) -> PremiumFeatureUniqueReactions {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureUniqueReactions> for PremiumFeatureUniqueReactions {
  fn as_ref(&self) -> &PremiumFeatureUniqueReactions {
    self
  }
}

impl AsRef<PremiumFeatureUniqueReactions> for RTDPremiumFeatureUniqueReactionsBuilder {
  fn as_ref(&self) -> &PremiumFeatureUniqueReactions {
    &self.inner
  }
}

/// Allowed to use premium stickers with unique effects
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureUniqueStickers {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureUniqueStickers {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureUniqueStickers"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureUniqueStickers {}

impl PremiumFeatureUniqueStickers {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureUniqueStickersBuilder {
    let inner = PremiumFeatureUniqueStickers {
      td_name: "premiumFeatureUniqueStickers".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureUniqueStickersBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureUniqueStickersBuilder {
  inner: PremiumFeatureUniqueStickers,
}

impl RTDPremiumFeatureUniqueStickersBuilder {
  pub fn build(&self) -> PremiumFeatureUniqueStickers {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureUniqueStickers> for PremiumFeatureUniqueStickers {
  fn as_ref(&self) -> &PremiumFeatureUniqueStickers {
    self
  }
}

impl AsRef<PremiumFeatureUniqueStickers> for RTDPremiumFeatureUniqueStickersBuilder {
  fn as_ref(&self) -> &PremiumFeatureUniqueStickers {
    &self.inner
  }
}

/// Allowed to use many additional features for stories
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureUpgradedStories {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureUpgradedStories {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureUpgradedStories"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureUpgradedStories {}

impl PremiumFeatureUpgradedStories {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureUpgradedStoriesBuilder {
    let inner = PremiumFeatureUpgradedStories {
      td_name: "premiumFeatureUpgradedStories".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureUpgradedStoriesBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureUpgradedStoriesBuilder {
  inner: PremiumFeatureUpgradedStories,
}

impl RTDPremiumFeatureUpgradedStoriesBuilder {
  pub fn build(&self) -> PremiumFeatureUpgradedStories {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureUpgradedStories> for PremiumFeatureUpgradedStories {
  fn as_ref(&self) -> &PremiumFeatureUpgradedStories {
    self
  }
}

impl AsRef<PremiumFeatureUpgradedStories> for RTDPremiumFeatureUpgradedStoriesBuilder {
  fn as_ref(&self) -> &PremiumFeatureUpgradedStories {
    &self.inner
  }
}

/// The ability to convert voice notes to text
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PremiumFeatureVoiceRecognition {
  #[doc(hidden)]
  #[serde(rename(serialize = "@type", deserialize = "@type"))]
  td_name: String,
  #[doc(hidden)]
  #[serde(rename(serialize = "@extra", deserialize = "@extra"))]
  extra: Option<String>,
}

impl RObject for PremiumFeatureVoiceRecognition {
  #[doc(hidden)]
  fn td_name(&self) -> &'static str {
    "premiumFeatureVoiceRecognition"
  }
  #[doc(hidden)]
  fn extra(&self) -> Option<String> {
    self.extra.clone()
  }
  fn to_json(&self) -> RTDResult<String> {
    Ok(serde_json::to_string(self)?)
  }
}

impl TDPremiumFeature for PremiumFeatureVoiceRecognition {}

impl PremiumFeatureVoiceRecognition {
  pub fn from_json<S: AsRef<str>>(json: S) -> RTDResult<Self> {
    Ok(serde_json::from_str(json.as_ref())?)
  }
  pub fn builder() -> RTDPremiumFeatureVoiceRecognitionBuilder {
    let inner = PremiumFeatureVoiceRecognition {
      td_name: "premiumFeatureVoiceRecognition".to_string(),
      extra: Some(Uuid::new_v4().to_string()),
    };
    RTDPremiumFeatureVoiceRecognitionBuilder { inner }
  }
}

#[doc(hidden)]
pub struct RTDPremiumFeatureVoiceRecognitionBuilder {
  inner: PremiumFeatureVoiceRecognition,
}

impl RTDPremiumFeatureVoiceRecognitionBuilder {
  pub fn build(&self) -> PremiumFeatureVoiceRecognition {
    self.inner.clone()
  }
}

impl AsRef<PremiumFeatureVoiceRecognition> for PremiumFeatureVoiceRecognition {
  fn as_ref(&self) -> &PremiumFeatureVoiceRecognition {
    self
  }
}

impl AsRef<PremiumFeatureVoiceRecognition> for RTDPremiumFeatureVoiceRecognitionBuilder {
  fn as_ref(&self) -> &PremiumFeatureVoiceRecognition {
    &self.inner
  }
}