aboutsummaryrefslogtreecommitdiff
path: root/src/dav/caltypes.rs
blob: db9484af8c4c311128aa76103aea5d6c1822d518 (plain) (blame)
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
use chrono::{DateTime,Utc};

use super::types as Dav;

//@FIXME for now, we skip the ACL part

pub struct CalExtension {
    pub root: bool
}
impl Dav::Extension for CalExtension {
    type Error = Violation;
    type Property = Property;
    type PropertyRequest = Property; //@FIXME
    type ResourceType = ResourceType;
}

// ----- Root elements -----

/// If a request body is included, it MUST be a CALDAV:mkcalendar XML
/// element.  Instruction processing MUST occur in the order
/// instructions are received (i.e., from top to bottom).
/// Instructions MUST either all be executed or none executed.  Thus,
/// if any error occurs during processing, all executed instructions
/// MUST be undone and a proper error result returned.  Instruction
/// processing details can be found in the definition of the DAV:set
/// instruction in Section 12.13.2 of [RFC2518].
///
/// <!ELEMENT mkcalendar (DAV:set)>
pub struct MkCalendar<E: Dav::Extension>(Dav::Set<E>);


/// If a response body for a successful request is included, it MUST
/// be a CALDAV:mkcalendar-response XML element.
///
/// <!ELEMENT mkcalendar-response ANY>
pub struct MkCalendarResponse(());

/// Name:  calendar-query
///
/// Namespace:  urn:ietf:params:xml:ns:caldav
///
/// Purpose:  Defines a report for querying calendar object resources.
/// 
/// Description:  See Section 7.8.
/// 
/// Definition:
///
/// <!ELEMENT calendar-query ((DAV:allprop |
///                            DAV:propname |
///                            DAV:prop)?, filter, timezone?)>
pub struct CalendarQuery<T: Dav::Extension> {
    selector: Option<CalendarSelector<T>>,
    filter: Filter,
    timezone: Option<TimeZone>,
}

// ----- Hooks -----
pub enum ResourceType {
    Calendar,
}

pub enum PropertyRequest {
    CalendarDescription,
    CalendarTimezone,
}
pub enum Property {
    /// Name:  calendar-description
    /// 
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a human-readable description of the calendar
    /// collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MAY be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).  An xml:lang attribute indicating the human
    /// language of the description SHOULD be set for this property by
    /// clients or through server provisioning.  Servers MUST return any
    /// xml:lang attribute if set for the property.
    ///
    /// Description:  If present, the property contains a description of the
    /// calendar collection that is suitable for presentation to a user.
    /// If not present, the client should assume no description for the
    /// calendar collection.
    ///
    /// Definition:
    ///
    /// <!ELEMENT calendar-description (#PCDATA)>
    /// PCDATA value: string
    ///
    /// Example:
    ///
    /// <C:calendar-description xml:lang="fr-CA"
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav"
    /// >Calendrier de Mathilde Desruisseaux</C:calendar-description>
    CalendarDescription(String),

