use crabstep::deserializer::iter::Property;
#[derive(Debug, PartialEq, Default, Clone)]
pub struct AttachmentMeta {
pub guid: Option<String>,
pub transcription: Option<String>,
pub height: Option<f64>,
pub width: Option<f64>,
pub name: Option<String>,
}
impl AttachmentMeta {
pub(crate) fn set_from_key_value<'a>(&mut self, key: &str, value: &Property<'a, 'a>) {
match key {
"__kIMFileTransferGUIDAttributeName" => {
self.guid = value.as_string().map(String::from);
}
"IMAudioTranscription" => self.transcription = value.as_string().map(String::from),
"__kIMInlineMediaHeightAttributeName" => self.height = value.as_f64(),
"__kIMInlineMediaWidthAttributeName" => self.width = value.as_f64(),
"__kIMFilenameAttributeName" => self.name = value.as_string().map(String::from),
_ => {}
}
}
}