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
//! Calendar object, CalendarRights, and IncludeInAvailability.
//!
//! Normative reference: draft-ietf-jmap-calendars-26 §4.
use HashMap;
use Id;
use ;
/// Controls which events in a Calendar contribute to availability calculations
/// (draft-ietf-jmap-calendars-26 §4).
///
/// The spec defines exactly three values with no extension mechanism; modelled
/// as a closed enum (no `Other` variant). Wire values are lowercase.
/// Access control rights the authenticated user holds for a Calendar
/// (draft-ietf-jmap-calendars-26 §4, after the `myRights` field definition).
///
/// `Default` produces all-false (no access), which is the most restrictive
/// valid value and a safe starting point when constructing rights in tests
/// or server code.
///
/// ## Invariant (spec §4)
///
/// If `may_write_all` is `true`, then `may_write_own`, `may_update_private`,
/// and `may_rsvp` MUST also be `true`. This invariant is enforced by the
/// handler/backend layer, not this type.
/// A JMAP Calendar object (draft-ietf-jmap-calendars-26 §4).
///
/// A Calendar is a named collection of CalendarEvents. All events are
/// associated with at least one calendar. The `id` is immutable and
/// server-set.
///
/// ## Nullable vs. absent fields
///
/// Per RFC 8620 §5.1, a field may be absent from a response when the
/// `properties` argument was used to request a subset. Fields that the
/// spec defines as nullable (e.g. `description`, `color`, `share_with`)
/// use `Option<T>` **without** `skip_serializing_if` so that `null` round-
/// trips correctly. Fields that are simply optional in the request context
/// use `Option<T>` **with** `skip_serializing_if = "Option::is_none"`.
/// Serde default for `Calendar::is_visible` ("default: true").
/// Filter condition for `Calendar/query` (draft-ietf-jmap-calendars-26 §4.3).
///
/// All fields are optional; a condition with no fields set matches every Calendar.
///
/// # Excluded from extras preservation
///
/// This type is **out of scope** for the workspace extras-preservation
/// policy: it carries no flatten-extras `extra` field. Filter clauses the
/// server does not understand are a query-correctness hazard — silently
/// preserving an unrecognised clause and round-tripping it back to the
/// client can return the wrong set of records with no error signal.
///
/// ## What to do instead
///
/// **IETF-track path.** Vendors who need both capability-level declaration
/// and filterability for custom fields should use
/// `draft-ietf-jmap-metadata` (capability URI
/// `urn:ietf:params:jmap:metadata`), which defines a filterable
/// `Metadata` / `Annotation` companion object. Implemented in `jmap-metadata-types`,
/// `jmap-metadata-server`, and `jmap-metadata-client` (bd JMAP-06zp).
///
/// **Pre-IETF escape.** Vendors who cannot wait for the metadata draft can
/// either escape the filter tree to `serde_json::Value` or fork the
/// `FilterCondition` type. See `crate-jmap-calendars-types/PLAN.md` for
/// the hybrid sloppy-value pattern.
///
/// Cross-reference: bd JMAP-lbdy "Decision: filter algebra excluded".
/// Concrete filter type for Calendar/query (draft-ietf-jmap-calendars-26 §4.5).
///
/// Alias for `jmap_types::query::Filter<CalendarFilterCondition>` provided so
/// callers do not have to reach into `jmap-types` directly. Mirrors the
/// canonical [`jmap_mail_types::EmailFilter`] shape from the workspace
/// canonical extension-types template.
///
/// [`jmap_mail_types::EmailFilter`]: https://docs.rs/jmap-mail-types/latest/jmap_mail_types/query/type.EmailFilter.html
pub type CalendarFilter = Filter;