use std::collections::HashMap;
use jmap_types::Id;
use serde::{Deserialize, Serialize};
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AddressBookRights {
pub may_read: bool,
pub may_write: bool,
pub may_share: bool,
pub may_delete: bool,
#[serde(flatten, default, skip_serializing_if = "serde_json::Map::is_empty")]
pub extra: serde_json::Map<String, serde_json::Value>,
}
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AddressBook {
pub id: Id,
pub name: String,
#[serde(default)]
pub description: Option<String>,
pub sort_order: u32,
pub is_default: bool,
pub is_subscribed: bool,
#[serde(default)]
pub share_with: Option<HashMap<Id, AddressBookRights>>,
pub my_rights: AddressBookRights,
#[serde(flatten, default, skip_serializing_if = "serde_json::Map::is_empty")]
pub extra: serde_json::Map<String, serde_json::Value>,
}