1
use crate::common::{
2
    CalendarDateTime, CalendarUserType, Encoding, FreeBusyTimeType, ParticipationStatusUnknown,
3
    Range, RelationshipType, Role, Status, TimeTransparency, TriggerRelationship, Value,
4
};
5
use crate::model::object::ICalObjectBuilder;
6
use crate::model::param::{
7
    add_is_utc, altrep_param, common_name_param, directory_entry_reference_param, language_param,
8
    sent_by_param, tz_id_param, CalendarUserTypeParam, DelegatedFromParam, DelegatedToParam,
9
    EncodingParam, FormatTypeParam, FreeBusyTimeTypeParam, MembersParam, ParticipationStatusParam,
10
    RangeParam, RelationshipTypeParam, RoleParam, RsvpParam, TriggerRelationshipParam,
11
    ValueTypeParam,
12
};
13
use crate::model::param::{impl_other_component_params_builder, impl_other_params_builder, Param};
14
use std::fmt::Display;
15
use std::marker::PhantomData;
16

            
17
mod duration;
18
mod recur;
19

            
20
use crate::error::AetoliaResult;
21
use crate::model::impl_property_access;
22
pub use duration::*;
23
pub use recur::*;
24

            
25
pub trait AddComponentProperty {
26
    fn add_property(&mut self, property: ComponentProperty);
27
}
28

            
29
pub trait DateTimeQuery {
30
    fn is_date(&self) -> bool;
31
    fn is_local_time(&self) -> bool;
32
    fn is_utc(&self) -> bool;
33
    fn is_local_time_with_timezone(&self) -> bool;
34
}
35

            
36
macro_rules! impl_date_time_query {
37
    ($for_type:ty) => {
38
        impl DateTimeQuery for $for_type {
39
            fn is_date(&self) -> bool {
40
                self.value.is_date()
41
            }
42

            
43
            // Form 1, local date-time
44
28
            fn is_local_time(&self) -> bool {
45
28
                self.value.is_date_time()
46
28
                    && !self.value.is_utc()
47
22
                    && !self
48
22
                        .params
49
22
                        .iter()
50
26
                        .any(|p| matches!(p, Param::TimeZoneId { .. }))
51
28
            }
52

            
53
            // Form 2, UTC date-time
54
26
            fn is_utc(&self) -> bool {
55
26
                self.value.is_date_time() && self.value.is_utc()
56
26
            }
57

            
58
            // Form 3, date-time in a specific time zone
59
20
            fn is_local_time_with_timezone(&self) -> bool {
60
20
                self.value.is_date_time()
61
20
                    && self
62
20
                        .params
63
20
                        .iter()
64
24
                        .any(|p| matches!(p, Param::TimeZoneId { .. }))
65
20
            }
66
        }
67
    };
68
}
69

            
70
#[derive(Debug, Eq, PartialEq)]
71
pub enum Classification {
72
    Public,
73
    Private,
74
    Confidential,
75
    XName(String),
76
    IanaToken(String),
77
}
78

            
79
impl Display for Classification {
80
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
81
        let str = match self {
82
            Classification::Public => "PUBLIC".to_string(),
83
            Classification::Private => "PRIVATE".to_string(),
84
            Classification::Confidential => "CONFIDENTIAL".to_string(),
85
            Classification::XName(name) => name.to_string(),
86
            Classification::IanaToken(token) => token.to_string(),
87
        };
88
        write!(f, "{}", str)
89
    }
