use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

use super::{Block, Comment, TrackedChange};

/// A normalized review-oriented representation of a DOCX file.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Document {
    /// Top-level document metadata when available.
    pub metadata: DocMetadata,
    /// Normalized textual structure of the document.
    pub blocks: Vec<Block>,
    /// Review-oriented tracked changes, optionally paired.
    pub tracked_changes: Vec<TrackedChange>,
    /// Extracted comments, anchors, and thread metadata.
    pub comments: Vec<Comment>,
    /// Raw tracked changes when [`crate::TrackChangesMode::Both`] is used.
    pub raw_changes: Vec<TrackedChange>,
}

/// Optional metadata associated with the DOCX package.
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct DocMetadata {
    /// Document title.
    pub title: Option<String>,
    /// Primary author.
    pub author: Option<String>,
    /// Document creation time.
    pub created: Option<DateTime<Utc>>,
    /// Last modification time.
    pub modified: Option<DateTime<Utc>>,
    /// Revision counter when present in package metadata.
    pub revision: Option<u32>,
}