    /// 5.2.2.  CALDAV:calendar-timezone Property
    ///
    /// Name:  calendar-timezone
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Specifies a time zone on a calendar collection.
    ///
    /// Conformance:  This property SHOULD be defined on all calendar
    /// collections.  If defined, it SHOULD NOT be returned by a PROPFIND
    /// DAV:allprop request (as defined in Section 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:calendar-timezone property is used to
    /// specify the time zone the server should rely on to resolve "date"
    /// values and "date with local time" values (i.e., floating time) to
    /// "date with UTC time" values.  The server will require this
    /// information to determine if a calendar component scheduled with
    /// "date" values or "date with local time" values overlaps a CALDAV:
    /// time-range specified in a CALDAV:calendar-query REPORT.  The
    /// server will also require this information to compute the proper
    /// FREEBUSY time period as "date with UTC time" in the VFREEBUSY
    /// component returned in a response to a CALDAV:free-busy-query
    /// REPORT request that takes into account calendar components
    /// scheduled with "date" values or "date with local time" values.  In
    /// the absence of this property, the server MAY rely on the time zone
    /// of their choice.
    ///
    /// Note:  The iCalendar data embedded within the CALDAV:calendar-
    /// timezone XML element MUST follow the standard XML character data
    /// encoding rules, including use of &lt;, &gt;, &amp; etc. entity
    /// encoding or the use of a <![CDATA[ ... ]]> construct.  In the
    /// later case, the iCalendar data cannot contain the character
    /// sequence "]]>", which is the end delimiter for the CDATA section.
    ///
    ///    Definition:
    ///
    /// <!ELEMENT calendar-timezone (#PCDATA)>
    ///     PCDATA value: an iCalendar object with exactly one VTIMEZONE component.
    ///
    /// Example:
    ///
    /// <C:calendar-timezone
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav">BEGIN:VCALENDAR
    /// PRODID:-//Example Corp.//CalDAV Client//EN
    /// VERSION:2.0
    /// BEGIN:VTIMEZONE
    /// TZID:US-Eastern
    /// LAST-MODIFIED:19870101T000000Z
    /// BEGIN:STANDARD
    /// DTSTART:19671029T020000
    /// RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
    /// TZOFFSETFROM:-0400
    /// TZOFFSETTO:-0500
    /// TZNAME:Eastern Standard Time (US &amp; Canada)
    /// END:STANDARD
    /// BEGIN:DAYLIGHT
    /// DTSTART:19870405T020000
    /// RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
    /// TZOFFSETFROM:-0500
    /// TZOFFSETTO:-0400
    /// TZNAME:Eastern Daylight Time (US &amp; Canada)
    /// END:DAYLIGHT
    /// END:VTIMEZONE
    /// END:VCALENDAR
    /// </C:calendar-timezone>
    //@FIXME we might want to put a buffer here or an iCal parsed object
    CalendarTimezone(String),