90
}
91

            
92
pub enum StatusEvent {
93
    Tentative,
94
    Confirmed,
95
    Cancelled,
96
}
97

            
98
impl From<StatusEvent> for Status {
99
14
    fn from(status: StatusEvent) -> Self {
100
14
        match status {
101
2
            StatusEvent::Tentative => Status::Tentative,
102
12
            StatusEvent::Confirmed => Status::Confirmed,
103
            StatusEvent::Cancelled => Status::Cancelled,
104
        }
105
14
    }
106
}
107

            
108
pub enum StatusToDo {
109
    NeedsAction,
110
    Completed,
111
    InProcess,
112
    Cancelled,
113
}
114

            
115
impl From<StatusToDo> for Status {
116
12
    fn from(status: StatusToDo) -> Self {
117
12
        match status {
118
            StatusToDo::NeedsAction => Status::NeedsAction,
119
            StatusToDo::Completed => Status::Completed,
120
12
            StatusToDo::InProcess => Status::InProcess,
121
            StatusToDo::Cancelled => Status::Cancelled,
122
        }
123
12
    }
124
}
125

            
126
pub enum StatusJournal {
127
    Draft,
128
    Final,
129
    Cancelled,
130
}
131

            
132
impl From<StatusJournal> for Status {
133
12
    fn from(status: StatusJournal) -> Self {
134
12
        match status {
135
12
            StatusJournal::Draft => Status::Draft,
136
            StatusJournal::Final => Status::Final,
137
            StatusJournal::Cancelled => Status::Cancelled,
138
        }
139
12
    }
140
}
141

            
142
macro_rules! impl_finish_property_build {
143
    ($ev:expr) => {
144
72
        pub fn finish_property(mut self) -> ICalObjectBuilder {
145
72
            self.owner.inner.properties.push($ev(self.inner));
146
72
            self.owner
147
72
        }
148
    };
149
}
150

            
151
macro_rules! impl_finish_component_property_build {
152
    ($ev:expr) => {
153
686
        pub fn finish_property(mut self) -> P {
154
686
            self.owner.add_property($ev(self.inner));
155
686
            self.owner
156
686
        }
157
    };
158
}
159

            
160
#[derive(Debug, PartialEq)]
161
pub enum CalendarProperty {
162
    ProductId(ProductIdProperty),
163
    Version(VersionProperty),
164
    CalendarScale(CalendarScaleProperty),
165
    Method(MethodProperty),
166
    XProperty(XProperty),
167
    IanaProperty(IanaProperty),
168
}
169

            
170
#[derive(Debug, PartialEq)]
171
pub struct ProductIdProperty {
172
    pub(crate) value: String,
173
    pub(crate) params: Vec<Param>,
174
}
175

            
176
pub struct ProductIdPropertyBuilder {
177
    owner: ICalObjectBuilder,
178
    inner: ProductIdProperty,
179
}
180

            
181
impl ProductIdPropertyBuilder {
182
22
    pub(crate) fn new(owner: ICalObjectBuilder, value: String) -> ProductIdPropertyBuilder {
183
22
        ProductIdPropertyBuilder {
184
22
            owner,
185
22
            inner: ProductIdProperty {
186
22
                value,
187
22
                params: Vec::new(),
188
22
            },
189
22
        }
190
22
    }
191

            
192
    impl_finish_property_build!(CalendarProperty::ProductId);
193
}
194

            
195
impl_other_params_builder!(ProductIdPropertyBuilder);
196

            
197
#[derive(Debug, PartialEq)]
198
pub struct VersionProperty {
199
    pub(crate) min_version: Option<String>,
200
    pub(crate) max_version: String,
201
    pub(crate) params: Vec<Param>,
202
}
203

            
204
pub struct VersionPropertyBuilder {
205
    owner: ICalObjectBuilder,
206
    inner: VersionProperty,
207
}
208

            
209
impl VersionPropertyBuilder {
210
18
    pub(crate) fn new(
211
18
        owner: ICalObjectBuilder,
212
18
        min_version: Option<String>,
213
18
        max_version: String,
214
18
    ) -> VersionPropertyBuilder {
215
18
        VersionPropertyBuilder {
216
18
            owner,
217
18
            inner: VersionProperty {
218
18
                min_version,
219
18
                max_version,
220
18
                params: Vec::new(),
221
18
            },
222
18
        }
223
18
    }
224

            
225
    impl_finish_property_build!(CalendarProperty::Version);
226
}
227

            
228
impl_other_params_builder!(VersionPropertyBuilder);
229

            
230
#[derive(Debug, PartialEq)]
231
pub struct CalendarScaleProperty {
232
    pub(crate) value: String,
233
    pub(crate) params: Vec<Param>,
234
}
235

            
236
pub struct CalendarScalePropertyBuilder {
237
    owner: ICalObjectBuilder,
238
    inner: CalendarScaleProperty,
239
}
240

            
241
impl CalendarScalePropertyBuilder {
242
14
    pub(crate) fn new(owner: ICalObjectBuilder, value: String) -> CalendarScalePropertyBuilder {
243
14
        CalendarScalePropertyBuilder {
244
14
            owner,
245
14
            inner: CalendarScaleProperty {
246
14
                value,
247
14
                params: Vec::new(),
248
14
            },
249
14
        }
250
14
    }
251

            
252
    impl_finish_property_build!(CalendarProperty::CalendarScale);
253
}
254

            
255
impl_other_params_builder!(CalendarScalePropertyBuilder);
256

            
257
#[derive(Debug, PartialEq)]
258
pub struct MethodProperty {
259
    pub(crate) value: String,
260
    pub(crate) params: Vec<Param>,
261
}
262

            
263
pub struct MethodPropertyBuilder {
264
    owner: ICalObjectBuilder,
265
    inner: MethodProperty,
266
}
267

            
268
impl MethodPropertyBuilder {
269
14
    pub(crate) fn new(owner: ICalObjectBuilder, value: String) -> MethodPropertyBuilder {
270
14
        MethodPropertyBuilder {
271
14
            owner,
272
14
            inner: MethodProperty {
273
14
                params: Vec::new(),
274
14
                value,
275
14
            },
276
14
        }
277
14
    }
278

            
279
    impl_finish_property_build!(CalendarProperty::Method);
280
}
281

            
282
impl_other_params_builder!(MethodPropertyBuilder);
283

            
284
#[derive(Debug, PartialEq)]
285
pub enum ComponentProperty {
286
    /// RFC 5545, 3.8.1.1
287
    /// Value type: URI or BINARY
288
    Attach(AttachProperty),
289
    /// RFC 5545, 3.8.1.2
290
    /// Value type: TEXT
291
    Categories(CategoriesProperty),
292
    /// RFC 5545, 3.8.1.3
293
    /// Value type: TEXT
294
    Classification(ClassificationProperty),
295
    /// RFC 5545, 3.8.1.4
296
    /// Value type: TEXT
297
    Comment(CommentProperty),
298
    /// RFC 5545, 3.8.1.5
299
    /// Value type: TEXT
300
    Description(DescriptionProperty),
301
    /// RFC 5545, 3.8.1.6
302
    /// Value type: FLOAT
303
    GeographicPosition(GeographicPositionProperty),
304
    /// RFC 5545, 3.8.1.7
305
    /// Value type: TEXT
306
    Location(LocationProperty),
307
    /// RFC 5545, 4.8.1.8
308
    /// Value type: INTEGER
309
    PercentComplete(PercentCompleteProperty),
310
    /// RFC 5545, 3.8.1.9
311
    /// Value type: INTEGER
312
    Priority(PriorityProperty),
313
    /// RFC 5545, 3.8.1.10
314
    /// Value type: TEXT
315
    Resources(ResourcesProperty),
316
    /// RFC 5545, 3.8.1.11
317
    /// Value type: TEXT
318
    Status(StatusProperty),
319
    /// RFC 5545, 3.8.1.12
320
    /// Value type: TEXT
321
    Summary(SummaryProperty),
322
    /// RFC 5545, 3.8.2.1
323
    /// Value type: DATE-TIME
324
    DateTimeCompleted(DateTimeCompletedProperty),
325
    /// RFC 5545, 3.8.2.2
326
    /// Value type: DATE-TIME or DATE
327
    DateTimeEnd(DateTimeEndProperty),
328
    /// RFC 5545, 3.8.2.3
329
    /// Value type: DATE-TIME or DATE
330
    DateTimeDue(DateTimeDueProperty),
331
    /// RFC 5545, 3.8.2.4
332
    /// Value type: DATE-TIME or DATE
333
    DateTimeStart(DateTimeStartProperty),
334
    /// RFC 5545, 3.8.2.5
335
    /// Value type: DURATION
336
    Duration(DurationProperty),
337
    /// RFC 5545, 3.8.2.6
338
    /// Value type: PERIOD
339
    FreeBusyTime(FreeBusyTimeProperty),
340
    /// RFC 5545, 3.8.2.7
341
    /// Value type: TEXT
342
    TimeTransparency(TimeTransparencyProperty),
343
    /// RFC 5545, 3.8.3.1
344
    /// Value type: TEXT
345
    TimeZoneId(TimeZoneIdProperty),
346
    /// RFC 5545, 3.8.3.2
347
    /// Value type: TEXT
348
    TimeZoneName(TimeZoneNameProperty),
349
    /// RFC 5545, 3.8.3.3
350
    /// Value type: UTC-OFFSET
351
    TimeZoneOffsetFrom(TimeZoneOffsetFromProperty),
352
    /// RFC 5545, 3.8.3.4
353
    /// Value type: UTC-OFFSET
354
    TimeZoneOffsetTo(TimeZoneOffsetToProperty),
355
    /// RFC 5545, 3.8.3.5
356
    /// Value type: URI
357
    TimeZoneUrl(TimeZoneUrlProperty),
358
    /// RFC 5545, 3.8.4.1
359
    /// Value type: CAL-ADDRESS
360
    Attendee(AttendeeProperty),
361
    /// RFC 5545, 3.8.4.2
362
    /// Value type: TEXT
363
    Contact(ContactProperty),
364
    /// RFC 5545, 3.8.4.3
365
    /// Value type: CAL-ADDRESS
366
    Organizer(OrganizerProperty),
367
    /// RFC 5545, 3.8.4.4
368
    /// Value type: DATE-TIME or DATE
369
    RecurrenceId(RecurrenceIdProperty),
370
    /// RFC 5545, 3.8.4.5
371
    /// Value type: TEXT
372
    RelatedTo(RelatedToProperty),
373
    /// RFC 5545, 3.8.4.6
374
    /// Value type: URI
375
    Url(UrlProperty),
376
    /// RFC 5545, 3.8.4.7
377
    /// Value type: TEXT
378
    UniqueIdentifier(UniqueIdentifierProperty),
379
    /// RFC 5545, 3.8.5.1
380
    /// Value type: DATE-TIME or DATE
381
    ExceptionDateTimes(ExceptionDateTimesProperty),
382
    /// RFC 5545, 3.8.5.2
383
    /// Value type: DATE-TIME or DATE or PERIOD
384
    RecurrenceDateTimes(RecurrenceDateTimesProperty),
385
    /// RFC 5545, 3.8.5.3
386
    /// Value type: RECUR
387
    RecurrenceRule(RecurrenceRuleProperty),
388
    /// RFC 5545, 3.8.6.1
389
    /// Value type: TEXT
390
    Action(ActionProperty),
391
    /// RFC 5545, 3.8.6.2
392
    /// Value type: INTEGER
393
    Repeat(RepeatProperty),
394
    /// RFC 5545, 3.8.6.3
395
    /// Value type: DURATION or DATE-TIME
396
    Trigger(TriggerProperty),
397
    /// RFC 5545, 3.8.7.1
398
    /// Value type: DATE-TIME
399
    DateTimeCreated(CreatedProperty),
400
    /// RFC 5545, 3.8.7.2
401
    /// Value type: DATE-TIME
402
    DateTimeStamp(DateTimeStampProperty),
403
    /// RFC 5545, 3.8.7.3
404
    /// Value type: DATE-TIME
405
    LastModified(LastModifiedProperty),
406
    /// RFC 5545, 3.8.7.4
407
    /// Value type: INTEGER
408
    Sequence(SequenceProperty),
409
    /// RFC 5545, 3.8.8.1
410
    /// Value type: TEXT or any other type
411
    IanaProperty(IanaProperty),
412
    /// RFC 5545, 3.8.8.2
413
    /// Value type: TEXT or any other type
414
    XProperty(XProperty),
415
    /// RFC 5545, 3.8.8.3
416
    /// Value type: TEXT
417
    RequestStatus(RequestStatusProperty),
418
}
419

            
420
impl ComponentProperty {
421
2280
    pub fn params(&self) -> &[Param] {
422
2280
        match self {
423
158
            ComponentProperty::DateTimeStamp(p) => &p.params,
424
158
            ComponentProperty::UniqueIdentifier(p) => &p.params,
425
170
            ComponentProperty::DateTimeStart(p) => &p.params,
426
36
            ComponentProperty::Classification(p) => &p.params,
427
36
            ComponentProperty::DateTimeCreated(p) => &p.params,
428
96
            ComponentProperty::Description(p) => &p.params,
429
20
            ComponentProperty::GeographicPosition(p) => &p.params,
430
42
            ComponentProperty::LastModified(p) => &p.params,
431
26
            ComponentProperty::Location(p) => &p.params,
432
48
            ComponentProperty::Organizer(p) => &p.params,
433
20
            ComponentProperty::Priority(p) => &p.params,
434
30
            ComponentProperty::Sequence(p) => &p.params,
435
48
            ComponentProperty::Summary(p) => &p.params,
436
10
            ComponentProperty::TimeTransparency(p) => &p.params,
437
24
            ComponentProperty::RequestStatus(p) => &p.params,
438
40
            ComponentProperty::Url(p) => &p.params,
439
30
            ComponentProperty::RecurrenceId(p) => &p.params,
440
176
            ComponentProperty::RecurrenceRule(p) => &p.params,
441
44
            ComponentProperty::DateTimeEnd(p) => &p.params,
442
62
            ComponentProperty::Duration(p) => &p.params,
443
54
            ComponentProperty::Attach(p) => &p.params,
444
40
            ComponentProperty::Attendee(p) => &p.params,
445
24
            ComponentProperty::Categories(p) => &p.params,
446
36
            ComponentProperty::Comment(p) => &p.params,
447
28
            ComponentProperty::Contact(p) => &p.params,
448
20
            ComponentProperty::ExceptionDateTimes(p) => &p.params,
449
30
            ComponentProperty::Status(p) => &p.params,
450
18
            ComponentProperty::RelatedTo(p) => &p.params,
451
12
            ComponentProperty::Resources(p) => &p.params,
452
64
            ComponentProperty::RecurrenceDateTimes(p) => &p.params,
453
6
            ComponentProperty::DateTimeCompleted(p) => &p.params,
454
10
            ComponentProperty::PercentComplete(p) => &p.params,
455
10
            ComponentProperty::DateTimeDue(p) => &p.params,
456
6
            ComponentProperty::FreeBusyTime(p) => &p.params,
457
26
            ComponentProperty::TimeZoneId(p) => &p.params,
458
10
            ComponentProperty::TimeZoneUrl(p) => &p.params,
459
40
            ComponentProperty::TimeZoneOffsetTo(p) => &p.params,
460
40
            ComponentProperty::TimeZoneOffsetFrom(p) => &p.params,
461
30
            ComponentProperty::TimeZoneName(p) => &p.params,
462
52
            ComponentProperty::Action(p) => &p.params,
463
92
            ComponentProperty::Trigger(p) => &p.params,
464
42
            ComponentProperty::Repeat(p) => &p.params,
465
168
            ComponentProperty::IanaProperty(p) => &p.params,
466
148
            ComponentProperty::XProperty(p) => &p.params,
467
        }
468
2280
    }
469
}
470

            
471
pub trait ComponentPropertyInner<T> {
472
    fn property_inner(&self) -> Option<&T>;
473
}
474

            
475
macro_rules! impl_component_property_inner {
476
    ($for_type:ty, $variant:ident) => {
477
        impl $crate::model::property::ComponentPropertyInner<$for_type>
478
            for $crate::model::property::ComponentProperty
479
        {
480
114
            fn property_inner(&self) -> Option<&$for_type> {
481
114
                match self {
482
48
                    $crate::model::property::ComponentProperty::$variant(p) => Some(p),
483
66
                    _ => None,
484
                }
485
114
            }
486
        }
487
    };
488
}
489

            
490
impl_component_property_inner!(ClassificationProperty, Classification);
491
impl_component_property_inner!(DescriptionProperty, Description);
492
impl_component_property_inner!(GeographicPositionProperty, GeographicPosition);
493
impl_component_property_inner!(LocationProperty, Location);
494
impl_component_property_inner!(PercentCompleteProperty, PercentComplete);
495
impl_component_property_inner!(PriorityProperty, Priority);
496
impl_component_property_inner!(StatusProperty, Status);
497
impl_component_property_inner!(SummaryProperty, Summary);
498
impl_component_property_inner!(DateTimeCompletedProperty, DateTimeCompleted);
499
impl_component_property_inner!(DateTimeEndProperty, DateTimeEnd);
500
impl_component_property_inner!(DateTimeDueProperty, DateTimeDue);
501
impl_component_property_inner!(DateTimeStartProperty, DateTimeStart);
502
impl_component_property_inner!(DurationProperty, Duration);
503
impl_component_property_inner!(TimeTransparencyProperty, TimeTransparency);
504
impl_component_property_inner!(TimeZoneIdProperty, TimeZoneId);
505
impl_component_property_inner!(TimeZoneOffsetFromProperty, TimeZoneOffsetFrom);
506
impl_component_property_inner!(TimeZoneOffsetToProperty, TimeZoneOffsetTo);
507
impl_component_property_inner!(TimeZoneUrlProperty, TimeZoneUrl);
508
impl_component_property_inner!(OrganizerProperty, Organizer);
509
impl_component_property_inner!(RecurrenceIdProperty, RecurrenceId);
510
impl_component_property_inner!(UrlProperty, Url);
511
impl_component_property_inner!(UniqueIdentifierProperty, UniqueIdentifier);
512
impl_component_property_inner!(RecurrenceRuleProperty, RecurrenceRule);
513
impl_component_property_inner!(ActionProperty, Action);
514
impl_component_property_inner!(RepeatProperty, Repeat);
515
impl_component_property_inner!(TriggerProperty, Trigger);
516
impl_component_property_inner!(CreatedProperty, DateTimeCreated);
517
impl_component_property_inner!(DateTimeStampProperty, DateTimeStamp);
518
impl_component_property_inner!(LastModifiedProperty, LastModified);
519
impl_component_property_inner!(SequenceProperty, Sequence);
520
impl_component_property_inner!(ContactProperty, Contact);
521
impl_component_property_inner!(AttachProperty, Attach);
522

            
523
pub trait ComponentPropertiesInner<T> {
524
    fn many_property_inner(&self) -> Option<&T>;
525
}
526

            
527
macro_rules! impl_component_properties_inner {
528
    ($for_type:ty, $variant:ident) => {
529
        impl $crate::model::property::ComponentPropertiesInner<$for_type>
530
            for $crate::model::property::ComponentProperty
531
        {
532
312
            fn many_property_inner(&self) -> Option<&$for_type> {
533
312
                match self {
534
18
                    $crate::model::property::ComponentProperty::$variant(p) => Some(p),
535
294
                    _ => None,
536
                }
537
312
            }
538
        }
539
    };
540
}
541

            
542
impl_component_properties_inner!(AttachProperty, Attach);
543
impl_component_properties_inner!(CategoriesProperty, Categories);
544
impl_component_properties_inner!(AttendeeProperty, Attendee);
545
impl_component_properties_inner!(RecurrenceRuleProperty, RecurrenceRule);
546
impl_component_properties_inner!(CommentProperty, Comment);
547
impl_component_properties_inner!(ContactProperty, Contact);
548
impl_component_properties_inner!(ExceptionDateTimesProperty, ExceptionDateTimes);
549
impl_component_properties_inner!(RecurrenceDateTimesProperty, RecurrenceDateTimes);
550
impl_component_properties_inner!(RequestStatusProperty, RequestStatus);
551
impl_component_properties_inner!(RelatedToProperty, RelatedTo);
552
impl_component_properties_inner!(ResourcesProperty, Resources);
553
impl_component_properties_inner!(DescriptionProperty, Description);
554
impl_component_properties_inner!(FreeBusyTimeProperty, FreeBusyTime);
555
impl_component_properties_inner!(TimeZoneNameProperty, TimeZoneName);
556

            
557
#[derive(Debug, PartialEq)]
558
pub struct TriggerProperty {
559
    pub(crate) value: TriggerValue,
560
    pub(crate) params: Vec<Param>,
561
}
562

            
563
#[derive(Debug, PartialEq)]
564
pub enum TriggerValue {
565
    Relative(Duration),
566
    Absolute(CalendarDateTime),
567
}
568

            
569
impl_property_access!(TriggerProperty, TriggerValue);
570

            
571
#[derive(Debug, PartialEq)]
572
pub struct XProperty {
573
    pub(crate) name: String,
574
    pub(crate) value: String,
575
    pub(crate) params: Vec<Param>,
576
}
577

            
578
impl_property_access!(XProperty, String);
579

            
580
pub struct XPropertyBuilder {
581
    owner: ICalObjectBuilder,
582
    inner: XProperty,
583
}
584

            
585
impl XPropertyBuilder {
586
2
    pub(crate) fn new(owner: ICalObjectBuilder, name: String, value: String) -> XPropertyBuilder {
587
2
        XPropertyBuilder {
588
2
            owner,
589
2
            inner: XProperty {
590
2
                name,
591
2
                value,
592
2
                params: Vec::new(),
593
2
            },
594
2
        }
595
2
    }
596

            
597
    impl_finish_property_build!(CalendarProperty::XProperty);
598
}
599

            
600
impl_other_params_builder!(XPropertyBuilder);
601

            
602
#[derive(Debug, PartialEq)]
603
pub struct IanaProperty {
604
    pub(crate) name: String,
605
    pub(crate) value: String,
606
    pub(crate) params: Vec<Param>,
607
}
608

            
609
impl_property_access!(IanaProperty, String);
610

            
611
pub struct IanaPropertyBuilder {
612
    owner: ICalObjectBuilder,
613
    inner: IanaProperty,
614
}
615

            
616
impl IanaPropertyBuilder {
617
2
    pub(crate) fn new(
618
2
        owner: ICalObjectBuilder,
619
2
        name: String,
620
2
        value: String,
621
2
    ) -> IanaPropertyBuilder {
622
2
        IanaPropertyBuilder {
623
2
            owner,
624
2
            inner: IanaProperty {
625
2
                name,
626
2
                value,
627
2
                params: Vec::new(),
628
2
            },
629
2
        }
630
2
    }
631

            
632
    impl_finish_property_build!(CalendarProperty::IanaProperty);
633
}
634

            
635
impl_other_params_builder!(IanaPropertyBuilder);
636

            
637
pub struct XComponentPropertyBuilder<P> {
638
    owner: P,
639
    inner: XProperty,
640
}
641

            
642
impl<P> XComponentPropertyBuilder<P>
643
where
644
    P: AddComponentProperty,
