/** * DOCX Module - Document Validation (Schema Validation) * * Provides structural validation of DocxDocument models against the * OOXML WordprocessingML constraints. This validates the document model * at a semantic level (not XML schema validation) to ensure the generated * DOCX will be well-formed and compliant. * * Validation rules are based on: * - ECMA-376 Part 1, Chapter 17 (WordprocessingML) * - Practical interoperability constraints from Word/LibreOffice */ import type { DocxDocument } from "../types.js"; /** Validation severity level. */ export type ValidationSeverity = "error" | "warning" | "info"; /** A single validation issue. */ export interface ValidationIssue { /** Severity of the issue. */ readonly severity: ValidationSeverity; /** Human-readable description of the issue. */ readonly message: string; /** Path to the problematic element (e.g. "body[3].rows[0].cells[1]"). */ readonly path: string; /** Rule identifier for programmatic handling. */ readonly rule: string; } /** Validation result. */ export interface ValidationResult { /** Whether the document is valid (no errors). */ readonly valid: boolean; /** All issues found. */ readonly issues: readonly ValidationIssue[]; /** Count of errors. */ readonly errorCount: number; /** Count of warnings. */ readonly warningCount: number; } /** Validation options. */ export interface ValidationOptions { /** Maximum severity to report. Default: all levels. */ readonly maxSeverity?: ValidationSeverity; /** Stop after this many errors. Default: unlimited. */ readonly maxErrors?: number; /** Check for compatibility with specific Word version. */ readonly compatibilityMode?: "word2007" | "word2010" | "word2013" | "word2016" | "word2019"; /** Enable strict mode (treats warnings as errors). */ readonly strict?: boolean; } /** * Validate a DocxDocument model for structural correctness and OOXML compliance. * * @param doc - The document model to validate. * @param options - Validation options. * @returns Validation result with all issues found. */ export declare function validateDocument(doc: DocxDocument, options?: ValidationOptions): ValidationResult;