1use crate::components::Parameter;
22use std::borrow::Cow;
23
24parameter!(AltRep, "ALTREP");
25parameter!(CN, "CN");
26parameter!(CUType, "CUTYPE");
27parameter!(DelegatedFrom, "DELEGATED-FROM");
28parameter!(DelegatedTo, "DELEGATED-TO");
29parameter!(Dir, "DIR");
30parameter!(FmtType, "FMTTYPE");
31parameter!(FBType, "FBTYPE");
32parameter!(Language, "LANGUAGE");
33parameter!(Member, "MEMBER");
34parameter!(PartStat, "PARTSTAT");
35parameter!(RelType, "RELTYPE");
36parameter!(Role, "ROLE");
37parameter!(SentBy, "SENT-BY");
38parameter!(TzIDParam, "TZID");
39parameter!(Value, "VALUE");
40
41impl CUType<'_> {
42 pub const INDIVIDUAL: Self = Self {
44 value: Cow::Borrowed("INDIVIDUAL"),
45 };
46
47 pub const GROUP: Self = Self {
49 value: Cow::Borrowed("GROUP"),
50 };
51
52 pub const RESOURCE: Self = Self {
54 value: Cow::Borrowed("RESOURCE"),
55 };
56
57 pub const ROOM: Self = Self {
59 value: Cow::Borrowed("ROOM"),
60 };
61
62 pub const UNKNOWN: Self = Self {
64 value: Cow::Borrowed("UNKNOWN"),
65 };
66}
67
68impl FBType<'_> {
69 pub const FREE: Self = Self {
71 value: Cow::Borrowed("FREE"),
72 };
73
74 pub const BUSY: Self = Self {
76 value: Cow::Borrowed("BUSY"),
77 };
78
79 pub const BUSY_UNAVAILABLE: Self = Self {
81 value: Cow::Borrowed("BUSY-UNAVAILABLE"),
82 };
83
84 pub const BUSY_TENTATIVE: Self = Self {
86 value: Cow::Borrowed("BUSY-TENTATIVE"),
87 };
88}
89
90impl PartStat<'_> {
91 pub const NEEDS_ACTION: Self = Self {
93 value: Cow::Borrowed("NEEDS-ACTION"),
94 };
95
96 pub const ACCEPTED: Self = Self {
98 value: Cow::Borrowed("ACCEPTED"),
99 };
100
101 pub const DECLINED: Self = Self {
103 value: Cow::Borrowed("DECLINED"),
104 };
105
106 pub const TENTATIVE: Self = Self {
108 value: Cow::Borrowed("TENTATIVE"),
109 };
110
111 pub const DELEGATED: Self = Self {
113 value: Cow::Borrowed("DELEGATED"),
114 };
115
116 pub const COMPLETED: Self = Self {
118 value: Cow::Borrowed("COMPLETED"),
119 };
120
121 pub const IN_PROCESS: Self = Self {
123 value: Cow::Borrowed("IN-PROCESS"),
124 };
125}
126
127impl RelType<'_> {
128 pub const PARENT: Self = Self {
130 value: Cow::Borrowed("PARENT"),
131 };
132
133 pub const CHILD: Self = Self {
135 value: Cow::Borrowed("CHILD"),
136 };
137
138 const SIBLING: Self = Self {
140 value: Cow::Borrowed("SIBLING"),
141 };
142
143 pub const SILBLING: Self = Self::SIBLING;
146}
147
148impl Role<'_> {
149 pub const CHAIR: Self = Self {
151 value: Cow::Borrowed("CHAIR"),
152 };
153
154 pub const REQ_PARTICIPANT: Self = Self {
156 value: Cow::Borrowed("REQ-PARTICIPANT"),
157 };
158
159 pub const OPT_PARTICIPANT: Self = Self {
161 value: Cow::Borrowed("OPT-PARTICIPANT"),
162 };
163
164 pub const NON_PARTICIPANT: Self = Self {
166 value: Cow::Borrowed("NON-PARTICIPANT"),
167 };
168}
169
170impl Value<'_> {
171 pub const BINARY: Self = Self {
173 value: Cow::Borrowed("BINARY"),
174 };
175
176 pub const BOOLEAN: Self = Self {
178 value: Cow::Borrowed("BOOLEAN"),
179 };
180
181 pub const CAL_ADDRESS: Self = Self {
183 value: Cow::Borrowed("CAL-ADDRESS"),
184 };
185
186 pub const DATE: Self = Self {
188 value: Cow::Borrowed("DATE"),
189 };
190
191 pub const DATE_TIME: Self = Self {
193 value: Cow::Borrowed("DATE-TIME"),
194 };
195
196 pub const DURATION: Self = Self {
198 value: Cow::Borrowed("DURATION"),
199 };
200
201 pub const FLOAT: Self = Self {
203 value: Cow::Borrowed("FLOAT"),
204 };
205
206 pub const INTEGER: Self = Self {
208 value: Cow::Borrowed("INTEGER"),
209 };
210
211 pub const PERIOD: Self = Self {
213 value: Cow::Borrowed("PERIOD"),
214 };
215
216 pub const RECUR: Self = Self {
218 value: Cow::Borrowed("RECUR"),
219 };
220
221 pub const TEXT: Self = Self {
223 value: Cow::Borrowed("TEXT"),
224 };
225
226 pub const TIME: Self = Self {
228 value: Cow::Borrowed("TIME"),
229 };
230
231 pub const URI: Self = Self {
233 value: Cow::Borrowed("URI"),
234 };
235
236 pub const UTC_OFFSET: Self = Self {
238 value: Cow::Borrowed("UTC-OFFSET"),
239 };
240}
241
242impl Default for CUType<'_> {
243 fn default() -> Self {
244 Self::INDIVIDUAL
245 }
246}
247
248impl Default for FBType<'_> {
249 fn default() -> Self {
250 Self::BUSY
251 }
252}
253
254impl Default for PartStat<'_> {
255 fn default() -> Self {
256 PartStat::NEEDS_ACTION
257 }
258}
259
260impl Default for RelType<'_> {
261 fn default() -> Self {
262 Self::PARENT
263 }
264}
265
266impl Default for Role<'_> {
267 fn default() -> Self {
268 Self::REQ_PARTICIPANT
269 }
270}
271
272#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
274pub enum Encoding {
275 Byte,
277 Base64,
279}
280
281impl<'a> From<Encoding> for Parameter<'a> {
282 fn from(builder: Encoding) -> Self {
283 Parameter {
284 key: "ENCODING".into(),
285 value: match builder {
286 Encoding::Byte => Cow::Borrowed("8BIT"),
287 Encoding::Base64 => Cow::Borrowed("BASE64"),
288 },
289 }
290 }
291}
292
293impl Default for Encoding {
294 fn default() -> Self {
295 Encoding::Byte
296 }
297}
298
299#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
301pub enum Range {
302 ThisAndFuture,
304}
305
306impl<'a> From<Range> for Parameter<'a> {
307 fn from(builder: Range) -> Self {
308 Parameter {
309 key: "RANGE".into(),
310 value: match builder {
311 Range::ThisAndFuture => Cow::Borrowed("THISANDFUTURE"),
312 },
313 }
314 }
315}
316
317impl Default for Range {
318 fn default() -> Self {
319 Range::ThisAndFuture
320 }
321}
322
323#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
325pub enum Related {
326 Start,
328 End,
330}
331
332impl<'a> From<Related> for Parameter<'a> {
333 fn from(builder: Related) -> Self {
334 Parameter {
335 key: "RELATED".into(),
336 value: match builder {
337 Related::Start => Cow::Borrowed("START"),
338 Related::End => Cow::Borrowed("END"),
339 },
340 }
341 }
342}
343
344impl Default for Related {
345 fn default() -> Self {
346 Related::Start
347 }
348}
349
350#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
352pub enum RSVP {
353 True,
355 False,
357}
358
359impl<'a> From<RSVP> for Parameter<'a> {
360 fn from(builder: RSVP) -> Self {
361 Parameter {
362 key: "RSVP".into(),
363 value: match builder {
364 RSVP::True => Cow::Borrowed("TRUE"),
365 RSVP::False => Cow::Borrowed("FALSE"),
366 },
367 }
368 }
369}
370
371impl Default for RSVP {
372 fn default() -> Self {
373 RSVP::False
374 }
375}
376
377#[cfg(feature = "rfc7986")]
378pub use self::rfc7986::*;
379
380#[cfg(feature = "rfc7986")]
381mod rfc7986 {
382 use crate::components::Parameter;
383 use std::borrow::Cow;
384
385 parameter!(Display, "DISPLAY");
386 parameter!(Email, "EMAIL");
387 parameter!(Feature, "FEATURE");
388 parameter!(Label, "LABEL");
389
390 impl Display<'_> {
391 pub const BADGE: Self = Self {
393 value: Cow::Borrowed("BADGE"),
394 };
395
396 pub const GRAPHIC: Self = Self {
398 value: Cow::Borrowed("GRAPHIC"),
399 };
400
401 pub const FULLSIZE: Self = Self {
403 value: Cow::Borrowed("FULLSIZE"),
404 };
405
406 pub const THUMBNAIL: Self = Self {
408 value: Cow::Borrowed("THUMBNAIL"),
409 };
410 }
411
412 impl Feature<'_> {
413 pub const AUDIO: Self = Self {
415 value: Cow::Borrowed("AUDIO"),
416 };
417
418 pub const CHAT: Self = Self {
420 value: Cow::Borrowed("CHAT"),
421 };
422
423 pub const FEED: Self = Self {
425 value: Cow::Borrowed("FEED"),
426 };
427
428 pub const MODERATOR: Self = Self {
430 value: Cow::Borrowed("MODERATOR"),
431 };
432
433 pub const PHONE: Self = Self {
435 value: Cow::Borrowed("PHONE"),
436 };
437
438 pub const SCREEN: Self = Self {
440 value: Cow::Borrowed("SCREEN"),
441 };
442
443 pub const VIDEO: Self = Self {
445 value: Cow::Borrowed("VIDEO"),
446 };
447 }
448
449 impl<'a> Default for Display<'a> {
450 fn default() -> Self {
451 Self::BADGE
452 }
453 }
454}