645
{
646
56
    pub(crate) fn new(owner: P, name: String, value: String) -> XComponentPropertyBuilder<P> {
647
56
        XComponentPropertyBuilder {
648
56
            owner,
649
56
            inner: XProperty {
650
56
                params: Vec::new(),
651
56
                name,
652
56
                value,
653
56
            },
654
56
        }
655
56
    }
656

            
657
    impl_finish_component_property_build!(ComponentProperty::XProperty);
658
}
659

            
660
impl_other_component_params_builder!(XComponentPropertyBuilder<P>);
661

            
662
pub struct IanaComponentPropertyBuilder<P> {
663
    owner: P,
664
    inner: IanaProperty,
665
}
666

            
667
impl<P> IanaComponentPropertyBuilder<P>
668
where
669
    P: AddComponentProperty,
670
{
671
56
    pub(crate) fn new(owner: P, name: String, value: String) -> IanaComponentPropertyBuilder<P> {
672
56
        IanaComponentPropertyBuilder {
673
56
            owner,
674
56
            inner: IanaProperty {
675
56
                name,
676
56
                value,
677
56
                params: Vec::new(),
678
56
            },
679
56
        }
680
56
    }
681

            
682
    impl_finish_component_property_build!(ComponentProperty::IanaProperty);
683
}
684

            
685
impl_other_component_params_builder!(IanaComponentPropertyBuilder<P>);
686

            
687
#[derive(Debug, PartialEq)]
688
pub struct DateTimeStampProperty {
689
    pub(crate) value: CalendarDateTime,
690
    pub(crate) params: Vec<Param>,
691
}
692

            
693
impl_property_access!(DateTimeStampProperty, CalendarDateTime);
694

            
695
pub struct DateTimeStampPropertyBuilder<P: AddComponentProperty> {
696
    owner: P,
697
    inner: DateTimeStampProperty,
698
}
699

            
700
impl<P> DateTimeStampPropertyBuilder<P>
701
where
702
    P: AddComponentProperty,