    /// Name:  supported-calendar-component-set
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Specifies the calendar component types (e.g., VEVENT,
    /// VTODO, etc.) that calendar object resources can contain in the
    /// calendar collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:supported-calendar-component-set property is
    /// used to specify restrictions on the calendar component types that
    /// calendar object resources may contain in a calendar collection.
    /// Any attempt by the client to store calendar object resources with
    /// component types not listed in this property, if it exists, MUST
    /// result in an error, with the CALDAV:supported-calendar-component
    /// precondition (Section 5.3.2.1) being violated.  Since this
    /// property is protected, it cannot be changed by clients using a
    /// PROPPATCH request.  However, clients can initialize the value of
    /// this property when creating a new calendar collection with
    /// MKCALENDAR.  The empty-element tag <C:comp name="VTIMEZONE"/> MUST
    /// only be specified if support for calendar object resources that
    /// only contain VTIMEZONE components is provided or desired.  Support
    /// for VTIMEZONE components in calendar object resources that contain
    /// VEVENT or VTODO components is always assumed.  In the absence of
    /// this property, the server MUST accept all component types, and the
    /// client can assume that all component types are accepted.
    ///
    /// Definition:
    ///
    /// <!ELEMENT supported-calendar-component-set (comp+)>
    ///
    /// Example:
    ///
    /// <C:supported-calendar-component-set
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav">
    ///     <C:comp name="VEVENT"/>
    ///     <C:comp name="VTODO"/>
    /// </C:supported-calendar-component-set>
    SupportedCalendarComponentSet(Vec<Component>),

    ///  Name:  supported-calendar-data
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Specifies what media types are allowed for calendar object
    /// resources in a calendar collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:supported-calendar-data property is used to
    /// specify the media type supported for the calendar object resources
    /// contained in a given calendar collection (e.g., iCalendar version
    /// 2.0).  Any attempt by the client to store calendar object
    /// resources with a media type not listed in this property MUST
    /// result in an error, with the CALDAV:supported-calendar-data
    /// precondition (Section 5.3.2.1) being violated.  In the absence of
    /// this property, the server MUST only accept data with the media
    /// type "text/calendar" and iCalendar version 2.0, and clients can
    /// assume that the server will only accept this data.
    ///
    /// Definition:
    ///
    /// <!ELEMENT supported-calendar-data (calendar-data+)>
    ///
    /// Example:
    ///
    /// <C:supported-calendar-data
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav">
    ///     <C:calendar-data content-type="text/calendar" version="2.0"/>
    /// </C:supported-calendar-data>
    ///
    /// -----
    ///
    /// <!ELEMENT calendar-data EMPTY>
    ///
    /// when nested in the CALDAV:supported-calendar-data property
    /// to specify a supported media type for calendar object
    /// resources;
    SupportedCalendarData(Vec<CalendarDataSupport>),

    ///  Name:  max-resource-size
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a numeric value indicating the maximum size of a
    /// resource in octets that the server is willing to accept when a
    /// calendar object resource is stored in a calendar collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:max-resource-size is used to specify a
    /// numeric value that represents the maximum size in octets that the
    /// server is willing to accept when a calendar object resource is
    /// stored in a calendar collection.  Any attempt to store a calendar
    /// object resource exceeding this size MUST result in an error, with
    /// the CALDAV:max-resource-size precondition (Section 5.3.2.1) being
    /// violated.  In the absence of this property, the client can assume
    /// that the server will allow storing a resource of any reasonable
    /// size.
    ///
    /// Definition:
    ///
    /// <!ELEMENT max-resource-size (#PCDATA)>
    /// PCDATA value: a numeric value (positive integer)
    ///
    ///    Example:
    ///
    /// <C:max-resource-size xmlns:C="urn:ietf:params:xml:ns:caldav">
    /// 102400
    /// </C:max-resource-size>
    MaxResourceSize(u64),

    /// CALDAV:min-date-time Property
    ///
    /// Name:  min-date-time
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a DATE-TIME value indicating the earliest date and
    /// time (in UTC) that the server is willing to accept for any DATE or
    /// DATE-TIME value in a calendar object resource stored in a calendar
    /// collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:min-date-time is used to specify an
    /// iCalendar DATE-TIME value in UTC that indicates the earliest
    /// inclusive date that the server is willing to accept for any
    /// explicit DATE or DATE-TIME value in a calendar object resource
    /// stored in a calendar collection.  Any attempt to store a calendar
    /// object resource using a DATE or DATE-TIME value earlier than this
    /// value MUST result in an error, with the CALDAV:min-date-time
    /// precondition (Section 5.3.2.1) being violated.  Note that servers
    /// MUST accept recurring components that specify instances beyond
    /// this limit, provided none of those instances have been overridden.
    /// In that case, the server MAY simply ignore those instances outside
    /// of the acceptable range when processing reports on the calendar
    /// object resource.  In the absence of this property, the client can
    /// assume any valid iCalendar date may be used at least up to the
    /// CALDAV:max-date-time value, if that is defined.
    ///
    /// Definition:
    ///
    /// <!ELEMENT min-date-time (#PCDATA)>
    /// PCDATA value: an iCalendar format DATE-TIME value in UTC
    ///
    /// Example:
    ///
    /// <C:min-date-time xmlns:C="urn:ietf:params:xml:ns:caldav">
    /// 19000101T000000Z
    /// </C:min-date-time>
    MinDateTime(DateTime<Utc>),

    /// CALDAV:max-date-time Property
    ///
    /// Name:  max-date-time
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a DATE-TIME value indicating the latest date and
    /// time (in UTC) that the server is willing to accept for any DATE or
    /// DATE-TIME value in a calendar object resource stored in a calendar
    /// collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:max-date-time is used to specify an
    /// iCalendar DATE-TIME value in UTC that indicates the inclusive
    /// latest date that the server is willing to accept for any date or
    /// time value in a calendar object resource stored in a calendar
    /// collection.  Any attempt to store a calendar object resource using
    /// a DATE or DATE-TIME value later than this value MUST result in an
    /// error, with the CALDAV:max-date-time precondition
    /// (Section 5.3.2.1) being violated.  Note that servers MUST accept
    /// recurring components that specify instances beyond this limit,
    /// provided none of those instances have been overridden.  In that
    /// case, the server MAY simply ignore those instances outside of the
    /// acceptable range when processing reports on the calendar object
    /// resource.  In the absence of this property, the client can assume
    /// any valid iCalendar date may be used at least down to the CALDAV:
    /// min-date-time value, if that is defined.
    ///
    /// Definition:
    ///
    /// <!ELEMENT max-date-time (#PCDATA)>
    /// PCDATA value: an iCalendar format DATE-TIME value in UTC
    ///
    /// Example:
    ///
    /// <C:max-date-time xmlns:C="urn:ietf:params:xml:ns:caldav">
    /// 20491231T235959Z
    /// </C:max-date-time>
    MaxDateTime(DateTime<Utc>),

    /// CALDAV:max-instances Property
    ///
    /// Name:  max-instances
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a numeric value indicating the maximum number of
    /// recurrence instances that a calendar object resource stored in a
    /// calendar collection can generate.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:max-instances is used to specify a numeric
    /// value that indicates the maximum number of recurrence instances
    /// that a calendar object resource stored in a calendar collection
    /// can generate.  Any attempt to store a calendar object resource
    /// with a recurrence pattern that generates more instances than this
    /// value MUST result in an error, with the CALDAV:max-instances
    /// precondition (Section 5.3.2.1) being violated.  In the absence of
    /// this property, the client can assume that the server has no limits
    /// on the number of recurrence instances it can handle or expand.
    ///
    /// Definition:
    ///
    /// <!ELEMENT max-instances (#PCDATA)>
    /// PCDATA value: a numeric value (integer greater than zero)
    ///
    /// Example:
    ///
    /// <C:max-instances xmlns:C="urn:ietf:params:xml:ns:caldav">
    /// 100
    /// </C:max-instances>
    MaxInstances(u64),

    ///  CALDAV:max-attendees-per-instance Property
    ///
    /// Name:  max-attendees-per-instance
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Provides a numeric value indicating the maximum number of
    /// ATTENDEE properties in any instance of a calendar object resource
    /// stored in a calendar collection.
    ///
    /// Conformance:  This property MAY be defined on any calendar
    /// collection.  If defined, it MUST be protected and SHOULD NOT be
    /// returned by a PROPFIND DAV:allprop request (as defined in Section
    /// 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:max-attendees-per-instance is used to
    /// specify a numeric value that indicates the maximum number of
    /// iCalendar ATTENDEE properties on any one instance of a calendar
    /// object resource stored in a calendar collection.  Any attempt to
    /// store a calendar object resource with more ATTENDEE properties per
    /// instance than this value MUST result in an error, with the CALDAV:
    /// max-attendees-per-instance precondition (Section 5.3.2.1) being
    /// violated.  In the absence of this property, the client can assume
    /// that the server can handle any number of ATTENDEE properties in a
    /// calendar component.
    ///
    /// Definition:
    ///
    /// <!ELEMENT max-attendees-per-instance (#PCDATA)>
    /// PCDATA value: a numeric value (integer greater than zero)
    ///
    /// Example:
    ///
    /// <C:max-attendees-per-instance
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav">
    /// 25
    /// </C:max-attendees-per-instance>
    MaxAttendeesPerInstance(u64),

    ///  Name:  supported-collation-set
    ///
    /// Namespace:  urn:ietf:params:xml:ns:caldav
    ///
    /// Purpose:  Identifies the set of collations supported by the server
    /// for text matching operations.
    ///
    /// Conformance:  This property MUST be defined on any resource that
    /// supports a report that does text matching.  If defined, it MUST be
    /// protected and SHOULD NOT be returned by a PROPFIND DAV:allprop
    /// request (as defined in Section 12.14.1 of [RFC2518]).
    ///
    /// Description:  The CALDAV:supported-collation-set property contains
    /// zero or more CALDAV:supported-collation elements, which specify
    /// the collection identifiers of the collations supported by the
    /// server.
    ///
    /// Definition:
    ///
    /// <!ELEMENT supported-collation-set (supported-collation*)>
    /// <!ELEMENT supported-collation (#PCDATA)>
    ///
    /// Example:
    ///
    /// <C:supported-collation-set
    ///     xmlns:C="urn:ietf:params:xml:ns:caldav">
    ///   <C:supported-collation>i;ascii-casemap</C:supported-collation>
    ///   <C:supported-collation>i;octet</C:supported-collation>
    /// </C:supported-collation-set>
    SupportedCollationSet(Vec<SupportedCollation>),
}

pub enum Violation {
    /// (DAV:resource-must-be-null): A resource MUST NOT exist at the
    /// Request-URI;
    ResourceMustBeNull,

