//! The type that represents a block.
//!
//! <https://api.slack.com/reference/block-kit/blocks>

pub mod actions;
pub mod context;
pub mod divider;
pub mod file;
pub mod header;
pub mod image;
pub mod input;
pub mod rich_text;
pub mod section;

use crate::{
    ActionsBlock, ContextBlock, DividerBlock, FileBlock, HeaderBlock, ImageBlock, InputBlock,
    RichTextBlock, SectionBlock,
};
use serde::Serialize;

/// A unique identifier for a block.
#[derive(Serialize, Debug, Clone)]
pub struct BlockId(pub String);

/// The external unique ID for the file. in <https://api.slack.com/reference/block-kit/blocks#file_fields>.
#[derive(Serialize, Debug, Clone)]
pub struct ExternalId(pub String);

/// The type that represents a block.
///
/// <https://api.slack.com/reference/block-kit/blocks>
#[derive(Serialize, Debug, Clone)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Block {
    /// Actions block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#actions>
    Actions(ActionsBlock),

    /// Context block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#context>
    Context(ContextBlock),

    /// Divider block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#divider>
    Divider(DividerBlock),

    /// File block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#file>
    File(FileBlock),

    /// Header block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#header>
    Header(HeaderBlock),

    /// Image block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#image>
    Image(ImageBlock),

    /// Rich text block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#rich_text>
    RichText(RichTextBlock),

    /// Input block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#input>
    Input(InputBlock),

    /// Section block.
    ///
    /// <https://api.slack.com/reference/block-kit/blocks#section>
    Section(SectionBlock),
    // Video(VideoBlock),
}