703
{
704
50
    pub(crate) fn new(
705
50
        owner: P,
706
50
        date: time::Date,
707
50
        time: time::Time,
708
50
    ) -> DateTimeStampPropertyBuilder<P> {
709
50
        DateTimeStampPropertyBuilder {
710
50
            owner,
711
50
            inner: DateTimeStampProperty {
712
50
                value: (date, time, false).into(),
713
50
                params: Vec::new(),
714
50
            },
715
50
        }
716
50
    }
717

            
718
    add_is_utc!();
719

            
720
    impl_finish_component_property_build!(ComponentProperty::DateTimeStamp);
721
}
722

            
723
impl_other_component_params_builder!(DateTimeStampPropertyBuilder<P>);
724

            
725
#[derive(Debug, PartialEq)]
726
pub struct UniqueIdentifierProperty {
727
    pub(crate) value: String,
728
    pub(crate) params: Vec<Param>,
729
}
730

            
731
impl_property_access!(UniqueIdentifierProperty, String);
732

            
733
pub struct UniqueIdentifierPropertyBuilder<P: AddComponentProperty> {
734
    owner: P,
735
    inner: UniqueIdentifierProperty,
736
}
737

            
738
impl<P> UniqueIdentifierPropertyBuilder<P>
739
where
740
    P: AddComponentProperty,
741
{
742
18
    pub(crate) fn new(owner: P, value: String) -> UniqueIdentifierPropertyBuilder<P> {
743
18
        UniqueIdentifierPropertyBuilder {
744
18
            owner,
745
18
            inner: UniqueIdentifierProperty {
746
18
                value,
747
18
                params: Vec::new(),
748
18
            },
749
18
        }
750
18
    }
751

            
752
    impl_finish_component_property_build!(ComponentProperty::UniqueIdentifier);
753
}
754

            
755
impl_other_component_params_builder!(UniqueIdentifierPropertyBuilder<P>);
756

            
757
#[derive(Debug, Clone, PartialEq)]
758
pub struct DateTimeStartProperty {
759
    pub(crate) value: CalendarDateTime,
760
    pub(crate) params: Vec<Param>,
761
}
762

            
763
impl_property_access!(DateTimeStartProperty, CalendarDateTime);
764

            
765
pub struct DateTimeStartPropertyBuilder<P: AddComponentProperty> {
766
    owner: P,
767
    inner: DateTimeStartProperty,
768
}
769

            
770
impl<P> DateTimeStartPropertyBuilder<P>
771
where
772
    P: AddComponentProperty,
773
{
774
74
    pub(crate) fn new(
775
74
        owner: P,
776
74
        date: time::Date,
777
74
        time: Option<time::Time>,
778
74
    ) -> DateTimeStartPropertyBuilder<P> {
779
74
        let mut params = Vec::new();
780
74

            
781
74
        // The default is DATE-TIME. If the time is None, then it is a DATE and although it's
782
74
        // optional, this will default to setting the value here.
783
74
        if time.is_none() {
784
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }))
785
74
        }
786

            
787
74
        DateTimeStartPropertyBuilder {
788
74
            owner,
789
74
            inner: DateTimeStartProperty {
790
74
                value: (date, time, false).into(),
791
74
                params,
792
74
            },
793
74
        }
794
74
    }
795

            
796
    tz_id_param!();
797

            
798
    add_is_utc!();
799

            
800
    impl_finish_component_property_build!(ComponentProperty::DateTimeStart);
801
}
802

            
803
impl_other_component_params_builder!(DateTimeStartPropertyBuilder<P>);
804

            
805
impl_date_time_query!(DateTimeStartProperty);
806

            
807
#[derive(Debug, PartialEq)]
808
pub struct ClassificationProperty {
809
    pub(crate) value: Classification,
810
    pub(crate) params: Vec<Param>,
811
}
812

            
813
impl_property_access!(ClassificationProperty, Classification);
814

            
815
pub struct ClassificationPropertyBuilder<P: AddComponentProperty> {
816
    owner: P,
817
    inner: ClassificationProperty,
818
}
819

            
820
impl<P> ClassificationPropertyBuilder<P>
821
where
822
    P: AddComponentProperty,
823
{
824
38
    pub(crate) fn new(owner: P, value: Classification) -> ClassificationPropertyBuilder<P> {
825
38
        ClassificationPropertyBuilder {
826
38
            owner,
827
38
            inner: ClassificationProperty {
828
38
                value,
829
38
                params: Vec::new(),
830
38
            },
831
38
        }
832
38
    }
833

            
834
    impl_finish_component_property_build!(ComponentProperty::Classification);
835
}
836

            
837
impl_other_component_params_builder!(ClassificationPropertyBuilder<P>);
838

            
839
#[derive(Debug, PartialEq)]
840
pub struct CreatedProperty {
841
    pub(crate) value: CalendarDateTime,
842
    pub(crate) params: Vec<Param>,
843
}
844

            
845
impl_property_access!(CreatedProperty, CalendarDateTime);
846

            
847
pub struct CreatedPropertyBuilder<P: AddComponentProperty> {
848
    owner: P,
849
    inner: CreatedProperty,
850
}
851

            
852
impl<P> CreatedPropertyBuilder<P>
853
where
854
    P: AddComponentProperty,
855
{
856
38
    pub(crate) fn new(owner: P, date: time::Date, time: time::Time) -> CreatedPropertyBuilder<P> {
857
38
        CreatedPropertyBuilder {
858
38
            owner,
859
38
            inner: CreatedProperty {
860
38
                value: (date, time, false).into(),
861
38
                params: Vec::new(),
862
38
            },
863
38
        }
864
38
    }
865

            
866
    add_is_utc!();
867

            
868
    impl_finish_component_property_build!(ComponentProperty::DateTimeCreated);
869
}
870

            
871
impl_other_component_params_builder!(CreatedPropertyBuilder<P>);
872

            
873
#[derive(Debug, PartialEq)]
874
pub struct DescriptionProperty {
875
    pub(crate) value: String,
876
    pub(crate) params: Vec<Param>,
877
}
878

            
879
impl_property_access!(DescriptionProperty, String);
880

            
881
pub struct DescriptionPropertyBuilder<P: AddComponentProperty> {
882
    owner: P,
883
    inner: DescriptionProperty,
884
}
885

            
886
impl<P> DescriptionPropertyBuilder<P>
887
where
888
    P: AddComponentProperty,
889
{
890
26
    pub(crate) fn new(owner: P, value: String) -> DescriptionPropertyBuilder<P> {
891
26
        DescriptionPropertyBuilder {
892
26
            owner,
893
26
            inner: DescriptionProperty {
894
26
                value,
895
26
                params: Vec::new(),
896
26
            },
897
26
        }
898
26
    }
899

            
900
    altrep_param!();
901
    language_param!();
902

            
903
    impl_finish_component_property_build!(ComponentProperty::Description);
904
}
905

            
906
impl_other_component_params_builder!(DescriptionPropertyBuilder<P>);
907

            
908
#[derive(Debug, PartialEq)]
909
pub struct GeographicPositionProperty {
910
    pub(crate) value: GeographicPositionPropertyValue,
911
    pub(crate) params: Vec<Param>,
912
}
913

            
914
#[derive(Debug, PartialEq)]
915
pub struct GeographicPositionPropertyValue {
916
    pub latitude: f64,
917
    pub longitude: f64,
918
}
919

            
920
impl_property_access!(GeographicPositionProperty, GeographicPositionPropertyValue);
921

            
922
pub struct GeographicPositionPropertyBuilder<P: AddComponentProperty> {
923
    owner: P,
924
    inner: GeographicPositionProperty,
925
}
926

            
927
impl<P> GeographicPositionPropertyBuilder<P>
928
where
929
    P: AddComponentProperty,
