/** * Validator interface and result types for ContentUnit validation * @module content/validator/IValidator */ import type { ContentUnit } from '../types.js'; /** * Validation error codes */ export type ValidationErrorCode = 'UNBALANCED_TAGS' | 'INVALID_TAG_INDEX' | 'ORPHAN_STYLE' | 'INVALID_ICU'; /** * Validation warning codes */ export type ValidationWarningCode = 'EMPTY_STYLE' | 'UNUSED_TAG'; /** * Validation error details */ export interface ValidationError { /** * Error code identifying the type of error */ code: ValidationErrorCode; /** * Human-readable error message */ message: string; /** * Path to the error location (e.g., "text", "styles.1") */ path?: string; } /** * Validation warning details */ export interface ValidationWarning { /** * Warning code identifying the type of warning */ code: ValidationWarningCode; /** * Human-readable warning message */ message: string; } /** * Validation result containing errors and warnings */ export interface ValidationResult { /** * Whether the ContentUnit is valid (no errors) */ valid: boolean; /** * List of validation errors (blocking issues) */ errors: ValidationError[]; /** * List of validation warnings (non-blocking issues) */ warnings: ValidationWarning[]; } /** * Validator interface for ContentUnit integrity checks * * @example * ```typescript * class ContentValidator implements IValidator { * validate(unit: ContentUnit): ValidationResult { * // Check balanced tags, orphan styles, ICU syntax * } * } * ``` */ export interface IValidator { /** * Validate ContentUnit integrity * * @param unit - The ContentUnit to validate * @returns Validation result with errors and warnings */ validate(unit: ContentUnit): ValidationResult; } //# sourceMappingURL=IValidator.d.ts.map