namespace zx_document {}; [Enum] interface MaterialType { Markdown(); Text(); Pdf(); Image(); Epub(); Word(); Excel(); PowerPoint(); Unknown(); }; [Enum] interface PreviewMode { NativeReader(); PlatformPreview(); ExternalOpen(); Unsupported(); }; dictionary DocumentInfo { string material_id; string title; MaterialType material_type; PreviewMode preview_mode; u64 file_size; u32? page_count; u32? word_count; string? created_at; }; [Enum] interface ReadingPosition { Markdown(string block_id, f32 scroll_progress); Text(u32 line_number, f32 scroll_progress); Pdf(u32 page_number, f32 page_progress, f32 overall_progress); Image(f32 zoom_scale, f32 offset_x, f32 offset_y); Epub(string chapter_id, f32 chapter_progress, f32 overall_progress); Unknown(); }; [Enum] interface ReadingEvent { MaterialOpened(string material_id, i64 timestamp_ms); MaterialClosed(string material_id, i64 timestamp_ms, u32 active_seconds); PositionChanged(string material_id, ReadingPosition position, i64 timestamp_ms); Heartbeat(string material_id, u32 active_seconds, ReadingPosition? position, i64 timestamp_ms); MarkedAsRead(string material_id, i64 timestamp_ms); }; [Enum] interface NoteAnchor { Material(string material_id); MarkdownBlock(string material_id, string block_id); TextLine(string material_id, u32 line_number); PdfPage(string material_id, u32 page_number); Image(string material_id); EpubChapter(string material_id, string chapter_id); KnowledgeItem(string knowledge_item_id); }; dictionary ImageMeta { u32 width; u32 height; string format; u64 file_size; }; dictionary SearchResult { string block_id; u32? line_number; string snippet; u64 match_start; u64 match_end; }; dictionary TextStats { u32 line_count; u32 word_count; }; [Error] enum DocumentError { "FileNotFound", "UnsupportedFormat", "ParseError", "InvalidEncoding", "IoError", };