930
{
931
26
    pub(crate) fn new(
932
26
        owner: P,
933
26
        latitude: f64,
934
26
        longitude: f64,
935
26
    ) -> GeographicPositionPropertyBuilder<P> {
936
26
        GeographicPositionPropertyBuilder {
937
26
            owner,
938
26
            inner: GeographicPositionProperty {
939
26
                value: GeographicPositionPropertyValue {
940
26
                    latitude,
941
26
                    longitude,
942
26
                },
943
26
                params: Vec::new(),
944
26
            },
945
26
        }
946
26
    }
947

            
948
    impl_finish_component_property_build!(ComponentProperty::GeographicPosition);
949
}
950

            
951
impl_other_component_params_builder!(GeographicPositionPropertyBuilder<P>);
952

            
953
#[derive(Debug, PartialEq)]
954
pub struct LastModifiedProperty {
955
    pub(crate) value: CalendarDateTime,
956
    pub(crate) params: Vec<Param>,
957
}
958

            
959
impl_property_access!(LastModifiedProperty, CalendarDateTime);
960

            
961
pub struct LastModifiedPropertyBuilder<P: AddComponentProperty> {
962
    owner: P,
963
    inner: LastModifiedProperty,
964
}
965

            
966
impl<P> LastModifiedPropertyBuilder<P>
967
where
968
    P: AddComponentProperty,
969
{
970
50
    pub(crate) fn new(
971
50
        owner: P,
972
50
        date: time::Date,
973
50
        time: time::Time,
974
50
    ) -> LastModifiedPropertyBuilder<P> {
975
50
        LastModifiedPropertyBuilder {
976
50
            owner,
977
50
            inner: LastModifiedProperty {
978
50
                value: (date, time, false).into(),
979
50
                params: Vec::new(),
980
50
            },
981
50
        }
982
50
    }
983

            
984
    add_is_utc!();
985

            
986
    impl_finish_component_property_build!(ComponentProperty::LastModified);
987
}
988

            
989
impl_other_component_params_builder!(LastModifiedPropertyBuilder<P>);
990

            
991
#[derive(Debug, PartialEq)]
992
pub struct LocationProperty {
993
    pub(crate) value: String,
994
    pub(crate) params: Vec<Param>,
995
}
996

            
997
impl_property_access!(LocationProperty, String);
998

            
999
pub struct LocationPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: LocationProperty,
}
impl<P> LocationPropertyBuilder<P>
where
    P: AddComponentProperty,
{
24
    pub(crate) fn new(owner: P, value: String) -> LocationPropertyBuilder<P> {
24
        LocationPropertyBuilder {
24
            owner,
24
            inner: LocationProperty {
24
                value,
24
                params: Vec::new(),
24
            },
24
        }
24
    }
    altrep_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Location);
}
impl_other_component_params_builder!(LocationPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct OrganizerProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(OrganizerProperty, String);
pub struct OrganizerPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: OrganizerProperty,
}
impl<P> OrganizerPropertyBuilder<P>
where
    P: AddComponentProperty,
{
50
    pub(crate) fn new(owner: P, value: String) -> OrganizerPropertyBuilder<P> {
50
        OrganizerPropertyBuilder {
50
            owner,
50
            inner: OrganizerProperty {
50
                value,
50
                params: Vec::new(),
50
            },
50
        }
50
    }
    common_name_param!();
    directory_entry_reference_param!();
    sent_by_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Organizer);
}
impl_other_component_params_builder!(OrganizerPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct PriorityProperty {
    pub(crate) value: u8,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(PriorityProperty, u8);
pub struct PriorityPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: PriorityProperty,
}
impl<P> PriorityPropertyBuilder<P>
where
    P: AddComponentProperty,
{
26
    pub(crate) fn new(owner: P, value: u8) -> PriorityPropertyBuilder<P> {
26
        PriorityPropertyBuilder {
26
            owner,
26
            inner: PriorityProperty {
26
                value,
26
                params: Vec::new(),
26
            },
26
        }
26
    }
    impl_finish_component_property_build!(ComponentProperty::Priority);
}
impl_other_component_params_builder!(PriorityPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct SequenceProperty {
    pub(crate) value: u32,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(SequenceProperty, u32);
pub struct SequencePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: SequenceProperty,
}
impl<P> SequencePropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(owner: P, value: u32) -> SequencePropertyBuilder<P> {
38
        SequencePropertyBuilder {
38
            owner,
38
            inner: SequenceProperty {
38
                value,
38
                params: Vec::new(),
38
            },
38
        }
38
    }
    impl_finish_component_property_build!(ComponentProperty::Sequence);
}
impl_other_component_params_builder!(SequencePropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct RequestStatusProperty {
    pub(crate) value: RequestStatusPropertyValue,
    pub(crate) params: Vec<Param>,
}
#[derive(Debug, PartialEq)]
pub struct RequestStatusPropertyValue {
    pub(crate) status_code: Vec<u32>,
    pub(crate) description: String,
    pub(crate) exception_data: Option<String>,
}
impl_property_access!(RequestStatusProperty, RequestStatusPropertyValue);
pub struct RequestStatusPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RequestStatusProperty,
}
impl<P> RequestStatusPropertyBuilder<P>
where
    P: AddComponentProperty,
{
50
    pub(crate) fn new(
50
        owner: P,
50
        status_code: Vec<u32>,
50
        description: String,
50
        exception_data: Option<String>,
50
    ) -> RequestStatusPropertyBuilder<P> {
50
        RequestStatusPropertyBuilder {
50
            owner,
50
            inner: RequestStatusProperty {
50
                value: RequestStatusPropertyValue {
50
                    status_code,
50
                    description,
50
                    exception_data,
50
                },
50
                params: Vec::new(),
50
            },
50
        }
50
    }
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::RequestStatus);
}
impl_other_component_params_builder!(RequestStatusPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct SummaryProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(SummaryProperty, String);
pub struct SummaryPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: SummaryProperty,
}
impl<P> SummaryPropertyBuilder<P>
where
    P: AddComponentProperty,
{
18
    pub(crate) fn new(owner: P, value: String) -> SummaryPropertyBuilder<P> {
18
        SummaryPropertyBuilder {
18
            owner,
18
            inner: SummaryProperty {
18
                value,
18
                params: Vec::new(),
18
            },
18
        }
18
    }
    altrep_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Summary);
}
impl_other_component_params_builder!(SummaryPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeTransparencyProperty {
    pub(crate) value: TimeTransparency,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(TimeTransparencyProperty, TimeTransparency);
pub struct TimeTransparencyPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeTransparencyProperty,
}
impl<P> TimeTransparencyPropertyBuilder<P>
where
    P: AddComponentProperty,
{
14
    pub(crate) fn new(owner: P, value: TimeTransparency) -> TimeTransparencyPropertyBuilder<P> {
14
        TimeTransparencyPropertyBuilder {
14
            owner,
14
            inner: TimeTransparencyProperty {
14
                value,
14
                params: Vec::new(),
14
            },
14
        }
14
    }
    impl_finish_component_property_build!(ComponentProperty::TimeTransparency);
}
impl_other_component_params_builder!(TimeTransparencyPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct UrlProperty {
    // TODO should be a URI
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(UrlProperty, String);
pub struct UrlPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: UrlProperty,
}
impl<P> UrlPropertyBuilder<P>
where
    P: AddComponentProperty,
{
50
    pub(crate) fn new(owner: P, value: String) -> UrlPropertyBuilder<P> {
50
        UrlPropertyBuilder {
50
            owner,
50
            inner: UrlProperty {
50
                value,
50
                params: Vec::new(),
50
            },
50
        }
50
    }
    impl_finish_component_property_build!(ComponentProperty::Url);
}
impl_other_component_params_builder!(UrlPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct RecurrenceIdProperty {
    pub(crate) value: CalendarDateTime,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(RecurrenceIdProperty, CalendarDateTime);
pub struct RecurrenceIdPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RecurrenceIdProperty,
}
impl<P> RecurrenceIdPropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(
38
        owner: P,
38
        date: time::Date,
38
        time: Option<time::Time>,
38
    ) -> RecurrenceIdPropertyBuilder<P> {
38
        let mut params = Vec::new();
38

            
38
        // The default is DATE-TIME. If the time is None, then it is a DATE and although it's
38
        // optional, this will default to setting the value here.
38
        if time.is_none() {
2
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }))
36
        }
38
        RecurrenceIdPropertyBuilder {
38
            owner,
38
            inner: RecurrenceIdProperty {
38
                value: (date, time, false).into(),
38
                params,
38
            },
38
        }
38
    }
    tz_id_param!();
    add_is_utc!();
