blockcontent 0.2.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * BlockContent Spec
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.2.0
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Block : A content block, used to represent structured sections such as text, charts, etc.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Block {
    /// type of 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 {
    /// A content block, used to represent structured sections such as text, charts, etc.
    pub fn new(r#type: Type) -> Block {
        Block {
            r#type,
            chart_content: None,
            code_content: None,
            table_content: None,
            text_content: None,
        }
    }
}
/// type of block
#[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
    }
}