use crate::{
events::{EventId, EventTitle, MeetingDetails},
rooms::RoomId,
utils::ExampleData,
};
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(
feature = "utoipa",
derive(utoipa::ToSchema),
schema(example = json!(EventInfo::example_data())),
)]
pub struct EventInfo {
pub id: EventId,
pub room_id: RoomId,
pub title: EventTitle,
pub is_adhoc: bool,
#[cfg_attr(feature = "utoipa", schema(nullable = false))]
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
pub meeting_details: Option<MeetingDetails>,
pub e2e_encryption: bool,
}
impl EventInfo {
pub fn with_meeting_details(self, meeting_details: MeetingDetails) -> EventInfo {
EventInfo {
meeting_details: Some(meeting_details),
..self
}
}
}
impl ExampleData for EventInfo {
fn example_data() -> Self {
Self {
id: EventId::example_data(),
room_id: RoomId::example_data(),
title: EventTitle::example_data(),
is_adhoc: false,
meeting_details: Some(MeetingDetails::example_data()),
e2e_encryption: false,
}
}
}