pub mod command;
pub mod markdown;
pub mod model;
pub mod tiptap;

pub use command::{
    EditorAttachReferenceToken, EditorCommand, EditorCommandCatalog, EditorCommandDescriptor,
    EditorCommandKind, EditorDeleteBlock, EditorDetachReferenceToken, EditorIndentBlock,
    EditorInsertBlockAfter, EditorKernelCommandMapping, EditorMergeWithPrevious, EditorMoveBlock,
    EditorOutdentBlock, EditorReplaceBlock, EditorSplitBlock, EditorToggleHeadingCollapse,
};
pub use markdown::{
    MarkdownExportBoundary, MarkdownExportMode, MarkdownExportOptions, MarkdownExportRequest,
    MarkdownExportResult, MarkdownFlavor, MarkdownImportBoundary, MarkdownImportMode,
    MarkdownImportOptions, MarkdownImportRequest, MarkdownImportResult,
};
pub use model::{
    BlockProps, ContentNode, ContentNodePayload, EditorBlock, EditorBlockDocument, EditorBlockType,
    ReferenceToken, ReferenceTokenKind, ReferenceTokenStrategy, TextMark,
};
pub use tiptap::{
    EditorBlockDocumentTiptapBridge, EditorBlockDocumentTiptapError, TiptapBlockType,
    TiptapCodeBlockAttrs, TiptapHeadingAttrs, TiptapNode, TiptapTaskItemAttrs,
};

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn editor_command_kind_uses_phase_one_names() {
        assert_eq!(
            serde_json::to_string(&EditorCommandKind::InsertBlockAfter).unwrap(),
            "\"insert_block_after\""
        );
        assert_eq!(
            serde_json::to_string(&EditorCommandKind::MergeWithPrevious).unwrap(),
            "\"merge_with_previous\""
        );
        assert_eq!(
            serde_json::to_string(&EditorCommandKind::ToggleHeadingCollapse).unwrap(),
            "\"toggle_heading_collapse\""
        );
    }

    #[test]
    fn editor_block_type_uses_expected_snake_case_names() {
        assert_eq!(
            serde_json::to_string(&EditorBlockType::BulletListItem).unwrap(),
            "\"bullet_list_item\""
        );
        assert_eq!(
            serde_json::to_string(&EditorBlockType::PageReference).unwrap(),
            "\"page_reference\""
        );
        assert_eq!(
            serde_json::to_string(&EditorBlockType::BlockReference).unwrap(),
            "\"block_reference\""
        );
    }
}
