//! Section block.
//!
//! <https://api.slack.com/reference/block-kit/blocks#section>
use crate::BlockId;
use crate::Element;
use crate::TextObject;
use serde::Serialize;
/// Section block.
///
/// <https://api.slack.com/reference/block-kit/blocks#section>
#[derive(Serialize, Debug, Clone, Default)]
#[serde(rename_all = "snake_case")]
pub struct SectionBlock {
/// The text for the block, in the form of a [text object](https://api.slack.com/reference/messaging/composition-objects#text).
#[serde(skip_serializing_if = "Option::is_none")]
pub text: Option<TextObject>,
/// A unique identifier for a block.
#[serde(skip_serializing_if = "Option::is_none")]
pub block_id: Option<BlockId>,
/// Required if no `text` is provided.
#[serde(skip_serializing_if = "Vec::is_empty")]
pub fields: Vec<TextObject>,
/// One of the compatible [element objects](https://api.slack.com/reference/block-kit/blocks#section) noted above.
#[serde(skip_serializing_if = "Option::is_none")]
pub accessory: Option<Element>,
}