Skip to main content

ics_core/profile/
icloud.rs

1//! Apple / iCloud profile bundle (`X-APPLE-*`, `X-CALENDARSERVER-*`).
2//!
3//! Skeleton for ADR-001 Migration Step 7: prefix registration and an
4//! empty `EventExtensions` whose `unrecognized` slot captures everything
5//! the parser routes here. Typed fields land in subsequent steps when a
6//! concrete use case demands them.
7
8use serde::Serialize;
9
10use crate::raw::RawProperty;
11
12/// Property name prefixes owned by this profile. Longest match wins per
13/// ADR-001 rule 3.
14pub const PREFIXES: &[&str] = &["X-APPLE-", "X-CALENDARSERVER-"];
15
16/// True if `name` starts with any of this profile's registered prefixes.
17pub fn owns_property(name: &str) -> bool {
18    super::matches_prefixes(name, PREFIXES)
19}
20
21/// Apple / iCloud event-level extension bundle (ADR-001 Option B).
22///
23/// No typed fields yet — every prefix-matched property lands in
24/// `unrecognized` until a typed field is introduced.
25#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize)]
26pub struct EventExtensions {
27    #[serde(skip_serializing_if = "Vec::is_empty")]
28    pub unrecognized: Vec<RawProperty>,
29}