    /// (CALDAV:calendar-collection-location-ok): The Request-URI MUST
    /// identify a location where a calendar collection can be created;
    CalendarCollectionLocationOk,
    
    /// (CALDAV:valid-calendar-data): The time zone specified in CALDAV:
    /// calendar-timezone property MUST be a valid iCalendar object
    /// containing a single valid VTIMEZONE component.
    ValidCalendarData,

    /// (DAV:needs-privilege): The DAV:bind privilege MUST be granted to
    /// the current user on the parent collection of the Request-URI.
    NeedsPrivilege,

    ///  (CALDAV:initialize-calendar-collection): A new calendar collection
    /// exists at the Request-URI.  The DAV:resourcetype of the calendar
    /// collection MUST contain both DAV:collection and CALDAV:calendar
    /// XML elements.
    InitializeCalendarCollection,

    /// (CALDAV:supported-calendar-data): The resource submitted in the
    /// PUT request, or targeted by a COPY or MOVE request, MUST be a
    /// supported media type (i.e., iCalendar) for calendar object
    /// resources;
    SupportedCalendarData,

    /// (CALDAV:valid-calendar-object-resource): The resource submitted in
    /// the PUT request, or targeted by a COPY or MOVE request, MUST obey
    /// all restrictions specified in Section 4.1 (e.g., calendar object
    /// resources MUST NOT contain more than one type of calendar
    /// component, calendar object resources MUST NOT specify the
    /// iCalendar METHOD property, etc.);
    ValidCalendarObjectResource,

