from __future__ import annotations from dataclasses import dataclass, field from typing import Any @dataclass(frozen=True) class TemplateSpec: code: str output_name: str source_file: str file_format: str strategy: str include_in_zip: bool prefer_legacy_doc_native: bool = False allow_docx_fallback: bool = True fields: list[dict[str, Any]] = field(default_factory=list) @dataclass class InstructionExtractResult: source_file_name: str paragraphs: list[str] sections: dict[str, str] tables: list[list[list[str]]] component_tables: list[dict[str, Any]] front_text: str @dataclass class MergedField: key: str label: str value: str source: str evidence: str confidence: float highlight_reason: str = "none" needs_review: bool = False rule_value: str = "" llm_value: str = "" @dataclass class GeneratedFileResult: template_code: str file_name: str requested_format: str actual_format: str status: str path: str = "" artifact_id: int | None = None export_id: int | None = None highlight_count: int = 0 missing_count: int = 0 llm_only_count: int = 0 error_message: str = ""