rustical_caldav/principal/
prop.rs1use rustical_dav::{
2 extensions::CommonPropertiesProp,
3 xml::{GroupMemberSet, GroupMembership, HrefElement, SupportedReportSet},
4};
5use rustical_store::auth::PrincipalType;
6use rustical_xml::{EnumVariants, PropName, XmlDeserialize, XmlSerialize};
7use strum_macros::VariantArray;
8
9#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
10#[xml(unit_variants_ident = "PrincipalPropName")]
11pub enum PrincipalProp {
12 #[xml(ns = "rustical_dav::namespace::NS_CALDAV", skip_deserializing)]
14 CalendarUserType(PrincipalType),
15 #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
16 CalendarUserAddressSet(HrefElement),
17
18 #[xml(ns = "rustical_dav::namespace::NS_DAV", rename = "principal-URL")]
20 PrincipalUrl(HrefElement),
21 #[xml(ns = "rustical_dav::namespace::NS_DAV")]
22 GroupMembership(GroupMembership),
23 #[xml(ns = "rustical_dav::namespace::NS_DAV")]
24 GroupMemberSet(GroupMemberSet),
25 #[xml(ns = "rustical_dav::namespace::NS_DAV", rename = "alternate-URI-set")]
26 AlternateUriSet,
27 #[xml(ns = "rustical_dav::namespace::NS_DAV", skip_deserializing)]
30 SupportedReportSet(SupportedReportSet<ReportMethod>),
31
32 #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
34 CalendarHomeSet(CalendarHomeSet),
35}
36
37#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, Debug)]
38pub struct CalendarHomeSet(#[xml(ty = "untagged", flatten)] pub Vec<HrefElement>);
39
40#[derive(XmlDeserialize, XmlSerialize, PartialEq, Eq, Clone, EnumVariants, PropName, Debug)]
41#[xml(unit_variants_ident = "PrincipalPropWrapperName", untagged)]
42pub enum PrincipalPropWrapper {
43 Principal(PrincipalProp),
44 Common(CommonPropertiesProp),
45}
46
47#[derive(XmlSerialize, PartialEq, Eq, Debug, Clone, VariantArray)]
48pub enum ReportMethod {
49 #[xml(ns = "rustical_dav::namespace::NS_DAV")]
51 PrincipalMatch,
52}