    /// (CALDAV:supported-calendar-component): The resource submitted in
    /// the PUT request, or targeted by a COPY or MOVE request, MUST
    /// contain a type of calendar component that is supported in the
    /// targeted calendar collection;
    SupportedCalendarComponent,

    /// (CALDAV:no-uid-conflict): The resource submitted in the PUT
    /// request, or targeted by a COPY or MOVE request, MUST NOT specify
    /// an iCalendar UID property value already in use in the targeted
    /// calendar collection or overwrite an existing calendar object
    /// resource with one that has a different UID property value.
    /// Servers SHOULD report the URL of the resource that is already
    /// making use of the same UID property value in the DAV:href element;
    ///
    /// <!ELEMENT no-uid-conflict (DAV:href)>
    NoUidConflict(Dav::Href),

    /// (CALDAV:max-resource-size): The resource submitted in the PUT
    /// request, or targeted by a COPY or MOVE request, MUST have an octet
    /// size less than or equal to the value of the CALDAV:max-resource-
    /// size property value (Section 5.2.5) on the calendar collection
    /// where the resource will be stored;
    MaxResourceSize,

    /// (CALDAV:min-date-time): The resource submitted in the PUT request,
    /// or targeted by a COPY or MOVE request, MUST have all of its
    /// iCalendar DATE or DATE-TIME property values (for each recurring
    /// instance) greater than or equal to the value of the CALDAV:min-
    /// date-time property value (Section 5.2.6) on the calendar
    /// collection where the resource will be stored;
    MinDateTime,
    
    /// (CALDAV:max-date-time): The resource submitted in the PUT request,
    /// or targeted by a COPY or MOVE request, MUST have all of its
    /// iCalendar DATE or DATE-TIME property values (for each recurring
    /// instance) less than the value of the CALDAV:max-date-time property
    /// value (Section 5.2.7) on the calendar collection where the
    /// resource will be stored;
    MaxDateTime,

    /// (CALDAV:max-instances): The resource submitted in the PUT request,
    /// or targeted by a COPY or MOVE request, MUST generate a number of
    /// recurring instances less than or equal to the value of the CALDAV:
    /// max-instances property value (Section 5.2.8) on the calendar
    /// collection where the resource will be stored;
    MaxInstances,

    /// (CALDAV:max-attendees-per-instance): The resource submitted in the
    /// PUT request, or targeted by a COPY or MOVE request, MUST have a
    /// number of ATTENDEE properties on any one instance less than or
    /// equal to the value of the CALDAV:max-attendees-per-instance
    /// property value (Section 5.2.9) on the calendar collection where
    /// the resource will be stored;
    MaxAttendeesPerInstance,

    /// The CALDAV:filter XML element (see
    /// Section 9.7) specified in the REPORT request MUST be valid.  For
    /// instance, a CALDAV:filter cannot nest a <C:comp name="VEVENT">
    /// element in a <C:comp name="VTODO"> element, and a CALDAV:filter
    /// cannot nest a <C:time-range start="..." end="..."> element in a
    /// <C:prop name="SUMMARY"> element.
    ValidFilter,

