Skip to main content

docx_review_core/model/
document.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4use super::{Block, Comment, TrackedChange};
5
6/// A normalized review-oriented representation of a DOCX file.
7#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
8#[non_exhaustive]
9pub struct Document {
10    /// Top-level document metadata when available.
11    pub metadata: DocMetadata,
12    /// Normalized textual structure of the document.
13    pub blocks: Vec<Block>,
14    /// Review-oriented tracked changes, optionally paired.
15    pub tracked_changes: Vec<TrackedChange>,
16    /// Extracted comments, anchors, and thread metadata.
17    pub comments: Vec<Comment>,
18    /// Raw tracked changes when [`crate::TrackChangesMode::Both`] is used.
19    pub raw_changes: Vec<TrackedChange>,
20}
21
22/// Optional metadata associated with the DOCX package.
23#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
24#[non_exhaustive]
25pub struct DocMetadata {
26    /// Document title.
27    pub title: Option<String>,
28    /// Primary author.
29    pub author: Option<String>,
30    /// Document creation time.
31    pub created: Option<DateTime<Utc>>,
32    /// Last modification time.
33    pub modified: Option<DateTime<Utc>>,
34    /// Revision counter when present in package metadata.
35    pub revision: Option<u32>,
36}