14
    pub fn add_range(mut self, range: Range) -> Self {
14
        self.inner.params.push(Param::Range(RangeParam { range }));
14
        self
14
    }
    impl_finish_component_property_build!(ComponentProperty::RecurrenceId);
}
impl_other_component_params_builder!(RecurrenceIdPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct RecurrenceRuleProperty {
    pub(crate) value: RecurrenceRule,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(RecurrenceRuleProperty, RecurrenceRule);
pub struct RecurrenceRulePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RecurrenceRuleProperty,
}
impl<P> RecurrenceRulePropertyBuilder<P>
where
    P: AddComponentProperty,
{
62
    pub(crate) fn new(owner: P, rule: RecurrenceRule) -> RecurrenceRulePropertyBuilder<P> {
62
        RecurrenceRulePropertyBuilder {
62
            owner,
62
            inner: RecurrenceRuleProperty {
62
                value: rule,
62
                params: Vec::new(),
62
            },
62
        }
62
    }
    impl_finish_component_property_build!(ComponentProperty::RecurrenceRule);
}
impl_other_component_params_builder!(RecurrenceRulePropertyBuilder<P>);
#[derive(Debug, Clone, PartialEq)]
pub struct DateTimeEndProperty {
    pub(crate) value: CalendarDateTime,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(DateTimeEndProperty, CalendarDateTime);
pub struct DateTimeEndPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: DateTimeEndProperty,
}
impl<P> DateTimeEndPropertyBuilder<P>
where
    P: AddComponentProperty,
{
26
    pub(crate) fn new(
26
        owner: P,
26
        date: time::Date,
26
        time: Option<time::Time>,
26
    ) -> DateTimeEndPropertyBuilder<P> {
26
        let mut params = Vec::new();
26

            
26
        // The default is DATE-TIME. If the time is None, then it is a DATE and although it's
26
        // optional, this will default to setting the value here.
26
        if time.is_none() {
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }))
26
        }
26
        DateTimeEndPropertyBuilder {
26
            owner,
26
            inner: DateTimeEndProperty {
26
                value: (date, time, false).into(),
26
                params,
26
            },
26
        }
26
    }
    add_is_utc!();
    tz_id_param!();
    impl_finish_component_property_build!(ComponentProperty::DateTimeEnd);
}
impl_other_component_params_builder!(DateTimeEndPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct DurationProperty {
    pub(crate) value: Duration,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(DurationProperty, Duration);
pub struct DurationPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: DurationProperty,
}
impl<P> DurationPropertyBuilder<P>
where
    P: AddComponentProperty,
{
30
    pub(crate) fn new(owner: P, duration: Duration) -> DurationPropertyBuilder<P> {
30
        DurationPropertyBuilder {
30
            owner,
30
            inner: DurationProperty {
30
                value: duration,
30
                params: Vec::new(),
30
            },
30
        }
30
    }
    impl_finish_component_property_build!(ComponentProperty::Duration);
}
impl_other_component_params_builder!(DurationPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct AttachProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(AttachProperty, String);
pub struct AttachPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: AttachProperty,
}
impl<P> AttachPropertyBuilder<P>
where
    P: AddComponentProperty,
{
42
    pub(crate) fn new_with_uri(owner: P, uri: String) -> AttachPropertyBuilder<P> {
42
        AttachPropertyBuilder {
42
            owner,
42
            inner: AttachProperty {
42
                value: uri,
42
                params: Vec::new(),
42
            },
42
        }
42
    }
4
    pub(crate) fn new_with_binary(owner: P, binary: String) -> AttachPropertyBuilder<P> {
4
        AttachPropertyBuilder {
4
            owner,
4
            inner: AttachProperty {
4
                value: binary,
4
                params: vec![
4
                    Param::Encoding(EncodingParam {
4
                        encoding: Encoding::Base64,
4
                    }),
4
                    Param::ValueType(ValueTypeParam {
4
                        value: Value::Binary,
4
                    }),
4
                ],
4
            },
4
        }
4
    }
14
    pub fn add_fmt_type<U: ToString, V: ToString>(
14
        mut self,
14
        type_name: U,
14
        sub_type_name: V,
14
    ) -> Self {
14
        self.inner.params.push(Param::FormatType(FormatTypeParam {
14
            type_name: type_name.to_string(),
14
            sub_type_name: sub_type_name.to_string(),
14
        }));
14
        self
14
    }
    impl_finish_component_property_build!(ComponentProperty::Attach);
}
impl_other_component_params_builder!(AttachPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct AttendeeProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(AttendeeProperty, String);
pub struct AttendeePropertyBuilder<P: AddComponentProperty, PS> {
    owner: P,
    inner: AttendeeProperty,
    _phantom: PhantomData<PS>,
}
impl<P, PS> AttendeePropertyBuilder<P, PS>
where
    P: AddComponentProperty,
    PS: Into<ParticipationStatusUnknown>,
{
54
    pub(crate) fn new(owner: P, value: String) -> AttendeePropertyBuilder<P, PS> {
54
        AttendeePropertyBuilder {
54
            owner,
54
            inner: AttendeeProperty {
54
                value,
54
                params: Vec::new(),
54
            },
54
            _phantom: PhantomData,
54
        }
54
    }
12
    pub fn add_calendar_user_type(mut self, cu_type: CalendarUserType) -> Self {
12
        self.inner
12
            .params
12
            .push(Param::CalendarUserType(CalendarUserTypeParam { cu_type }));
12
        self
12
    }
14
    pub fn add_members(mut self, members: Vec<&str>) -> Self {
14
        self.inner.params.push(Param::Members(MembersParam {
14
            members: members.into_iter().map(|m| m.to_string()).collect(),
14
        }));
14
        self
14
    }
12
    pub fn add_role(mut self, role: Role) -> Self {
12
        self.inner.params.push(Param::Role(RoleParam { role }));
12
        self
12
    }
14
    pub fn add_participation_status(mut self, status: PS) -> Self {
14
        self.inner
14
            .params
14
            .push(Param::ParticipationStatus(ParticipationStatusParam {
14
                status: status.into(),
14
            }));
14
        self
14
    }
12
    pub fn add_rsvp(mut self) -> Self {
12
        // Default is false, add to set true
12
        self.inner
12
            .params
12
            .push(Param::Rsvp(RsvpParam { rsvp: true }));
12
        self
12
    }
12
    pub fn add_delegated_to(mut self, delegates: Vec<&str>) -> Self {
12
        self.inner.params.push(Param::DelegatedTo(DelegatedToParam {
12
            delegates: delegates.into_iter().map(|d| d.to_string()).collect(),
12
        }));
12
        self
12
    }
12
    pub fn add_delegated_from(mut self, delegators: Vec<&str>) -> Self {
12
        self.inner
12
            .params
12
            .push(Param::DelegatedFrom(DelegatedFromParam {
12
                delegators: delegators.into_iter().map(|d| d.to_string()).collect(),
12
            }));
12
        self
12
    }
    sent_by_param!();
    common_name_param!();
    directory_entry_reference_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Attendee);
}
impl_other_component_params_builder!(AttendeePropertyBuilder<P, PS>);
#[derive(Debug, PartialEq)]
pub struct CategoriesProperty {
    pub(crate) value: Vec<String>,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(CategoriesProperty, Vec<String>);
pub struct CategoriesPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: CategoriesProperty,
}
impl<P> CategoriesPropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(owner: P, value: Vec<String>) -> CategoriesPropertyBuilder<P> {
38
        CategoriesPropertyBuilder {
38
            owner,
38
            inner: CategoriesProperty {
38
                value,
38
                params: Vec::new(),
38
            },
38
        }
38
    }
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Categories);
}
impl_other_component_params_builder!(CategoriesPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct CommentProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(CommentProperty, String);
pub struct CommentPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: CommentProperty,
}
impl<P> CommentPropertyBuilder<P>
where
    P: AddComponentProperty,
{
26
    pub(crate) fn new(owner: P, value: String) -> CommentPropertyBuilder<P> {
26
        CommentPropertyBuilder {
26
            owner,
26
            inner: CommentProperty {
26
                value,
26
                params: Vec::new(),
26
            },
26
        }
26
    }
    altrep_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Comment);
}
impl_other_component_params_builder!(CommentPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct ContactProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(ContactProperty, String);
pub struct ContactPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: ContactProperty,
}
impl<P> ContactPropertyBuilder<P>
where
    P: AddComponentProperty,
{
18
    pub(crate) fn new(owner: P, value: String) -> ContactPropertyBuilder<P> {
18
        ContactPropertyBuilder {
18
            owner,
18
            inner: ContactProperty {
18
                value,
18
                params: Vec::new(),
18
            },
18
        }
18
    }
    altrep_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Contact);
}
impl_other_component_params_builder!(ContactPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct ExceptionDateTimesProperty {
    pub(crate) value: Vec<CalendarDateTime>,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(ExceptionDateTimesProperty, Vec<CalendarDateTime>);
pub struct ExceptionDateTimesPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: ExceptionDateTimesProperty,
}
impl<P> ExceptionDateTimesPropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(owner: P, date_times: Vec<CalendarDateTime>) -> Self {
38
        let mut params = Vec::new();
38
        if date_times.first().map(|dt| dt.is_date()).unwrap_or(false) {
2
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }));
38
        }
38
        ExceptionDateTimesPropertyBuilder {
38
            owner,
38
            inner: ExceptionDateTimesProperty {
38
                value: date_times,
38
                params,
38
            },
38
        }
