use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Block {
#[serde(rename = "type")]
pub r#type: Type,
#[serde(rename = "chart_content", skip_serializing_if = "Option::is_none")]
pub chart_content: Option<Box<models::ChartContent>>,
#[serde(rename = "code_content", skip_serializing_if = "Option::is_none")]
pub code_content: Option<Box<models::CodeContent>>,
#[serde(rename = "table_content", skip_serializing_if = "Option::is_none")]
pub table_content: Option<Box<models::TableContent>>,
#[serde(rename = "text_content", skip_serializing_if = "Option::is_none")]
pub text_content: Option<Box<models::TextContent>>,
}
impl Block {
pub fn new(r#type: Type) -> Block {
Block {
r#type,
chart_content: None,
code_content: None,
table_content: None,
text_content: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
#[serde(rename = "chart")]
Chart,
#[serde(rename = "table")]
Table,
#[serde(rename = "text")]
Text,
}
impl Default for Type {
fn default() -> Type {
Self::Chart
}
}