use ruma_common::OwnedEventId;
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use crate::relation::Reference;
#[derive(Clone, Debug, Serialize, Deserialize, EventContent)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[ruma_event(type = "org.matrix.msc3381.poll.end", kind = MessageLike)]
pub struct UnstablePollEndEventContent {
#[serde(rename = "org.matrix.msc1767.text")]
pub text: String,
#[serde(default, rename = "org.matrix.msc3381.poll.end")]
pub poll_end: UnstablePollEndContentBlock,
#[serde(rename = "m.relates_to")]
pub relates_to: Reference,
}
impl UnstablePollEndEventContent {
pub fn new(text: impl Into<String>, poll_start_id: OwnedEventId) -> Self {
Self {
text: text.into(),
poll_end: UnstablePollEndContentBlock {},
relates_to: Reference::new(poll_start_id),
}
}
}
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
pub struct UnstablePollEndContentBlock {}