38
    }
    tz_id_param!();
    impl_finish_component_property_build!(ComponentProperty::ExceptionDateTimes);
}
impl_other_component_params_builder!(ExceptionDateTimesPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct StatusProperty {
    pub(crate) value: Status,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(StatusProperty, Status);
pub struct StatusPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: StatusProperty,
}
impl<P> StatusPropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(owner: P, value: Status) -> StatusPropertyBuilder<P> {
38
        StatusPropertyBuilder {
38
            owner,
38
            inner: StatusProperty {
38
                value,
38
                params: Vec::new(),
38
            },
38
        }
38
    }
    impl_finish_component_property_build!(ComponentProperty::Status);
}
impl_other_component_params_builder!(StatusPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct RelatedToProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(RelatedToProperty, String);
pub struct RelatedToPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RelatedToProperty,
}
impl<P> RelatedToPropertyBuilder<P>
where
    P: AddComponentProperty,
{
38
    pub(crate) fn new(owner: P, value: String) -> RelatedToPropertyBuilder<P> {
38
        RelatedToPropertyBuilder {
38
            owner,
38
            inner: RelatedToProperty {
38
                value,
38
                params: Vec::new(),
38
            },
38
        }
38
    }
14
    pub fn add_relationship_type(mut self, relationship_type: RelationshipType) -> Self {
14
        self.inner
14
            .params
14
            .push(Param::RelationshipType(RelationshipTypeParam {
14
                relationship: relationship_type,
14
            }));
14
        self
14
    }
    impl_finish_component_property_build!(ComponentProperty::RelatedTo);
}
impl_other_component_params_builder!(RelatedToPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct ResourcesProperty {
    pub(crate) value: Vec<String>,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(ResourcesProperty, Vec<String>);
pub struct ResourcesPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: ResourcesProperty,
}
impl<P> ResourcesPropertyBuilder<P>
where
    P: AddComponentProperty,
{
26
    pub(crate) fn new(owner: P, value: Vec<String>) -> ResourcesPropertyBuilder<P> {
26
        ResourcesPropertyBuilder {
26
            owner,
26
            inner: ResourcesProperty {
26
                value,
26
                params: Vec::new(),
26
            },
26
        }
26
    }
    altrep_param!();
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::Resources);
}
impl_other_component_params_builder!(ResourcesPropertyBuilder<P>);
#[derive(Clone, Debug, PartialEq)]
pub struct Period {
    pub start: (time::Date, time::Time, bool),
    pub end: PeriodEnd,
}
impl Period {
12
    pub fn new_explicit(
12
        start_date: time::Date,
12
        start_time: time::Time,
12
        end_date: time::Date,
12
        end_time: time::Time,
12
        is_utc: bool,
12
    ) -> Self {
12
        Period {
12
            start: (start_date, start_time, is_utc),
12
            end: PeriodEnd::DateTime((end_date, end_time, is_utc)),
12
        }
12
    }
14
    pub fn new_start(
14
        start_date: time::Date,
14
        start_time: time::Time,
14
        is_utc: bool,
14
        duration: Duration,
14
    ) -> Self {
14
        Period {
14
            start: (start_date, start_time, is_utc),
14
            end: PeriodEnd::Duration(duration),
14
        }
14
    }
12
    pub fn expand(&self) -> AetoliaResult<Option<(CalendarDateTime, CalendarDateTime)>> {
12
        if self.start.2 {
            Ok(Some((
12
                self.start.into(),
12
                match &self.end {
6
                    PeriodEnd::DateTime(end) => (*end).into(),
6
                    PeriodEnd::Duration(duration) => {
6
                        let cdt: CalendarDateTime = self.start.into();
6
                        cdt.add(duration)?
                    }
                },
            )))
        } else {
            Ok(None)
        }
12
    }
}
#[derive(Clone, Debug, PartialEq)]
pub enum PeriodEnd {
    DateTime((time::Date, time::Time, bool)),
    Duration(Duration),
}
#[derive(Debug, PartialEq)]
pub struct RecurrenceDateTimesProperty {
    pub(crate) value: RecurrenceDateTimesPropertyValue,
    pub(crate) params: Vec<Param>,
}
#[derive(Debug, PartialEq)]
pub enum RecurrenceDateTimesPropertyValue {
    DateTimes(Vec<CalendarDateTime>),
    Periods(Vec<Period>),
}
impl_property_access!(
    RecurrenceDateTimesProperty,
    RecurrenceDateTimesPropertyValue
);
pub struct RecurrenceDateTimesPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RecurrenceDateTimesProperty,
}
impl<P> RecurrenceDateTimesPropertyBuilder<P>
where
    P: AddComponentProperty,
{
60
    pub fn new_date_times(owner: P, date_times: Vec<CalendarDateTime>) -> Self {
60
        let mut params = Vec::new();
60
        if date_times.first().map(|dt| dt.is_date()).unwrap_or(false) {
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }));
60
        }
60
        RecurrenceDateTimesPropertyBuilder {
60
            owner,
60
            inner: RecurrenceDateTimesProperty {
60
                value: RecurrenceDateTimesPropertyValue::DateTimes(date_times),
60
                params,
60
            },
60
        }
60
    }