    /// (CALDAV:supported-filter): The CALDAV:comp-filter (see
    /// Section 9.7.1), CALDAV:prop-filter (see Section 9.7.2), and
    /// CALDAV:param-filter (see Section 9.7.3) XML elements used in the
    /// CALDAV:filter XML element (see Section 9.7) in the REPORT request
    /// only make reference to components, properties, and parameters for
    /// which queries are supported by the server, i.e., if the CALDAV:
    /// filter element attempts to reference an unsupported component,
    /// property, or parameter, this precondition is violated.  Servers
    /// SHOULD report the CALDAV:comp-filter, CALDAV:prop-filter, or
    /// CALDAV:param-filter for which it does not provide support.
    ///
    /// <!ELEMENT supported-filter (comp-filter*,
    ///                             prop-filter*,
    ///                             param-filter*)>
    SupportedFilter {
        comp: Vec<CompFilter>,
        prop: Vec<PropFilter>,
        param: Vec<ParamFilter>,
    },

    /// (DAV:number-of-matches-within-limits): The number of matching
    /// calendar object resources must fall within server-specific,
    /// predefined limits.  For example, this condition might be triggered
    /// if a search specification would cause the return of an extremely
    /// large number of responses.
    NumberOfMatchesWithinLimits,
}

// -------- Inner XML elements ---------

/// Some of the reports defined in this section do text matches of
/// character strings provided by the client and are compared to stored
/// calendar data.  Since iCalendar data is, by default, encoded in the
/// UTF-8 charset and may include characters outside the US-ASCII charset
/// range in some property and parameter values, there is a need to
/// ensure that text matching follows well-defined rules.
///
/// To deal with this, this specification makes use of the IANA Collation
/// Registry defined in [RFC4790] to specify collations that may be used
/// to carry out the text comparison operations with a well-defined rule.
/// 
/// The comparisons used in CalDAV are all "substring" matches, as per
/// [RFC4790], Section 4.2.  Collations supported by the server MUST
/// support "substring" match operations.
/// 
/// CalDAV servers are REQUIRED to support the "i;ascii-casemap" and
/// "i;octet" collations, as described in [RFC4790], and MAY support
/// other collations.
/// 
/// Servers MUST advertise the set of collations that they support via
/// the CALDAV:supported-collation-set property defined on any resource
/// that supports reports that use collations.
///
/// Clients MUST only use collations from the list advertised by the
/// server.
///
/// In the absence of a collation explicitly specified by the client, or
/// if the client specifies the "default" collation identifier (as
/// defined in [RFC4790], Section 3.1), the server MUST default to using
/// "i;ascii-casemap" as the collation.
///
/// Wildcards (as defined in [RFC4790], Section 3.2) MUST NOT be used in
/// the collation identifier.
/// 
/// If the client chooses a collation not supported by the server, the
/// server MUST respond with a CALDAV:supported-collation precondition
/// error response.
pub struct SupportedCollation(String);

/// calendar-data specialization for Property
pub struct CalendarDataSupport {
    content_type: String,
    version: String,
}

pub enum CalendarSelector<T: Dav::Extension> {
    AllProp,
    PropName,
    Prop(Dav::PropName<T>),
}

pub struct CompFilter {}

pub struct ParamFilter {}

pub struct PropFilter {}

/// Name:  timezone
///
/// Namespace:  urn:ietf:params:xml:ns:caldav
///
/// Purpose:  Specifies the time zone component to use when determining
/// the results of a report.
///
/// Description:  The CALDAV:timezone XML element specifies that for a
/// given calendaring REPORT request, the server MUST rely on the
/// specified VTIMEZONE component instead of the CALDAV:calendar-
/// timezone property of the calendar collection, in which the
/// calendar object resource is contained to resolve "date" values and
/// "date with local time" values (i.e., floating time) to "date with
/// UTC time" values.  The server will require this information to
/// determine if a calendar component scheduled with "date" values or
/// "date with local time" values intersects a CALDAV:time-range
/// specified in a CALDAV:calendar-query REPORT.
///
/// Note:  The iCalendar data embedded within the CALDAV:timezone XML
/// element MUST follow the standard XML character data encoding
/// rules, including use of &lt;, &gt;, &amp; etc. entity encoding or
/// the use of a <![CDATA[ ... ]]> construct.  In the later case, the
///
/// iCalendar data cannot contain the character sequence "]]>", which
/// is the end delimiter for the CDATA section.
///
/// Definition:
///
/// <!ELEMENT timezone (#PCDATA)>
/// PCDATA value: an iCalendar object with exactly one VTIMEZONE
pub struct TimeZone(String);

pub struct Filter {}

pub enum Component {
    VEvent,
    VTodo,
}