trust-tasks-rs 0.34.2

Reference Rust library for the Trust Tasks framework — transport-agnostic, JSON-based descriptions of verifiable work between parties.
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
//! Generated by `trust-tasks-codegen` — do not edit by hand.
//!
//! Spec slug: `rooms/info`. Version: `0.2`.
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
/// Error types.
pub mod error {
    /// Error from a `TryFrom` or `FromStr` implementation.
    pub struct ConversionError(::std::borrow::Cow<'static, str>);
    impl ::std::error::Error for ConversionError {}
    impl ::std::fmt::Display for ConversionError {
        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
            ::std::fmt::Display::fmt(&self.0, f)
        }
    }
    impl ::std::fmt::Debug for ConversionError {
        fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
            ::std::fmt::Debug::fmt(&self.0, f)
        }
    }
    impl From<&'static str> for ConversionError {
        fn from(value: &'static str) -> Self {
            Self(value.into())
        }
    }
    impl From<String> for ConversionError {
        fn from(value: String) -> Self {
            Self(value.into())
        }
    }
}
/**
What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.

**Every credential is its issuer's attestation, and only its issuer's.** For the membership credential and for every link of `authority`, a host MUST verify the credential's `proof` with a key that the credential's own `issuer` lists for `assertionMethod` in its DID document, and MUST refuse a credential whose proof names a verification method that is not its issuer's. A proof that verifies under some other party's key is that party's statement, not the issuer's, and confers nothing. The same binding holds for every other document a room signs, such as a `RevocationList`.

**A chain that verifies may still be revoked.** A host that has accepted a `RevocationList` for the room (`rooms/revocations/put`) MUST, from the moment it accepted it, refuse every presentation in which the membership credential or any link of `authority` is revoked by that list, under every task and every version of every task it serves for the room. A chain from which any link is revoked is refused whole: a credential delegated from a revoked one confers nothing, however it was attenuated. The refusal is the same `permissionDenied` as any other failed presentation.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "AuthorityPresentation",
///  "description": "What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.\n\n**Every credential is its issuer's attestation, and only its issuer's.** For the membership credential and for every link of `authority`, a host MUST verify the credential's `proof` with a key that the credential's own `issuer` lists for `assertionMethod` in its DID document, and MUST refuse a credential whose proof names a verification method that is not its issuer's. A proof that verifies under some other party's key is that party's statement, not the issuer's, and confers nothing. The same binding holds for every other document a room signs, such as a `RevocationList`.\n\n**A chain that verifies may still be revoked.** A host that has accepted a `RevocationList` for the room (`rooms/revocations/put`) MUST, from the moment it accepted it, refuse every presentation in which the membership credential or any link of `authority` is revoked by that list, under every task and every version of every task it serves for the room. A chain from which any link is revoked is refused whole: a credential delegated from a revoked one confers nothing, however it was attenuated. The refusal is the same `permissionDenied` as any other failed presentation.",
///  "type": "object",
///  "required": [
///    "authority",
///    "membership"
///  ],
///  "properties": {
///    "authority": {
///      "description": "The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.",
///      "type": "array",
///      "items": {
///        "type": "string"
///      },
///      "maxItems": 8,
///      "minItems": 1
///    },
///    "membership": {
///      "description": "The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.",
///      "type": "string"
///    },
///    "subjectBinding": {
///      "description": "REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.",
///      "type": "string"
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct AuthorityPresentation {
    ///The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.
    pub authority: ::std::vec::Vec<::std::string::String>,
    ///The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.
    pub membership: ::std::string::String,
    ///REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.
    #[serde(
        rename = "subjectBinding",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub subject_binding: ::std::option::Option<::std::string::String>,
}
impl AuthorityPresentation {
    pub fn builder() -> builder::AuthorityPresentation {
        Default::default()
    }
}
///Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "Ext",
///  "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
///  "type": "object",
///  "minProperties": 1,
///  "additionalProperties": true,
///  "propertyNames": {
///    "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///  }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(transparent)]
pub struct Ext(pub ::std::collections::HashMap<ExtKey, ::serde_json::Value>);
impl ::std::ops::Deref for Ext {
    type Target = ::std::collections::HashMap<ExtKey, ::serde_json::Value>;
    fn deref(&self) -> &::std::collections::HashMap<ExtKey, ::serde_json::Value> {
        &self.0
    }
}
impl ::std::convert::From<Ext> for ::std::collections::HashMap<ExtKey, ::serde_json::Value> {
    fn from(value: Ext) -> Self {
        value.0
    }
}
impl ::std::convert::From<::std::collections::HashMap<ExtKey, ::serde_json::Value>> for Ext {
    fn from(value: ::std::collections::HashMap<ExtKey, ::serde_json::Value>) -> Self {
        Self(value)
    }
}
///`ExtKey`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "type": "string",
///  "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[serde(transparent)]
pub struct ExtKey(::std::string::String);
impl ::std::ops::Deref for ExtKey {
    type Target = ::std::string::String;
    fn deref(&self) -> &::std::string::String {
        &self.0
    }
}
impl ::std::convert::From<ExtKey> for ::std::string::String {
    fn from(value: ExtKey) -> Self {
        value.0
    }
}
impl ::std::str::FromStr for ExtKey {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        static PATTERN: ::std::sync::LazyLock<::regress::Regex> =
            ::std::sync::LazyLock::new(|| {
                ::regress::Regex::new("^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$").unwrap()
            });
        if PATTERN.find(value).is_none() {
            return Err("doesn't match pattern \"^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$\"".into());
        }
        Ok(Self(value.to_string()))
    }
}
impl ::std::convert::TryFrom<&str> for ExtKey {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<&::std::string::String> for ExtKey {
    type Error = self::error::ConversionError;
    fn try_from(
        value: &::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<::std::string::String> for ExtKey {
    type Error = self::error::ConversionError;
    fn try_from(
        value: ::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl<'de> ::serde::Deserialize<'de> for ExtKey {
    fn deserialize<D>(deserializer: D) -> ::std::result::Result<Self, D::Error>
    where
        D: ::serde::Deserializer<'de>,
    {
        ::std::string::String::deserialize(deserializer)?
            .parse()
            .map_err(|e: self::error::ConversionError| {
                <D::Error as ::serde::de::Error>::custom(e.to_string())
            })
    }
}
///A member asks a room's host what it holds about the room: its tier, its current epoch, how long it keeps its records and when it last pruned them, the limits the host applies to its files, and how much of them the room and the member have used.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "$id": "https://trusttasks.org/spec/rooms/info/0.2",
///  "title": "Payload",
///  "description": "A member asks a room's host what it holds about the room: its tier, its current epoch, how long it keeps its records and when it last pruned them, the limits the host applies to its files, and how much of them the room and the member have used.",
///  "type": "object",
///  "required": [
///    "presentation",
///    "roomId"
///  ],
///  "properties": {
///    "ext": {
///      "description": "Ecosystem-defined extension members per SPEC.md §4.5.1.",
///      "$ref": "#/definitions/Ext"
///    },
///    "presentation": {
///      "description": "Must confer the `read` action at this room's scope.",
///      "$ref": "#/definitions/AuthorityPresentation"
///    },
///    "roomId": {
///      "description": "The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.",
///      "type": "string"
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Payload {
    ///Ecosystem-defined extension members per SPEC.md §4.5.1.
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub ext: ::std::option::Option<Ext>,
    ///Must confer the `read` action at this room's scope.
    pub presentation: AuthorityPresentation,
    ///The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.
    #[serde(rename = "roomId")]
    pub room_id: ::std::string::String,
}
impl Payload {
    pub fn builder() -> builder::Payload {
        Default::default()
    }
}
/**
The mark a prune leaves: **that** records were removed, when, and how many — never which, and never anything they said.

A prune removes records outright, tombstones included, so the room's record tree loses leaves and an incremental reader has nothing left to learn the removal from. This is what it learns from instead. A host keeps the latest one per room and serves it with every listing that can carry it (`rooms/records/list` 0.3, as `lastPrune`); a reader whose own copy of the room was synchronised to a version below `version` MUST rebuild that copy from a full listing — no `sinceVersion` — and drop every record the full listing no longer holds. Without that, a record the room removed lives on in every cache that synchronised before the prune, and a record retracted while the reader was away comes back as current.

**What a host keeps and what it does not.** A host keeps this marker, and in its audit trail the prune's `reason`, its requester where the tier discloses one, and the retention it was made under. It MUST NOT keep anything a pruned record said — body, ciphertext, cleartext, title, description, file or blob — and SHOULD NOT keep pruned records' keys: the count is the audit, and a list of keys on an `open` room, where keys may be descriptive, is content by another name.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "RecordPrune",
///  "description": "The mark a prune leaves: **that** records were removed, when, and how many — never which, and never anything they said.\n\nA prune removes records outright, tombstones included, so the room's record tree loses leaves and an incremental reader has nothing left to learn the removal from. This is what it learns from instead. A host keeps the latest one per room and serves it with every listing that can carry it (`rooms/records/list` 0.3, as `lastPrune`); a reader whose own copy of the room was synchronised to a version below `version` MUST rebuild that copy from a full listing — no `sinceVersion` — and drop every record the full listing no longer holds. Without that, a record the room removed lives on in every cache that synchronised before the prune, and a record retracted while the reader was away comes back as current.\n\n**What a host keeps and what it does not.** A host keeps this marker, and in its audit trail the prune's `reason`, its requester where the tier discloses one, and the retention it was made under. It MUST NOT keep anything a pruned record said — body, ciphertext, cleartext, title, description, file or blob — and SHOULD NOT keep pruned records' keys: the count is the audit, and a list of keys on an `open` room, where keys may be descriptive, is content by another name.",
///  "type": "object",
///  "required": [
///    "at",
///    "removed",
///    "version"
///  ],
///  "properties": {
///    "at": {
///      "description": "When the host performed it.",
///      "type": "string",
///      "format": "date-time"
///    },
///    "removed": {
///      "description": "How many records were removed, tombstones included. A prune that removed nothing leaves no mark.",
///      "type": "integer",
///      "minimum": 1.0
///    },
///    "version": {
///      "description": "The version the prune took from the room's counter, as a put or a curation would. No record carries it; it is what moves `HeadVersion` past the removal, so that a root taken before and a root taken after are never labelled with one version.",
///      "type": "integer",
///      "minimum": 1.0
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RecordPrune {
    ///When the host performed it.
    pub at: ::chrono::DateTime<::chrono::offset::Utc>,
    ///How many records were removed, tombstones included. A prune that removed nothing leaves no mark.
    pub removed: ::std::num::NonZeroU64,
    ///The version the prune took from the room's counter, as a put or a curation would. No record carries it; it is what moves `HeadVersion` past the removal, so that a root taken before and a root taken after are never labelled with one version.
    pub version: ::std::num::NonZeroU64,
}
impl RecordPrune {
    pub fn builder() -> builder::RecordPrune {
        Default::default()
    }
}
/**
How long a room keeps its records, by age: the room's **record retention**. Records older than it states become **eligible** to be removed by `rooms/records/prune`; nothing is removed until a holder of `admin` asks for a prune, and nothing a prune removes can be brought back.

**Not `retentionPolicy`, and not `retentionDays`.** Both names are taken in this family and mean other things. `retentionPolicy` (`RetentionPolicy`) is whether a room's *key chain* lets a member read epochs from before they joined, fixed at creation because key material either exists for an epoch or it does not. `retentionDays` (`rooms/create`) is how long a host keeps a whole room after it lapses unrenewed. This is a third question — how long the room keeps its *records* while it is live — and unlike the first it is a decision a room revisits, so it is changeable (`rooms/records/retention/set`). A name sharing either's would invite a reader to apply one's rules to the other.

**Age is the host's to measure, so age is `updatedAt`.** On the sealed tiers a host can read nothing of a record but its key, version, status, pinning and when it last changed, so a policy the host applies can only be stated in those terms. That is also why it cannot use a record's own `validUntil`, which is sealed: expiry is a reader's rule, retention a host's. A curation is a change, so it restarts a record's age — a retraction starts a tombstone's.

**Absent, or `{}`, means no record is ever eligible by age**, and that is the reading a host MUST apply whenever it cannot read a policy: removing data under a rule nobody stated is the failure this member exists to prevent. Every member can read the policy in force (`rooms/info`), so a record is never removed under a rule its readers could not have known.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "RecordRetention",
///  "description": "How long a room keeps its records, by age: the room's **record retention**. Records older than it states become **eligible** to be removed by `rooms/records/prune`; nothing is removed until a holder of `admin` asks for a prune, and nothing a prune removes can be brought back.\n\n**Not `retentionPolicy`, and not `retentionDays`.** Both names are taken in this family and mean other things. `retentionPolicy` (`RetentionPolicy`) is whether a room's *key chain* lets a member read epochs from before they joined, fixed at creation because key material either exists for an epoch or it does not. `retentionDays` (`rooms/create`) is how long a host keeps a whole room after it lapses unrenewed. This is a third question — how long the room keeps its *records* while it is live — and unlike the first it is a decision a room revisits, so it is changeable (`rooms/records/retention/set`). A name sharing either's would invite a reader to apply one's rules to the other.\n\n**Age is the host's to measure, so age is `updatedAt`.** On the sealed tiers a host can read nothing of a record but its key, version, status, pinning and when it last changed, so a policy the host applies can only be stated in those terms. That is also why it cannot use a record's own `validUntil`, which is sealed: expiry is a reader's rule, retention a host's. A curation is a change, so it restarts a record's age — a retraction starts a tombstone's.\n\n**Absent, or `{}`, means no record is ever eligible by age**, and that is the reading a host MUST apply whenever it cannot read a policy: removing data under a rule nobody stated is the failure this member exists to prevent. Every member can read the policy in force (`rooms/info`), so a record is never removed under a rule its readers could not have known.",
///  "type": "object",
///  "properties": {
///    "ext": {
///      "description": "Ecosystem-defined extension members per SPEC.md §4.5.1. A host MUST NOT treat a member here as making more records eligible: a removal rule a member's reader cannot understand is one they were never told about.",
///      "$ref": "#/definitions/Ext"
///    },
///    "recordDays": {
///      "description": "Days a record is kept after it last changed, whatever its standing. A record — `active`, `deprecated` or `retracted` — whose `updatedAt` is more than this long ago is eligible, **unless it is pinned**: pinning says what matters in the room, and a room that wants a pinned record gone unpins it first. Absent means records are never eligible by age.",
///      "type": "integer",
///      "maximum": 36500.0,
///      "minimum": 1.0
///    },
///    "tombstoneDays": {
///      "description": "Days a retracted record's tombstone is kept after its retraction. A tombstone whose `updatedAt` is more than this long ago is eligible. Tombstones exist so that a member syncing incrementally learns of a retraction (`rooms/records/curate`); this is how long a member may stay away and still learn of one that way rather than by rebuilding their copy of the room. Absent means tombstones are never eligible.",
///      "type": "integer",
///      "maximum": 36500.0,
///      "minimum": 1.0
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RecordRetention {
    ///Ecosystem-defined extension members per SPEC.md §4.5.1. A host MUST NOT treat a member here as making more records eligible: a removal rule a member's reader cannot understand is one they were never told about.
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub ext: ::std::option::Option<Ext>,
    ///Days a record is kept after it last changed, whatever its standing. A record — `active`, `deprecated` or `retracted` — whose `updatedAt` is more than this long ago is eligible, **unless it is pinned**: pinning says what matters in the room, and a room that wants a pinned record gone unpins it first. Absent means records are never eligible by age.
    #[serde(
        rename = "recordDays",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub record_days: ::std::option::Option<::std::num::NonZeroU64>,
    ///Days a retracted record's tombstone is kept after its retraction. A tombstone whose `updatedAt` is more than this long ago is eligible. Tombstones exist so that a member syncing incrementally learns of a retraction (`rooms/records/curate`); this is how long a member may stay away and still learn of one that way rather than by rebuilding their copy of the room. Absent means tombstones are never eligible.
    #[serde(
        rename = "tombstoneDays",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub tombstone_days: ::std::option::Option<::std::num::NonZeroU64>,
}
impl ::std::default::Default for RecordRetention {
    fn default() -> Self {
        Self {
            ext: Default::default(),
            record_days: Default::default(),
            tombstone_days: Default::default(),
        }
    }
}
impl RecordRetention {
    pub fn builder() -> builder::RecordRetention {
        Default::default()
    }
}
///Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.2#response.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "Response",
///  "description": "Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.2#response.",
///  "type": "object",
///  "required": [
///    "epoch",
///    "limits",
///    "roomId",
///    "usage",
///    "visibility"
///  ],
///  "properties": {
///    "epoch": {
///      "description": "The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.",
///      "type": "integer",
///      "minimum": 1.0
///    },
///    "ext": {
///      "$ref": "#/definitions/Ext"
///    },
///    "lastPrune": {
///      "description": "The room's latest record prune: when, how many, and the version it took. Absent when the room's records have never been pruned. A reader whose copy of the room was synchronised below `lastPrune.version` rebuilds it (`RecordPrune`).",
///      "$ref": "#/definitions/RecordPrune"
///    },
///    "limits": {
///      "description": "The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.",
///      "$ref": "#/definitions/RoomLimits"
///    },
///    "recordRetention": {
///      "description": "The room's record retention in force: which records `rooms/records/prune` may remove, by age. Absent means none — no record is eligible by age. Served to every member who may read the room, because a record is never to be removed under a rule its readers could not have read.",
///      "$ref": "#/definitions/RecordRetention"
///    },
///    "retentionPolicy": {
///      "description": "Absent means `chained`, as everywhere in this family.",
///      "$ref": "#/definitions/RetentionPolicy"
///    },
///    "roomId": {
///      "description": "The room this describes, echoed so a response cannot be mistaken for another room's.",
///      "type": "string"
///    },
///    "usage": {
///      "type": "object",
///      "required": [
///        "room"
///      ],
///      "properties": {
///        "member": {
///          "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
///          "type": "object",
///          "required": [
///            "limits",
///            "usage"
///          ],
///          "properties": {
///            "limits": {
///              "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
///              "$ref": "#/definitions/ScopeLimits"
///            },
///            "usage": {
///              "$ref": "#/definitions/Usage"
///            }
///          },
///          "additionalProperties": false
///        },
///        "room": {
///          "description": "The room as a whole.",
///          "$ref": "#/definitions/Usage"
///        }
///      },
///      "additionalProperties": false
///    },
///    "visibility": {
///      "$ref": "#/definitions/Visibility"
///    }
///  },
///  "additionalProperties": false,
///  "$anchor": "response"
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Response {
    ///The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.
    pub epoch: ::std::num::NonZeroU64,
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub ext: ::std::option::Option<Ext>,
    ///The room's latest record prune: when, how many, and the version it took. Absent when the room's records have never been pruned. A reader whose copy of the room was synchronised below `lastPrune.version` rebuilds it (`RecordPrune`).
    #[serde(
        rename = "lastPrune",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub last_prune: ::std::option::Option<RecordPrune>,
    ///The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.
    pub limits: RoomLimits,
    ///The room's record retention in force: which records `rooms/records/prune` may remove, by age. Absent means none — no record is eligible by age. Served to every member who may read the room, because a record is never to be removed under a rule its readers could not have read.
    #[serde(
        rename = "recordRetention",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub record_retention: ::std::option::Option<RecordRetention>,
    ///Absent means `chained`, as everywhere in this family.
    #[serde(
        rename = "retentionPolicy",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub retention_policy: ::std::option::Option<RetentionPolicy>,
    ///The room this describes, echoed so a response cannot be mistaken for another room's.
    #[serde(rename = "roomId")]
    pub room_id: ::std::string::String,
    pub usage: ResponseUsage,
    pub visibility: Visibility,
}
impl Response {
    pub fn builder() -> builder::Response {
        Default::default()
    }
}
///`ResponseUsage`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "type": "object",
///  "required": [
///    "room"
///  ],
///  "properties": {
///    "member": {
///      "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
///      "type": "object",
///      "required": [
///        "limits",
///        "usage"
///      ],
///      "properties": {
///        "limits": {
///          "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
///          "$ref": "#/definitions/ScopeLimits"
///        },
///        "usage": {
///          "$ref": "#/definitions/Usage"
///        }
///      },
///      "additionalProperties": false
///    },
///    "room": {
///      "description": "The room as a whole.",
///      "$ref": "#/definitions/Usage"
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsage {
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub member: ::std::option::Option<ResponseUsageMember>,
    ///The room as a whole.
    pub room: Usage,
}
impl ResponseUsage {
    pub fn builder() -> builder::ResponseUsage {
        Default::default()
    }
}
///The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "description": "The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.",
///  "type": "object",
///  "required": [
///    "limits",
///    "usage"
///  ],
///  "properties": {
///    "limits": {
///      "description": "The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.",
///      "$ref": "#/definitions/ScopeLimits"
///    },
///    "usage": {
///      "$ref": "#/definitions/Usage"
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ResponseUsageMember {
    ///The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.
    pub limits: ScopeLimits,
    pub usage: Usage,
}
impl ResponseUsageMember {
    pub fn builder() -> builder::ResponseUsageMember {
        Default::default()
    }
}
///Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "RetentionPolicy",
///  "description": "Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.",
///  "type": "string",
///  "enum": [
///    "chained",
///    "fromJoin"
///  ],
///  "$comment": "Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it."
///}
/// ```
/// </details>
#[derive(
    ::serde::Deserialize,
    ::serde::Serialize,
    Clone,
    Copy,
    Debug,
    Eq,
    Hash,
    Ord,
    PartialEq,
    PartialOrd,
)]
#[non_exhaustive]
pub enum RetentionPolicy {
    #[serde(rename = "chained")]
    Chained,
    #[serde(rename = "fromJoin")]
    FromJoin,
}
impl ::std::fmt::Display for RetentionPolicy {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match *self {
            Self::Chained => f.write_str("chained"),
            Self::FromJoin => f.write_str("fromJoin"),
        }
    }
}
impl ::std::str::FromStr for RetentionPolicy {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        match value {
            "chained" => Ok(Self::Chained),
            "fromJoin" => Ok(Self::FromJoin),
            _ => Err("invalid value".into()),
        }
    }
}
impl ::std::convert::TryFrom<&str> for RetentionPolicy {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<&::std::string::String> for RetentionPolicy {
    type Error = self::error::ConversionError;
    fn try_from(
        value: &::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<::std::string::String> for RetentionPolicy {
    type Error = self::error::ConversionError;
    fn try_from(
        value: ::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
///How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "RoomLimits",
///  "description": "How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.",
///  "type": "object",
///  "required": [
///    "filesEnabled"
///  ],
///  "properties": {
///    "filesEnabled": {
///      "description": "False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.",
///      "type": "boolean"
///    },
///    "member": {
///      "description": "Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.",
///      "$ref": "#/definitions/ScopeLimits"
///    },
///    "room": {
///      "description": "Limits on the room as a whole.",
///      "$ref": "#/definitions/ScopeLimits"
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct RoomLimits {
    ///False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.
    #[serde(rename = "filesEnabled")]
    pub files_enabled: bool,
    ///Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub member: ::std::option::Option<ScopeLimits>,
    ///Limits on the room as a whole.
    #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
    pub room: ::std::option::Option<ScopeLimits>,
}
impl RoomLimits {
    pub fn builder() -> builder::RoomLimits {
        Default::default()
    }
}
///Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "ScopeLimits",
///  "description": "Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.",
///  "type": "object",
///  "properties": {
///    "maxBytes": {
///      "description": "The total size of the committed and reserved blobs the scope may hold.",
///      "type": "integer",
///      "minimum": 0.0
///    },
///    "maxFileBytes": {
///      "description": "The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).",
///      "type": "integer",
///      "maximum": 1073741824.0,
///      "minimum": 0.0
///    },
///    "maxFiles": {
///      "description": "The number of committed blobs the scope may hold. 0 refuses every upload at this scope.",
///      "type": "integer",
///      "minimum": 0.0
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct ScopeLimits {
    ///The total size of the committed and reserved blobs the scope may hold.
    #[serde(
        rename = "maxBytes",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub max_bytes: ::std::option::Option<u64>,
    ///The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).
    #[serde(
        rename = "maxFileBytes",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub max_file_bytes: ::std::option::Option<i64>,
    ///The number of committed blobs the scope may hold. 0 refuses every upload at this scope.
    #[serde(
        rename = "maxFiles",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub max_files: ::std::option::Option<u64>,
}
impl ::std::default::Default for ScopeLimits {
    fn default() -> Self {
        Self {
            max_bytes: Default::default(),
            max_file_bytes: Default::default(),
            max_files: Default::default(),
        }
    }
}
impl ScopeLimits {
    pub fn builder() -> builder::ScopeLimits {
        Default::default()
    }
}
///What one scope holds now. Ciphertext bytes throughout.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "Usage",
///  "description": "What one scope holds now. Ciphertext bytes throughout.",
///  "type": "object",
///  "required": [
///    "bytes",
///    "files",
///    "reservedBytes"
///  ],
///  "properties": {
///    "bytes": {
///      "description": "Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.",
///      "type": "integer",
///      "minimum": 0.0
///    },
///    "files": {
///      "description": "Committed blobs that are not orphaned.",
///      "type": "integer",
///      "minimum": 0.0
///    },
///    "reservedBytes": {
///      "description": "Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.",
///      "type": "integer",
///      "minimum": 0.0
///    },
///    "reservedFiles": {
///      "description": "Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.",
///      "type": "integer",
///      "minimum": 0.0
///    }
///  },
///  "additionalProperties": false
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(deny_unknown_fields)]
#[non_exhaustive]
pub struct Usage {
    ///Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.
    pub bytes: u64,
    ///Committed blobs that are not orphaned.
    pub files: u64,
    ///Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.
    #[serde(rename = "reservedBytes")]
    pub reserved_bytes: u64,
    ///Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.
    #[serde(
        rename = "reservedFiles",
        default,
        skip_serializing_if = "::std::option::Option::is_none"
    )]
    pub reserved_files: ::std::option::Option<u64>,
}
impl Usage {
    pub fn builder() -> builder::Usage {
        Default::default()
    }
}
///How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "Visibility",
///  "description": "How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.",
///  "type": "string",
///  "enum": [
///    "open",
///    "attributed",
///    "private"
///  ]
///}
/// ```
/// </details>
#[derive(
    ::serde::Deserialize,
    ::serde::Serialize,
    Clone,
    Copy,
    Debug,
    Eq,
    Hash,
    Ord,
    PartialEq,
    PartialOrd,
)]
#[non_exhaustive]
pub enum Visibility {
    #[serde(rename = "open")]
    Open,
    #[serde(rename = "attributed")]
    Attributed,
    #[serde(rename = "private")]
    Private,
}
impl ::std::fmt::Display for Visibility {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match *self {
            Self::Open => f.write_str("open"),
            Self::Attributed => f.write_str("attributed"),
            Self::Private => f.write_str("private"),
        }
    }
}
impl ::std::str::FromStr for Visibility {
    type Err = self::error::ConversionError;
    fn from_str(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        match value {
            "open" => Ok(Self::Open),
            "attributed" => Ok(Self::Attributed),
            "private" => Ok(Self::Private),
            _ => Err("invalid value".into()),
        }
    }
}
impl ::std::convert::TryFrom<&str> for Visibility {
    type Error = self::error::ConversionError;
    fn try_from(value: &str) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<&::std::string::String> for Visibility {
    type Error = self::error::ConversionError;
    fn try_from(
        value: &::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
impl ::std::convert::TryFrom<::std::string::String> for Visibility {
    type Error = self::error::ConversionError;
    fn try_from(
        value: ::std::string::String,
    ) -> ::std::result::Result<Self, self::error::ConversionError> {
        value.parse()
    }
}
/// Types for composing complex structures.
pub mod builder {
    #[derive(Clone, Debug)]
    pub struct AuthorityPresentation {
        authority:
            ::std::result::Result<::std::vec::Vec<::std::string::String>, ::std::string::String>,
        membership: ::std::result::Result<::std::string::String, ::std::string::String>,
        subject_binding: ::std::result::Result<
            ::std::option::Option<::std::string::String>,
            ::std::string::String,
        >,
    }
    impl ::std::default::Default for AuthorityPresentation {
        fn default() -> Self {
            Self {
                authority: Err("no value supplied for authority".to_string()),
                membership: Err("no value supplied for membership".to_string()),
                subject_binding: Ok(Default::default()),
            }
        }
    }
    impl AuthorityPresentation {
        pub fn authority<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::vec::Vec<::std::string::String>>,
            T::Error: ::std::fmt::Display,
        {
            self.authority = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for authority: {e}"));
            self
        }
        pub fn membership<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::string::String>,
            T::Error: ::std::fmt::Display,
        {
            self.membership = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for membership: {e}"));
            self
        }
        pub fn subject_binding<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<::std::string::String>>,
            T::Error: ::std::fmt::Display,
        {
            self.subject_binding = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for subject_binding: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<AuthorityPresentation> for super::AuthorityPresentation {
        type Error = super::error::ConversionError;
        fn try_from(
            value: AuthorityPresentation,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                authority: value.authority?,
                membership: value.membership?,
                subject_binding: value.subject_binding?,
            })
        }
    }
    impl ::std::convert::From<super::AuthorityPresentation> for AuthorityPresentation {
        fn from(value: super::AuthorityPresentation) -> Self {
            Self {
                authority: Ok(value.authority),
                membership: Ok(value.membership),
                subject_binding: Ok(value.subject_binding),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct Payload {
        ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
        presentation: ::std::result::Result<super::AuthorityPresentation, ::std::string::String>,
        room_id: ::std::result::Result<::std::string::String, ::std::string::String>,
    }
    impl ::std::default::Default for Payload {
        fn default() -> Self {
            Self {
                ext: Ok(Default::default()),
                presentation: Err("no value supplied for presentation".to_string()),
                room_id: Err("no value supplied for room_id".to_string()),
            }
        }
    }
    impl Payload {
        pub fn ext<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
            T::Error: ::std::fmt::Display,
        {
            self.ext = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for ext: {e}"));
            self
        }
        pub fn presentation<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::AuthorityPresentation>,
            T::Error: ::std::fmt::Display,
        {
            self.presentation = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for presentation: {e}"));
            self
        }
        pub fn room_id<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::string::String>,
            T::Error: ::std::fmt::Display,
        {
            self.room_id = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for room_id: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<Payload> for super::Payload {
        type Error = super::error::ConversionError;
        fn try_from(value: Payload) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                ext: value.ext?,
                presentation: value.presentation?,
                room_id: value.room_id?,
            })
        }
    }
    impl ::std::convert::From<super::Payload> for Payload {
        fn from(value: super::Payload) -> Self {
            Self {
                ext: Ok(value.ext),
                presentation: Ok(value.presentation),
                room_id: Ok(value.room_id),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct RecordPrune {
        at: ::std::result::Result<::chrono::DateTime<::chrono::offset::Utc>, ::std::string::String>,
        removed: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
        version: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
    }
    impl ::std::default::Default for RecordPrune {
        fn default() -> Self {
            Self {
                at: Err("no value supplied for at".to_string()),
                removed: Err("no value supplied for removed".to_string()),
                version: Err("no value supplied for version".to_string()),
            }
        }
    }
    impl RecordPrune {
        pub fn at<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::chrono::DateTime<::chrono::offset::Utc>>,
            T::Error: ::std::fmt::Display,
        {
            self.at = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for at: {e}"));
            self
        }
        pub fn removed<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::num::NonZeroU64>,
            T::Error: ::std::fmt::Display,
        {
            self.removed = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for removed: {e}"));
            self
        }
        pub fn version<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::num::NonZeroU64>,
            T::Error: ::std::fmt::Display,
        {
            self.version = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for version: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<RecordPrune> for super::RecordPrune {
        type Error = super::error::ConversionError;
        fn try_from(
            value: RecordPrune,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                at: value.at?,
                removed: value.removed?,
                version: value.version?,
            })
        }
    }
    impl ::std::convert::From<super::RecordPrune> for RecordPrune {
        fn from(value: super::RecordPrune) -> Self {
            Self {
                at: Ok(value.at),
                removed: Ok(value.removed),
                version: Ok(value.version),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct RecordRetention {
        ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
        record_days: ::std::result::Result<
            ::std::option::Option<::std::num::NonZeroU64>,
            ::std::string::String,
        >,
        tombstone_days: ::std::result::Result<
            ::std::option::Option<::std::num::NonZeroU64>,
            ::std::string::String,
        >,
    }
    impl ::std::default::Default for RecordRetention {
        fn default() -> Self {
            Self {
                ext: Ok(Default::default()),
                record_days: Ok(Default::default()),
                tombstone_days: Ok(Default::default()),
            }
        }
    }
    impl RecordRetention {
        pub fn ext<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
            T::Error: ::std::fmt::Display,
        {
            self.ext = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for ext: {e}"));
            self
        }
        pub fn record_days<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
            T::Error: ::std::fmt::Display,
        {
            self.record_days = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for record_days: {e}"));
            self
        }
        pub fn tombstone_days<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<::std::num::NonZeroU64>>,
            T::Error: ::std::fmt::Display,
        {
            self.tombstone_days = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for tombstone_days: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<RecordRetention> for super::RecordRetention {
        type Error = super::error::ConversionError;
        fn try_from(
            value: RecordRetention,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                ext: value.ext?,
                record_days: value.record_days?,
                tombstone_days: value.tombstone_days?,
            })
        }
    }
    impl ::std::convert::From<super::RecordRetention> for RecordRetention {
        fn from(value: super::RecordRetention) -> Self {
            Self {
                ext: Ok(value.ext),
                record_days: Ok(value.record_days),
                tombstone_days: Ok(value.tombstone_days),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct Response {
        epoch: ::std::result::Result<::std::num::NonZeroU64, ::std::string::String>,
        ext: ::std::result::Result<::std::option::Option<super::Ext>, ::std::string::String>,
        last_prune:
            ::std::result::Result<::std::option::Option<super::RecordPrune>, ::std::string::String>,
        limits: ::std::result::Result<super::RoomLimits, ::std::string::String>,
        record_retention: ::std::result::Result<
            ::std::option::Option<super::RecordRetention>,
            ::std::string::String,
        >,
        retention_policy: ::std::result::Result<
            ::std::option::Option<super::RetentionPolicy>,
            ::std::string::String,
        >,
        room_id: ::std::result::Result<::std::string::String, ::std::string::String>,
        usage: ::std::result::Result<super::ResponseUsage, ::std::string::String>,
        visibility: ::std::result::Result<super::Visibility, ::std::string::String>,
    }
    impl ::std::default::Default for Response {
        fn default() -> Self {
            Self {
                epoch: Err("no value supplied for epoch".to_string()),
                ext: Ok(Default::default()),
                last_prune: Ok(Default::default()),
                limits: Err("no value supplied for limits".to_string()),
                record_retention: Ok(Default::default()),
                retention_policy: Ok(Default::default()),
                room_id: Err("no value supplied for room_id".to_string()),
                usage: Err("no value supplied for usage".to_string()),
                visibility: Err("no value supplied for visibility".to_string()),
            }
        }
    }
    impl Response {
        pub fn epoch<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::num::NonZeroU64>,
            T::Error: ::std::fmt::Display,
        {
            self.epoch = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for epoch: {e}"));
            self
        }
        pub fn ext<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::Ext>>,
            T::Error: ::std::fmt::Display,
        {
            self.ext = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for ext: {e}"));
            self
        }
        pub fn last_prune<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::RecordPrune>>,
            T::Error: ::std::fmt::Display,
        {
            self.last_prune = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for last_prune: {e}"));
            self
        }
        pub fn limits<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::RoomLimits>,
            T::Error: ::std::fmt::Display,
        {
            self.limits = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for limits: {e}"));
            self
        }
        pub fn record_retention<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::RecordRetention>>,
            T::Error: ::std::fmt::Display,
        {
            self.record_retention = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for record_retention: {e}"));
            self
        }
        pub fn retention_policy<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::RetentionPolicy>>,
            T::Error: ::std::fmt::Display,
        {
            self.retention_policy = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for retention_policy: {e}"));
            self
        }
        pub fn room_id<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::string::String>,
            T::Error: ::std::fmt::Display,
        {
            self.room_id = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for room_id: {e}"));
            self
        }
        pub fn usage<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::ResponseUsage>,
            T::Error: ::std::fmt::Display,
        {
            self.usage = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for usage: {e}"));
            self
        }
        pub fn visibility<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::Visibility>,
            T::Error: ::std::fmt::Display,
        {
            self.visibility = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for visibility: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<Response> for super::Response {
        type Error = super::error::ConversionError;
        fn try_from(value: Response) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                epoch: value.epoch?,
                ext: value.ext?,
                last_prune: value.last_prune?,
                limits: value.limits?,
                record_retention: value.record_retention?,
                retention_policy: value.retention_policy?,
                room_id: value.room_id?,
                usage: value.usage?,
                visibility: value.visibility?,
            })
        }
    }
    impl ::std::convert::From<super::Response> for Response {
        fn from(value: super::Response) -> Self {
            Self {
                epoch: Ok(value.epoch),
                ext: Ok(value.ext),
                last_prune: Ok(value.last_prune),
                limits: Ok(value.limits),
                record_retention: Ok(value.record_retention),
                retention_policy: Ok(value.retention_policy),
                room_id: Ok(value.room_id),
                usage: Ok(value.usage),
                visibility: Ok(value.visibility),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct ResponseUsage {
        member: ::std::result::Result<
            ::std::option::Option<super::ResponseUsageMember>,
            ::std::string::String,
        >,
        room: ::std::result::Result<super::Usage, ::std::string::String>,
    }
    impl ::std::default::Default for ResponseUsage {
        fn default() -> Self {
            Self {
                member: Ok(Default::default()),
                room: Err("no value supplied for room".to_string()),
            }
        }
    }
    impl ResponseUsage {
        pub fn member<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::ResponseUsageMember>>,
            T::Error: ::std::fmt::Display,
        {
            self.member = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for member: {e}"));
            self
        }
        pub fn room<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::Usage>,
            T::Error: ::std::fmt::Display,
        {
            self.room = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for room: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<ResponseUsage> for super::ResponseUsage {
        type Error = super::error::ConversionError;
        fn try_from(
            value: ResponseUsage,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                member: value.member?,
                room: value.room?,
            })
        }
    }
    impl ::std::convert::From<super::ResponseUsage> for ResponseUsage {
        fn from(value: super::ResponseUsage) -> Self {
            Self {
                member: Ok(value.member),
                room: Ok(value.room),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct ResponseUsageMember {
        limits: ::std::result::Result<super::ScopeLimits, ::std::string::String>,
        usage: ::std::result::Result<super::Usage, ::std::string::String>,
    }
    impl ::std::default::Default for ResponseUsageMember {
        fn default() -> Self {
            Self {
                limits: Err("no value supplied for limits".to_string()),
                usage: Err("no value supplied for usage".to_string()),
            }
        }
    }
    impl ResponseUsageMember {
        pub fn limits<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::ScopeLimits>,
            T::Error: ::std::fmt::Display,
        {
            self.limits = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for limits: {e}"));
            self
        }
        pub fn usage<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<super::Usage>,
            T::Error: ::std::fmt::Display,
        {
            self.usage = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for usage: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<ResponseUsageMember> for super::ResponseUsageMember {
        type Error = super::error::ConversionError;
        fn try_from(
            value: ResponseUsageMember,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                limits: value.limits?,
                usage: value.usage?,
            })
        }
    }
    impl ::std::convert::From<super::ResponseUsageMember> for ResponseUsageMember {
        fn from(value: super::ResponseUsageMember) -> Self {
            Self {
                limits: Ok(value.limits),
                usage: Ok(value.usage),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct RoomLimits {
        files_enabled: ::std::result::Result<bool, ::std::string::String>,
        member:
            ::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
        room:
            ::std::result::Result<::std::option::Option<super::ScopeLimits>, ::std::string::String>,
    }
    impl ::std::default::Default for RoomLimits {
        fn default() -> Self {
            Self {
                files_enabled: Err("no value supplied for files_enabled".to_string()),
                member: Ok(Default::default()),
                room: Ok(Default::default()),
            }
        }
    }
    impl RoomLimits {
        pub fn files_enabled<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<bool>,
            T::Error: ::std::fmt::Display,
        {
            self.files_enabled = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for files_enabled: {e}"));
            self
        }
        pub fn member<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
            T::Error: ::std::fmt::Display,
        {
            self.member = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for member: {e}"));
            self
        }
        pub fn room<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<super::ScopeLimits>>,
            T::Error: ::std::fmt::Display,
        {
            self.room = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for room: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<RoomLimits> for super::RoomLimits {
        type Error = super::error::ConversionError;
        fn try_from(
            value: RoomLimits,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                files_enabled: value.files_enabled?,
                member: value.member?,
                room: value.room?,
            })
        }
    }
    impl ::std::convert::From<super::RoomLimits> for RoomLimits {
        fn from(value: super::RoomLimits) -> Self {
            Self {
                files_enabled: Ok(value.files_enabled),
                member: Ok(value.member),
                room: Ok(value.room),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct ScopeLimits {
        max_bytes: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
        max_file_bytes: ::std::result::Result<::std::option::Option<i64>, ::std::string::String>,
        max_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
    }
    impl ::std::default::Default for ScopeLimits {
        fn default() -> Self {
            Self {
                max_bytes: Ok(Default::default()),
                max_file_bytes: Ok(Default::default()),
                max_files: Ok(Default::default()),
            }
        }
    }
    impl ScopeLimits {
        pub fn max_bytes<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<u64>>,
            T::Error: ::std::fmt::Display,
        {
            self.max_bytes = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for max_bytes: {e}"));
            self
        }
        pub fn max_file_bytes<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<i64>>,
            T::Error: ::std::fmt::Display,
        {
            self.max_file_bytes = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for max_file_bytes: {e}"));
            self
        }
        pub fn max_files<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<u64>>,
            T::Error: ::std::fmt::Display,
        {
            self.max_files = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for max_files: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<ScopeLimits> for super::ScopeLimits {
        type Error = super::error::ConversionError;
        fn try_from(
            value: ScopeLimits,
        ) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                max_bytes: value.max_bytes?,
                max_file_bytes: value.max_file_bytes?,
                max_files: value.max_files?,
            })
        }
    }
    impl ::std::convert::From<super::ScopeLimits> for ScopeLimits {
        fn from(value: super::ScopeLimits) -> Self {
            Self {
                max_bytes: Ok(value.max_bytes),
                max_file_bytes: Ok(value.max_file_bytes),
                max_files: Ok(value.max_files),
            }
        }
    }
    #[derive(Clone, Debug)]
    pub struct Usage {
        bytes: ::std::result::Result<u64, ::std::string::String>,
        files: ::std::result::Result<u64, ::std::string::String>,
        reserved_bytes: ::std::result::Result<u64, ::std::string::String>,
        reserved_files: ::std::result::Result<::std::option::Option<u64>, ::std::string::String>,
    }
    impl ::std::default::Default for Usage {
        fn default() -> Self {
            Self {
                bytes: Err("no value supplied for bytes".to_string()),
                files: Err("no value supplied for files".to_string()),
                reserved_bytes: Err("no value supplied for reserved_bytes".to_string()),
                reserved_files: Ok(Default::default()),
            }
        }
    }
    impl Usage {
        pub fn bytes<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<u64>,
            T::Error: ::std::fmt::Display,
        {
            self.bytes = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for bytes: {e}"));
            self
        }
        pub fn files<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<u64>,
            T::Error: ::std::fmt::Display,
        {
            self.files = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for files: {e}"));
            self
        }
        pub fn reserved_bytes<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<u64>,
            T::Error: ::std::fmt::Display,
        {
            self.reserved_bytes = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for reserved_bytes: {e}"));
            self
        }
        pub fn reserved_files<T>(mut self, value: T) -> Self
        where
            T: ::std::convert::TryInto<::std::option::Option<u64>>,
            T::Error: ::std::fmt::Display,
        {
            self.reserved_files = value
                .try_into()
                .map_err(|e| format!("error converting supplied value for reserved_files: {e}"));
            self
        }
    }
    impl ::std::convert::TryFrom<Usage> for super::Usage {
        type Error = super::error::ConversionError;
        fn try_from(value: Usage) -> ::std::result::Result<Self, super::error::ConversionError> {
            Ok(Self {
                bytes: value.bytes?,
                files: value.files?,
                reserved_bytes: value.reserved_bytes?,
                reserved_files: value.reserved_files?,
            })
        }
    }
    impl ::std::convert::From<super::Usage> for Usage {
        fn from(value: super::Usage) -> Self {
            Self {
                bytes: Ok(value.bytes),
                files: Ok(value.files),
                reserved_bytes: Ok(value.reserved_bytes),
                reserved_files: Ok(value.reserved_files),
            }
        }
    }
}
impl crate::Payload for Payload {
    const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/info/0.2";
    const IS_PROOF_REQUIRED: bool = true;
    const IS_RECIPIENT_REQUIRED: bool = true;
    const PAYLOAD_SCHEMA: Option<&'static str> = Some(
        "{\n  \"$defs\": {\n    \"AuthorityPresentation\": {\n      \"additionalProperties\": false,\n      \"description\": \"What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.\\n\\n**Every credential is its issuer's attestation, and only its issuer's.** For the membership credential and for every link of `authority`, a host MUST verify the credential's `proof` with a key that the credential's own `issuer` lists for `assertionMethod` in its DID document, and MUST refuse a credential whose proof names a verification method that is not its issuer's. A proof that verifies under some other party's key is that party's statement, not the issuer's, and confers nothing. The same binding holds for every other document a room signs, such as a `RevocationList`.\\n\\n**A chain that verifies may still be revoked.** A host that has accepted a `RevocationList` for the room (`rooms/revocations/put`) MUST, from the moment it accepted it, refuse every presentation in which the membership credential or any link of `authority` is revoked by that list, under every task and every version of every task it serves for the room. A chain from which any link is revoked is refused whole: a credential delegated from a revoked one confers nothing, however it was attenuated. The refusal is the same `permissionDenied` as any other failed presentation.\",\n      \"properties\": {\n        \"authority\": {\n          \"description\": \"The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.\",\n          \"items\": {\n            \"type\": \"string\"\n          },\n          \"maxItems\": 8,\n          \"minItems\": 1,\n          \"type\": \"array\"\n        },\n        \"membership\": {\n          \"description\": \"The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.\",\n          \"type\": \"string\"\n        },\n        \"subjectBinding\": {\n          \"description\": \"REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"membership\",\n        \"authority\"\n      ],\n      \"title\": \"AuthorityPresentation\",\n      \"type\": \"object\"\n    },\n    \"Ext\": {\n      \"additionalProperties\": true,\n      \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n      \"minProperties\": 1,\n      \"propertyNames\": {\n        \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n      },\n      \"title\": \"Ext\",\n      \"type\": \"object\"\n    },\n    \"RecordPrune\": {\n      \"additionalProperties\": false,\n      \"description\": \"The mark a prune leaves: **that** records were removed, when, and how many — never which, and never anything they said.\\n\\nA prune removes records outright, tombstones included, so the room's record tree loses leaves and an incremental reader has nothing left to learn the removal from. This is what it learns from instead. A host keeps the latest one per room and serves it with every listing that can carry it (`rooms/records/list` 0.3, as `lastPrune`); a reader whose own copy of the room was synchronised to a version below `version` MUST rebuild that copy from a full listing — no `sinceVersion` — and drop every record the full listing no longer holds. Without that, a record the room removed lives on in every cache that synchronised before the prune, and a record retracted while the reader was away comes back as current.\\n\\n**What a host keeps and what it does not.** A host keeps this marker, and in its audit trail the prune's `reason`, its requester where the tier discloses one, and the retention it was made under. It MUST NOT keep anything a pruned record said — body, ciphertext, cleartext, title, description, file or blob — and SHOULD NOT keep pruned records' keys: the count is the audit, and a list of keys on an `open` room, where keys may be descriptive, is content by another name.\",\n      \"properties\": {\n        \"at\": {\n          \"description\": \"When the host performed it.\",\n          \"format\": \"date-time\",\n          \"type\": \"string\"\n        },\n        \"removed\": {\n          \"description\": \"How many records were removed, tombstones included. A prune that removed nothing leaves no mark.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"version\": {\n          \"description\": \"The version the prune took from the room's counter, as a put or a curation would. No record carries it; it is what moves `HeadVersion` past the removal, so that a root taken before and a root taken after are never labelled with one version.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        }\n      },\n      \"required\": [\n        \"version\",\n        \"at\",\n        \"removed\"\n      ],\n      \"title\": \"RecordPrune\",\n      \"type\": \"object\"\n    },\n    \"RecordRetention\": {\n      \"additionalProperties\": false,\n      \"description\": \"How long a room keeps its records, by age: the room's **record retention**. Records older than it states become **eligible** to be removed by `rooms/records/prune`; nothing is removed until a holder of `admin` asks for a prune, and nothing a prune removes can be brought back.\\n\\n**Not `retentionPolicy`, and not `retentionDays`.** Both names are taken in this family and mean other things. `retentionPolicy` (`RetentionPolicy`) is whether a room's *key chain* lets a member read epochs from before they joined, fixed at creation because key material either exists for an epoch or it does not. `retentionDays` (`rooms/create`) is how long a host keeps a whole room after it lapses unrenewed. This is a third question — how long the room keeps its *records* while it is live — and unlike the first it is a decision a room revisits, so it is changeable (`rooms/records/retention/set`). A name sharing either's would invite a reader to apply one's rules to the other.\\n\\n**Age is the host's to measure, so age is `updatedAt`.** On the sealed tiers a host can read nothing of a record but its key, version, status, pinning and when it last changed, so a policy the host applies can only be stated in those terms. That is also why it cannot use a record's own `validUntil`, which is sealed: expiry is a reader's rule, retention a host's. A curation is a change, so it restarts a record's age — a retraction starts a tombstone's.\\n\\n**Absent, or `{}`, means no record is ever eligible by age**, and that is the reading a host MUST apply whenever it cannot read a policy: removing data under a rule nobody stated is the failure this member exists to prevent. Every member can read the policy in force (`rooms/info`), so a record is never removed under a rule its readers could not have known.\",\n      \"properties\": {\n        \"ext\": {\n          \"$ref\": \"#/$defs/Ext\",\n          \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1. A host MUST NOT treat a member here as making more records eligible: a removal rule a member's reader cannot understand is one they were never told about.\"\n        },\n        \"recordDays\": {\n          \"description\": \"Days a record is kept after it last changed, whatever its standing. A record — `active`, `deprecated` or `retracted` — whose `updatedAt` is more than this long ago is eligible, **unless it is pinned**: pinning says what matters in the room, and a room that wants a pinned record gone unpins it first. Absent means records are never eligible by age.\",\n          \"maximum\": 36500,\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"tombstoneDays\": {\n          \"description\": \"Days a retracted record's tombstone is kept after its retraction. A tombstone whose `updatedAt` is more than this long ago is eligible. Tombstones exist so that a member syncing incrementally learns of a retraction (`rooms/records/curate`); this is how long a member may stay away and still learn of one that way rather than by rebuilding their copy of the room. Absent means tombstones are never eligible.\",\n          \"maximum\": 36500,\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        }\n      },\n      \"title\": \"RecordRetention\",\n      \"type\": \"object\"\n    },\n    \"Response\": {\n      \"$anchor\": \"response\",\n      \"additionalProperties\": false,\n      \"description\": \"Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.2#response.\",\n      \"properties\": {\n        \"epoch\": {\n          \"description\": \"The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"ext\": {\n          \"$ref\": \"#/$defs/Ext\"\n        },\n        \"lastPrune\": {\n          \"$ref\": \"#/$defs/RecordPrune\",\n          \"description\": \"The room's latest record prune: when, how many, and the version it took. Absent when the room's records have never been pruned. A reader whose copy of the room was synchronised below `lastPrune.version` rebuilds it (`RecordPrune`).\"\n        },\n        \"limits\": {\n          \"$ref\": \"#/$defs/RoomLimits\",\n          \"description\": \"The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.\"\n        },\n        \"recordRetention\": {\n          \"$ref\": \"#/$defs/RecordRetention\",\n          \"description\": \"The room's record retention in force: which records `rooms/records/prune` may remove, by age. Absent means none — no record is eligible by age. Served to every member who may read the room, because a record is never to be removed under a rule its readers could not have read.\"\n        },\n        \"retentionPolicy\": {\n          \"$ref\": \"#/$defs/RetentionPolicy\",\n          \"description\": \"Absent means `chained`, as everywhere in this family.\"\n        },\n        \"roomId\": {\n          \"description\": \"The room this describes, echoed so a response cannot be mistaken for another room's.\",\n          \"type\": \"string\"\n        },\n        \"usage\": {\n          \"additionalProperties\": false,\n          \"properties\": {\n            \"member\": {\n              \"additionalProperties\": false,\n              \"description\": \"The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.\",\n              \"properties\": {\n                \"limits\": {\n                  \"$ref\": \"#/$defs/ScopeLimits\",\n                  \"description\": \"The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.\"\n                },\n                \"usage\": {\n                  \"$ref\": \"#/$defs/Usage\"\n                }\n              },\n              \"required\": [\n                \"usage\",\n                \"limits\"\n              ],\n              \"type\": \"object\"\n            },\n            \"room\": {\n              \"$ref\": \"#/$defs/Usage\",\n              \"description\": \"The room as a whole.\"\n            }\n          },\n          \"required\": [\n            \"room\"\n          ],\n          \"type\": \"object\"\n        },\n        \"visibility\": {\n          \"$ref\": \"#/$defs/Visibility\"\n        }\n      },\n      \"required\": [\n        \"roomId\",\n        \"visibility\",\n        \"epoch\",\n        \"limits\",\n        \"usage\"\n      ],\n      \"title\": \"Rooms Info — response payload\",\n      \"type\": \"object\"\n    },\n    \"RetentionPolicy\": {\n      \"$comment\": \"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\n      \"description\": \"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\n      \"enum\": [\n        \"chained\",\n        \"fromJoin\"\n      ],\n      \"title\": \"RetentionPolicy\",\n      \"type\": \"string\"\n    },\n    \"RoomLimits\": {\n      \"additionalProperties\": false,\n      \"description\": \"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\n      \"properties\": {\n        \"filesEnabled\": {\n          \"description\": \"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\n          \"type\": \"boolean\"\n        },\n        \"member\": {\n          \"$ref\": \"#/$defs/ScopeLimits\",\n          \"description\": \"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"\n        },\n        \"room\": {\n          \"$ref\": \"#/$defs/ScopeLimits\",\n          \"description\": \"Limits on the room as a whole.\"\n        }\n      },\n      \"required\": [\n        \"filesEnabled\"\n      ],\n      \"title\": \"RoomLimits\",\n      \"type\": \"object\"\n    },\n    \"ScopeLimits\": {\n      \"additionalProperties\": false,\n      \"description\": \"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\n      \"properties\": {\n        \"maxBytes\": {\n          \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"maxFileBytes\": {\n          \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n          \"maximum\": 1073741824,\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"maxFiles\": {\n          \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        }\n      },\n      \"title\": \"ScopeLimits\",\n      \"type\": \"object\"\n    },\n    \"Usage\": {\n      \"additionalProperties\": false,\n      \"description\": \"What one scope holds now. Ciphertext bytes throughout.\",\n      \"properties\": {\n        \"bytes\": {\n          \"description\": \"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"files\": {\n          \"description\": \"Committed blobs that are not orphaned.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"reservedBytes\": {\n          \"description\": \"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"reservedFiles\": {\n          \"description\": \"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        }\n      },\n      \"required\": [\n        \"files\",\n        \"bytes\",\n        \"reservedBytes\"\n      ],\n      \"title\": \"Usage\",\n      \"type\": \"object\"\n    },\n    \"Visibility\": {\n      \"description\": \"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\n      \"enum\": [\n        \"open\",\n        \"attributed\",\n        \"private\"\n      ],\n      \"title\": \"Visibility\",\n      \"type\": \"string\"\n    }\n  },\n  \"$id\": \"https://trusttasks.org/spec/rooms/info/0.2\",\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n  \"additionalProperties\": false,\n  \"description\": \"A member asks a room's host what it holds about the room: its tier, its current epoch, how long it keeps its records and when it last pruned them, the limits the host applies to its files, and how much of them the room and the member have used.\",\n  \"properties\": {\n    \"ext\": {\n      \"$ref\": \"#/$defs/Ext\",\n      \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1.\"\n    },\n    \"presentation\": {\n      \"$ref\": \"#/$defs/AuthorityPresentation\",\n      \"description\": \"Must confer the `read` action at this room's scope.\"\n    },\n    \"roomId\": {\n      \"description\": \"The room's identifier. The host verifies the presentation against credentials issued by this identifier, never against a member list of its own.\",\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\n    \"roomId\",\n    \"presentation\"\n  ],\n  \"title\": \"Rooms Info — payload\",\n  \"type\": \"object\"\n}\n",
    );
}
impl crate::Payload for Response {
    const TYPE_URI: &'static str = "https://trusttasks.org/spec/rooms/info/0.2#response";
    const IS_PROOF_REQUIRED: bool = true;
    const IS_RECIPIENT_REQUIRED: bool = true;
    const PAYLOAD_SCHEMA: Option<&'static str> = Some(
        "{\n  \"$defs\": {\n    \"AuthorityPresentation\": {\n      \"additionalProperties\": false,\n      \"description\": \"What a party presents to act on a room. Carries the whole authority chain: a host MUST NOT dereference an authority credential's `parent` to fetch a link it was not given. Resolving over the network would make verification depend on availability, turn every identifier into a request the host can be induced to make against an address the holder chooses, and signal credential use to whoever hosts the identifier. A host MUST bind the presenter to the chain's leaf. A chain that verifies is evidence that authority was conferred on somebody; it is not evidence that the party presenting it is that somebody. The leaf's subject MUST equal the party the host authenticated for this request — an identity the transport established or a document `proof` proved, never one named in a payload. A host that omits this check authorizes every captured presentation, and the omission is silent, because the chain still verifies.\\n\\n**Every credential is its issuer's attestation, and only its issuer's.** For the membership credential and for every link of `authority`, a host MUST verify the credential's `proof` with a key that the credential's own `issuer` lists for `assertionMethod` in its DID document, and MUST refuse a credential whose proof names a verification method that is not its issuer's. A proof that verifies under some other party's key is that party's statement, not the issuer's, and confers nothing. The same binding holds for every other document a room signs, such as a `RevocationList`.\\n\\n**A chain that verifies may still be revoked.** A host that has accepted a `RevocationList` for the room (`rooms/revocations/put`) MUST, from the moment it accepted it, refuse every presentation in which the membership credential or any link of `authority` is revoked by that list, under every task and every version of every task it serves for the room. A chain from which any link is revoked is refused whole: a credential delegated from a revoked one confers nothing, however it was attenuated. The refusal is the same `permissionDenied` as any other failed presentation.\",\n      \"properties\": {\n        \"authority\": {\n          \"description\": \"The authority chain, LEAF FIRST: the first element is the credential being relied on and the last MUST be one issued by the room itself. Every link the presenter relies on is present, because the host will not fetch one. Capped at 8: verification is linear in chain length and runs on every operation, so an unbounded chain is a denial-of-service surface against the host. The known uses need 2 to 3 — a person attenuating to an agent, and that agent to a sub-agent.\",\n          \"items\": {\n            \"type\": \"string\"\n          },\n          \"maxItems\": 8,\n          \"minItems\": 1,\n          \"type\": \"array\"\n        },\n        \"membership\": {\n          \"description\": \"The presenter's membership credential for this room, or — on a `private` room — a zero-knowledge presentation of it. Serialized per the governing profile.\",\n          \"type\": \"string\"\n        },\n        \"subjectBinding\": {\n          \"description\": \"REQUIRED on a `private` room, where the subject identifier is withheld: a proof that the membership credential and the authority chain's leaf describe the SAME subject. Without it two parties pool credentials — one contributes membership, the other authority — and the combination verifies as a single party holding both. A host MUST refuse a private-room presentation that omits this.\",\n          \"type\": \"string\"\n        }\n      },\n      \"required\": [\n        \"membership\",\n        \"authority\"\n      ],\n      \"title\": \"AuthorityPresentation\",\n      \"type\": \"object\"\n    },\n    \"Ext\": {\n      \"additionalProperties\": true,\n      \"description\": \"Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.\",\n      \"minProperties\": 1,\n      \"propertyNames\": {\n        \"pattern\": \"^[a-z][a-z0-9-]*(\\\\.[a-z0-9-]+)+$\"\n      },\n      \"title\": \"Ext\",\n      \"type\": \"object\"\n    },\n    \"RecordPrune\": {\n      \"additionalProperties\": false,\n      \"description\": \"The mark a prune leaves: **that** records were removed, when, and how many — never which, and never anything they said.\\n\\nA prune removes records outright, tombstones included, so the room's record tree loses leaves and an incremental reader has nothing left to learn the removal from. This is what it learns from instead. A host keeps the latest one per room and serves it with every listing that can carry it (`rooms/records/list` 0.3, as `lastPrune`); a reader whose own copy of the room was synchronised to a version below `version` MUST rebuild that copy from a full listing — no `sinceVersion` — and drop every record the full listing no longer holds. Without that, a record the room removed lives on in every cache that synchronised before the prune, and a record retracted while the reader was away comes back as current.\\n\\n**What a host keeps and what it does not.** A host keeps this marker, and in its audit trail the prune's `reason`, its requester where the tier discloses one, and the retention it was made under. It MUST NOT keep anything a pruned record said — body, ciphertext, cleartext, title, description, file or blob — and SHOULD NOT keep pruned records' keys: the count is the audit, and a list of keys on an `open` room, where keys may be descriptive, is content by another name.\",\n      \"properties\": {\n        \"at\": {\n          \"description\": \"When the host performed it.\",\n          \"format\": \"date-time\",\n          \"type\": \"string\"\n        },\n        \"removed\": {\n          \"description\": \"How many records were removed, tombstones included. A prune that removed nothing leaves no mark.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"version\": {\n          \"description\": \"The version the prune took from the room's counter, as a put or a curation would. No record carries it; it is what moves `HeadVersion` past the removal, so that a root taken before and a root taken after are never labelled with one version.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        }\n      },\n      \"required\": [\n        \"version\",\n        \"at\",\n        \"removed\"\n      ],\n      \"title\": \"RecordPrune\",\n      \"type\": \"object\"\n    },\n    \"RecordRetention\": {\n      \"additionalProperties\": false,\n      \"description\": \"How long a room keeps its records, by age: the room's **record retention**. Records older than it states become **eligible** to be removed by `rooms/records/prune`; nothing is removed until a holder of `admin` asks for a prune, and nothing a prune removes can be brought back.\\n\\n**Not `retentionPolicy`, and not `retentionDays`.** Both names are taken in this family and mean other things. `retentionPolicy` (`RetentionPolicy`) is whether a room's *key chain* lets a member read epochs from before they joined, fixed at creation because key material either exists for an epoch or it does not. `retentionDays` (`rooms/create`) is how long a host keeps a whole room after it lapses unrenewed. This is a third question — how long the room keeps its *records* while it is live — and unlike the first it is a decision a room revisits, so it is changeable (`rooms/records/retention/set`). A name sharing either's would invite a reader to apply one's rules to the other.\\n\\n**Age is the host's to measure, so age is `updatedAt`.** On the sealed tiers a host can read nothing of a record but its key, version, status, pinning and when it last changed, so a policy the host applies can only be stated in those terms. That is also why it cannot use a record's own `validUntil`, which is sealed: expiry is a reader's rule, retention a host's. A curation is a change, so it restarts a record's age — a retraction starts a tombstone's.\\n\\n**Absent, or `{}`, means no record is ever eligible by age**, and that is the reading a host MUST apply whenever it cannot read a policy: removing data under a rule nobody stated is the failure this member exists to prevent. Every member can read the policy in force (`rooms/info`), so a record is never removed under a rule its readers could not have known.\",\n      \"properties\": {\n        \"ext\": {\n          \"$ref\": \"#/$defs/Ext\",\n          \"description\": \"Ecosystem-defined extension members per SPEC.md §4.5.1. A host MUST NOT treat a member here as making more records eligible: a removal rule a member's reader cannot understand is one they were never told about.\"\n        },\n        \"recordDays\": {\n          \"description\": \"Days a record is kept after it last changed, whatever its standing. A record — `active`, `deprecated` or `retracted` — whose `updatedAt` is more than this long ago is eligible, **unless it is pinned**: pinning says what matters in the room, and a room that wants a pinned record gone unpins it first. Absent means records are never eligible by age.\",\n          \"maximum\": 36500,\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"tombstoneDays\": {\n          \"description\": \"Days a retracted record's tombstone is kept after its retraction. A tombstone whose `updatedAt` is more than this long ago is eligible. Tombstones exist so that a member syncing incrementally learns of a retraction (`rooms/records/curate`); this is how long a member may stay away and still learn of one that way rather than by rebuilding their copy of the room. Absent means tombstones are never eligible.\",\n          \"maximum\": 36500,\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        }\n      },\n      \"title\": \"RecordRetention\",\n      \"type\": \"object\"\n    },\n    \"Response\": {\n      \"$anchor\": \"response\",\n      \"additionalProperties\": false,\n      \"description\": \"Success response to rooms/info. Type https://trusttasks.org/spec/rooms/info/0.2#response.\",\n      \"properties\": {\n        \"epoch\": {\n          \"description\": \"The room's current epoch as the host knows it: the one a record or file must be sealed under to be accepted now.\",\n          \"minimum\": 1,\n          \"type\": \"integer\"\n        },\n        \"ext\": {\n          \"$ref\": \"#/$defs/Ext\"\n        },\n        \"lastPrune\": {\n          \"$ref\": \"#/$defs/RecordPrune\",\n          \"description\": \"The room's latest record prune: when, how many, and the version it took. Absent when the room's records have never been pruned. A reader whose copy of the room was synchronised below `lastPrune.version` rebuilds it (`RecordPrune`).\"\n        },\n        \"limits\": {\n          \"$ref\": \"#/$defs/RoomLimits\",\n          \"description\": \"The limits the host applies to this room, after any override for the room and capped by the host-wide ceiling. `member` here is the room's default per-member allowance; the presenter's own, which may differ, is under `usage.member.limits`.\"\n        },\n        \"recordRetention\": {\n          \"$ref\": \"#/$defs/RecordRetention\",\n          \"description\": \"The room's record retention in force: which records `rooms/records/prune` may remove, by age. Absent means none — no record is eligible by age. Served to every member who may read the room, because a record is never to be removed under a rule its readers could not have read.\"\n        },\n        \"retentionPolicy\": {\n          \"$ref\": \"#/$defs/RetentionPolicy\",\n          \"description\": \"Absent means `chained`, as everywhere in this family.\"\n        },\n        \"roomId\": {\n          \"description\": \"The room this describes, echoed so a response cannot be mistaken for another room's.\",\n          \"type\": \"string\"\n        },\n        \"usage\": {\n          \"additionalProperties\": false,\n          \"properties\": {\n            \"member\": {\n              \"additionalProperties\": false,\n              \"description\": \"The presenter's own use and allowance: charged to the subject at the root of the presented chain, so an agent sees its member's figures. Absent on a `private` room, where the host does not know which member is asking.\",\n              \"properties\": {\n                \"limits\": {\n                  \"$ref\": \"#/$defs/ScopeLimits\",\n                  \"description\": \"The limits that apply to this member in this room: an override set for them by the host's administrators if there is one, else the room's per-member default.\"\n                },\n                \"usage\": {\n                  \"$ref\": \"#/$defs/Usage\"\n                }\n              },\n              \"required\": [\n                \"usage\",\n                \"limits\"\n              ],\n              \"type\": \"object\"\n            },\n            \"room\": {\n              \"$ref\": \"#/$defs/Usage\",\n              \"description\": \"The room as a whole.\"\n            }\n          },\n          \"required\": [\n            \"room\"\n          ],\n          \"type\": \"object\"\n        },\n        \"visibility\": {\n          \"$ref\": \"#/$defs/Visibility\"\n        }\n      },\n      \"required\": [\n        \"roomId\",\n        \"visibility\",\n        \"epoch\",\n        \"limits\",\n        \"usage\"\n      ],\n      \"title\": \"Rooms Info — response payload\",\n      \"type\": \"object\"\n    },\n    \"RetentionPolicy\": {\n      \"$comment\": \"Deliberately no JSON Schema `default`. A declared default is materialised by the generated bindings — the member becomes non-optional with a serde default — so an absent value would reappear as an explicit one on re-serialisation and break round-trip idempotence for every document written before this member existed. The meaning of absence is stated in prose, where a binding cannot act on it.\",\n      \"description\": \"Whether a room keeps its history readable across a membership change, fixed at creation and immutable thereafter — like `Visibility`, and for the same reason: the rungs of an epoch key chain either exist for an epoch or they do not, and no later change of mind can seal key material that was never sealed or unseal what was already severed. `chained`: each advance produces an `EpochLink`, so every member reads the room's whole retained history however long they have been in it — what a **library** wants, at the cost of post-compromise security for record content, since a compromised current key then reaches every retained epoch. `fromJoin`: no rungs are produced, so a member reads only from the epoch their group state is at — what a **stream** wants, and what a room under a strict forward-secrecy obligation wants, at the cost that a joining member finds an empty-looking room and nobody can reread a record once their group state has moved past the epoch it was sealed under. Absent means `chained`; see the prose on why the absent case is the readable one.\",\n      \"enum\": [\n        \"chained\",\n        \"fromJoin\"\n      ],\n      \"title\": \"RetentionPolicy\",\n      \"type\": \"string\"\n    },\n    \"RoomLimits\": {\n      \"additionalProperties\": false,\n      \"description\": \"How much a host is willing to store for one room, at the room and per member. A hosting decision, set by the host and never by anything in the room's credentials. An upload must fit every scope at once: the object against the smallest `maxFileBytes` that applies, and the member and the room with the file added.\",\n      \"properties\": {\n        \"filesEnabled\": {\n          \"description\": \"False refuses every rooms/blobs/* upload for the room. Reads of blobs already stored continue.\",\n          \"type\": \"boolean\"\n        },\n        \"member\": {\n          \"$ref\": \"#/$defs/ScopeLimits\",\n          \"description\": \"Limits on each member's own uploads in this room, unless that member has an override. A member is the subject at the root of the authority chain they present, never the key that signed, so an agent acting on an attenuated chain spends its member's allowance. Not applied on a `private` room, where the host cannot tell members apart; the room and object limits still hold there.\"\n        },\n        \"room\": {\n          \"$ref\": \"#/$defs/ScopeLimits\",\n          \"description\": \"Limits on the room as a whole.\"\n        }\n      },\n      \"required\": [\n        \"filesEnabled\"\n      ],\n      \"title\": \"RoomLimits\",\n      \"type\": \"object\"\n    },\n    \"ScopeLimits\": {\n      \"additionalProperties\": false,\n      \"description\": \"Limits at one scope. Every member is optional: an absent member means the scope sets no limit of that kind, and the next wider scope's limit, or the host's ceiling, governs. All sizes are ciphertext bytes.\",\n      \"properties\": {\n        \"maxBytes\": {\n          \"description\": \"The total size of the committed and reserved blobs the scope may hold.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"maxFileBytes\": {\n          \"description\": \"The largest single blob the scope accepts. Never above 1 GiB, the transfer ceiling (BlobManifest).\",\n          \"maximum\": 1073741824,\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"maxFiles\": {\n          \"description\": \"The number of committed blobs the scope may hold. 0 refuses every upload at this scope.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        }\n      },\n      \"title\": \"ScopeLimits\",\n      \"type\": \"object\"\n    },\n    \"Usage\": {\n      \"additionalProperties\": false,\n      \"description\": \"What one scope holds now. Ciphertext bytes throughout.\",\n      \"properties\": {\n        \"bytes\": {\n          \"description\": \"Their total size. A blob stops counting the moment it is orphaned (its last record dropped it or was retracted), not when the host finally deletes it, so a member who deletes a file has the room back at once.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"files\": {\n          \"description\": \"Committed blobs that are not orphaned.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"reservedBytes\": {\n          \"description\": \"Bytes reserved by uploads begun and not yet committed, aborted or expired. Counted against `maxBytes`, so two concurrent uploads cannot both fit under a limit only one of them fits.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        },\n        \"reservedFiles\": {\n          \"description\": \"Uploads begun and not yet committed, aborted or expired. Counted against `maxFiles`.\",\n          \"minimum\": 0,\n          \"type\": \"integer\"\n        }\n      },\n      \"required\": [\n        \"files\",\n        \"bytes\",\n        \"reservedBytes\"\n      ],\n      \"title\": \"Usage\",\n      \"type\": \"object\"\n    },\n    \"Visibility\": {\n      \"description\": \"How much of a room its host can see, fixed at creation and immutable thereafter. `open`: records are cleartext, searchable and fully audited. `attributed`: record content is sealed, and the host still learns which member acted. `private`: content is sealed and membership is presented in zero knowledge, so the host verifies that a member acted without learning which. Immutable because a downgrade cannot un-see cleartext and an upgrade would protect only what came after while presenting as though it protected everything.\",\n      \"enum\": [\n        \"open\",\n        \"attributed\",\n        \"private\"\n      ],\n      \"title\": \"Visibility\",\n      \"type\": \"string\"\n    }\n  },\n  \"$ref\": \"#/$defs/Response\",\n  \"$schema\": \"https://json-schema.org/draft/2020-12/schema\"\n}\n",
    );
}
impl crate::RequestPayload for Payload {
    type Response = Response;
}
/// The extended error codes this specification declares (SPEC §7.3 item 9,
/// §8.5), in declaration order. Empty when it declares none.
pub const ERROR_CODES: &[crate::DeclaredErrorCode] = &[
    error_codes::CHAIN_TOO_DEEP,
    error_codes::SUBJECT_BINDING_MISSING,
];
/// One constant per extended error code this specification declares
/// (SPEC §7.3 item 9), named for its local part.
///
/// Emit these rather than a string literal: the code is read from the
/// specification, so it cannot name a code the specification never
/// declared.
pub mod error_codes {
    /// `rooms/info:chainTooDeep`
    ///
    /// The authority chain exceeds the maximum of 8 links.
    ///
    /// Declared `retryable: false`.
    pub const CHAIN_TOO_DEEP: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
        code: "rooms/info:chainTooDeep",
        retryable: false,
        details_schema: ::core::option::Option::None,
    };
    /// `rooms/info:subjectBindingMissing`
    ///
    /// A `private` room presentation omitted the required same-subject proof.
    ///
    /// Declared `retryable: false`.
    pub const SUBJECT_BINDING_MISSING: crate::DeclaredErrorCode = crate::DeclaredErrorCode {
        code: "rooms/info:subjectBindingMissing",
        retryable: false,
        details_schema: ::core::option::Option::None,
    };
}