2
    pub fn new_periods(owner: P, periods: Vec<Period>) -> Self {
2
        RecurrenceDateTimesPropertyBuilder {
2
            owner,
2
            inner: RecurrenceDateTimesProperty {
2
                value: RecurrenceDateTimesPropertyValue::Periods(periods),
2
                params: vec![Param::ValueType(ValueTypeParam {
2
                    value: Value::Period,
2
                })],
2
            },
2
        }
2
    }
    tz_id_param!();
    impl_finish_component_property_build!(ComponentProperty::RecurrenceDateTimes);
}
impl_other_component_params_builder!(RecurrenceDateTimesPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct DateTimeCompletedProperty {
    pub(crate) value: CalendarDateTime,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(DateTimeCompletedProperty, CalendarDateTime);
pub struct CompletedPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: DateTimeCompletedProperty,
}
impl<P> CompletedPropertyBuilder<P>
where
    P: AddComponentProperty,
{
12
    pub(crate) fn new(owner: P, date: time::Date, time: time::Time) -> CompletedPropertyBuilder<P> {
12
        CompletedPropertyBuilder {
12
            owner,
12
            inner: DateTimeCompletedProperty {
12
                value: (date, time, false).into(),
12
                params: Vec::new(),
12
            },
12
        }
12
    }
    add_is_utc!();
    impl_finish_component_property_build!(ComponentProperty::DateTimeCompleted);
}
impl_other_component_params_builder!(CompletedPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct PercentCompleteProperty {
    pub(crate) value: u8,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(PercentCompleteProperty, u8);
pub struct PercentCompletePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: PercentCompleteProperty,
}
impl<P> PercentCompletePropertyBuilder<P>
where
    P: AddComponentProperty,
{
12
    pub(crate) fn new(owner: P, value: u8) -> PercentCompletePropertyBuilder<P> {
12
        PercentCompletePropertyBuilder {
12
            owner,
12
            inner: PercentCompleteProperty {
12
                value,
12
                params: Vec::new(),
12
            },
12
        }
12
    }
    impl_finish_component_property_build!(ComponentProperty::PercentComplete);
}
impl_other_component_params_builder!(PercentCompletePropertyBuilder<P>);
#[derive(Debug, Clone, PartialEq)]
pub struct DateTimeDueProperty {
    pub(crate) value: CalendarDateTime,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(DateTimeDueProperty, CalendarDateTime);
pub struct DateTimeDuePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: DateTimeDueProperty,
}
impl<P> DateTimeDuePropertyBuilder<P>
where
    P: AddComponentProperty,
{
    pub(crate) fn new(
        owner: P,
        date: time::Date,
        time: Option<time::Time>,
    ) -> DateTimeDuePropertyBuilder<P> {
        let mut params = Vec::new();
        // The default is DATE-TIME. If the time is None, then it is a DATE and although it's
        // optional, this will default to setting the value here.
        if time.is_none() {
            params.push(Param::ValueType(ValueTypeParam { value: Value::Date }))
        }
        DateTimeDuePropertyBuilder {
            owner,
            inner: DateTimeDueProperty {
                value: (date, time, false).into(),
                params,
            },
        }
    }
    tz_id_param!();
    add_is_utc!();
    impl_finish_component_property_build!(ComponentProperty::DateTimeDue);
}
impl_other_component_params_builder!(DateTimeDuePropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct FreeBusyTimeProperty {
    pub(crate) value: Vec<Period>,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(FreeBusyTimeProperty, Vec<Period>);
pub struct FreeBusyTimePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: FreeBusyTimeProperty,
}
impl<P> FreeBusyTimePropertyBuilder<P>
where
    P: AddComponentProperty,
{
12
    pub(crate) fn new(
12
        owner: P,
12
        free_busy_time_type: FreeBusyTimeType,
12
        value: Vec<Period>,
12
    ) -> FreeBusyTimePropertyBuilder<P> {
12
        FreeBusyTimePropertyBuilder {
12
            owner,
12
            inner: FreeBusyTimeProperty {
12
                value,
12
                params: vec![Param::FreeBusyTimeType(FreeBusyTimeTypeParam {
12
                    fb_type: free_busy_time_type,
12
                })],
12
            },
12
        }
12
    }
    impl_finish_component_property_build!(ComponentProperty::FreeBusyTime);
}
impl_other_component_params_builder!(FreeBusyTimePropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeZoneIdProperty {
    pub(crate) value: TimeZoneIdPropertyValue,
    pub(crate) params: Vec<Param>,
}
#[derive(Debug, Clone, PartialEq)]
pub struct TimeZoneIdPropertyValue {
    pub id: String,
    pub unique_registry_id: bool,
}
impl_property_access!(TimeZoneIdProperty, TimeZoneIdPropertyValue);
pub struct TimeZoneIdPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeZoneIdProperty,
}
impl<P> TimeZoneIdPropertyBuilder<P>
where
    P: AddComponentProperty,
{
12
    pub(crate) fn new(
12
        owner: P,
12
        value: String,
12
        unique_registry_id: bool,
12
    ) -> TimeZoneIdPropertyBuilder<P> {
12
        TimeZoneIdPropertyBuilder {
12
            owner,
12
            inner: TimeZoneIdProperty {
12
                value: TimeZoneIdPropertyValue {
12
                    id: value,
12
                    unique_registry_id,
12
                },
12
                params: Vec::new(),
12
            },
12
        }
12
    }
    impl_finish_component_property_build!(ComponentProperty::TimeZoneId);
}
impl_other_component_params_builder!(TimeZoneIdPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeZoneUrlProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(TimeZoneUrlProperty, String);
pub struct TimeZoneUrlPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeZoneUrlProperty,
}
impl<P> TimeZoneUrlPropertyBuilder<P>
where
    P: AddComponentProperty,
{
12
    pub(crate) fn new(owner: P, value: String) -> TimeZoneUrlPropertyBuilder<P> {
12
        TimeZoneUrlPropertyBuilder {
12
            owner,
12
            inner: TimeZoneUrlProperty {
12
                value,
12
                params: Vec::new(),
12
            },
12
        }
12
    }
    impl_finish_component_property_build!(ComponentProperty::TimeZoneUrl);
}
impl_other_component_params_builder!(TimeZoneUrlPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeZoneOffset {
    pub(crate) sign: i8,
    pub(crate) hours: u8,
    pub(crate) minutes: u8,
    pub(crate) seconds: Option<u8>,
}
impl TimeZoneOffset {
48
    pub fn new(sign: i8, hours: u8, minutes: u8, seconds: Option<u8>) -> Self {
48
        TimeZoneOffset {
48
            sign,
48
            hours,
48
            minutes,
48
            seconds,
48
        }
48
    }
}
#[derive(Debug, PartialEq)]
pub struct TimeZoneOffsetToProperty {
    pub(crate) value: TimeZoneOffset,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(TimeZoneOffsetToProperty, TimeZoneOffset);
pub struct TimeZoneOffsetToPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeZoneOffsetToProperty,
}
impl<P> TimeZoneOffsetToPropertyBuilder<P>
where
    P: AddComponentProperty,
{
24
    pub(crate) fn new(owner: P, offset: TimeZoneOffset) -> TimeZoneOffsetToPropertyBuilder<P> {
24
        TimeZoneOffsetToPropertyBuilder {
24
            owner,
24
            inner: TimeZoneOffsetToProperty {
24
                value: offset,
24
                params: Vec::new(),
24
            },
24
        }
24
    }
    impl_finish_component_property_build!(ComponentProperty::TimeZoneOffsetTo);
}
impl_other_component_params_builder!(TimeZoneOffsetToPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeZoneOffsetFromProperty {
    pub(crate) value: TimeZoneOffset,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(TimeZoneOffsetFromProperty, TimeZoneOffset);
pub struct TimeZoneOffsetFromPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeZoneOffsetFromProperty,
}
impl<P> TimeZoneOffsetFromPropertyBuilder<P>
where
    P: AddComponentProperty,
{
24
    pub(crate) fn new(owner: P, offset: TimeZoneOffset) -> TimeZoneOffsetFromPropertyBuilder<P> {
24
        TimeZoneOffsetFromPropertyBuilder {
24
            owner,
24
            inner: TimeZoneOffsetFromProperty {
24
                value: offset,
24
                params: Vec::new(),
24
            },
24
        }
24
    }
    impl_finish_component_property_build!(ComponentProperty::TimeZoneOffsetFrom);
}
impl_other_component_params_builder!(TimeZoneOffsetFromPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct TimeZoneNameProperty {
    pub(crate) value: String,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(TimeZoneNameProperty, String);
pub struct TimeZoneNamePropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: TimeZoneNameProperty,
}
impl<P> TimeZoneNamePropertyBuilder<P>
where
    P: AddComponentProperty,
{
24
    pub(crate) fn new(owner: P, value: String) -> TimeZoneNamePropertyBuilder<P> {
24
        TimeZoneNamePropertyBuilder {
24
            owner,
24
            inner: TimeZoneNameProperty {
24
                value,
24
                params: Vec::new(),
24
            },
24
        }
24
    }
    language_param!();
    impl_finish_component_property_build!(ComponentProperty::TimeZoneName);
}
impl_other_component_params_builder!(TimeZoneNamePropertyBuilder<P>);
#[derive(Debug, Clone, PartialEq)]
pub enum Action {
    Audio,
    Display,
    Email,
    XName(String),
    IanaToken(String),
}
#[derive(Debug, PartialEq)]
pub struct ActionProperty {
    pub(crate) value: Action,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(ActionProperty, Action);
pub struct ActionPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: ActionProperty,
}
impl<P> ActionPropertyBuilder<P>
where
    P: AddComponentProperty,
{
16
    pub(crate) fn new(owner: P, value: Action) -> ActionPropertyBuilder<P> {
16
        ActionPropertyBuilder {
16
            owner,
16
            inner: ActionProperty {
16
                value,
16
                params: Vec::new(),
16
            },
16
        }
16
    }
    impl_finish_component_property_build!(ComponentProperty::Action);
}
impl_other_component_params_builder!(ActionPropertyBuilder<P>);
#[derive(Debug)]
pub struct RelativeTriggerProperty {
    pub(crate) value: Duration,
    pub(crate) params: Vec<Param>,
}
pub struct RelativeTriggerPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RelativeTriggerProperty,
}
impl<P> RelativeTriggerPropertyBuilder<P>
where
    P: AddComponentProperty,
{
8
    pub(crate) fn new(owner: P, value: Duration) -> RelativeTriggerPropertyBuilder<P> {
8
        RelativeTriggerPropertyBuilder {
8
            owner,
8
            inner: RelativeTriggerProperty {
8
                value,
8
                params: Vec::new(),
8
            },
8
        }
8
    }
4
    pub fn add_trigger_relationship(mut self, trigger_relationship: TriggerRelationship) -> Self {
4
        self.inner
4
            .params
4
            .push(Param::TriggerRelationship(TriggerRelationshipParam {
4
                trigger_relationship,
4
            }));
4
        self
4
    }
8
    pub fn finish_property(mut self) -> P {
8
        self.owner
8
            .add_property(ComponentProperty::Trigger(TriggerProperty {
8
                value: TriggerValue::Relative(self.inner.value),
8
                params: self.inner.params,
8
            }));
8
        self.owner
8
    }
}
impl_other_component_params_builder!(RelativeTriggerPropertyBuilder<P>);
#[derive(Debug)]
pub(crate) struct AbsoluteTriggerProperty {
    pub(crate) value: CalendarDateTime,
    pub(crate) params: Vec<Param>,
}
pub struct AbsoluteTriggerPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: AbsoluteTriggerProperty,
}
impl<P> AbsoluteTriggerPropertyBuilder<P>
where
    P: AddComponentProperty,
{
8
    pub(crate) fn new(
8
        owner: P,
8
        date: time::Date,
8
        time: time::Time,
8
    ) -> AbsoluteTriggerPropertyBuilder<P> {
8
        AbsoluteTriggerPropertyBuilder {
8
            owner,
8
            inner: AbsoluteTriggerProperty {
8
                value: (date, time, false).into(),
8
                params: vec![Param::ValueType(ValueTypeParam {
8
                    value: Value::DateTime,
8
                })],
8
            },
8
        }
8
    }
    add_is_utc!();
8
    pub fn finish_property(mut self) -> P {
8
        self.owner
8
            .add_property(ComponentProperty::Trigger(TriggerProperty {
8
                value: TriggerValue::Absolute(self.inner.value),
8
                params: self.inner.params,
8
            }));
8
        self.owner
8
    }
}
impl_other_component_params_builder!(AbsoluteTriggerPropertyBuilder<P>);
#[derive(Debug, PartialEq)]
pub struct RepeatProperty {
    pub(crate) value: u32,
    pub(crate) params: Vec<Param>,
}
impl_property_access!(RepeatProperty, u32);
pub struct RepeatPropertyBuilder<P: AddComponentProperty> {
    owner: P,
    inner: RepeatProperty,
}
impl<P> RepeatPropertyBuilder<P>
where
    P: AddComponentProperty,
{
16
    pub(crate) fn new(owner: P, value: u32) -> RepeatPropertyBuilder<P> {
16
        RepeatPropertyBuilder {
16
            owner,
16
            inner: RepeatProperty {
16
                value,
16
                params: Vec::new(),
16
            },
16
        }
16
    }
    impl_finish_component_property_build!(ComponentProperty::Repeat);
}
impl_other_component_params_builder!(RepeatPropertyBuilder<P>);