use super::*;
use crate::link::ExternalLink;
#[derive(Debug, Serialize, Deserialize)]
pub struct ProjLink {
#[serde(rename = "_id", skip_serializing_if = "Option::is_none")]
id: Option<ObjectId>,
singleton: bool,
#[serde(rename = "web_page_v2")]
pub web_page: Option<Vec<ExternalLink>>,
}
impl Default for ProjLink {
fn default() -> Self {
Self {
id: None,
singleton: true,
web_page: Some(vec![]),
}
}
}
impl BsonId for ProjLink {
fn bson_id_as_ref(&self) -> Option<&ObjectId> {
self.id.as_ref()
}
fn bson_id(&self) -> AnyResult<&ObjectId> {
self.id.as_ref().context("ProjLink without BSON ObjectId")
}
}