Skip to main content

text_document_io/
dtos.rs

1// Generated by Qleany v1.4.8 from feature_dtos.tera
2
3use common::parser_tools::{
4    DjotImportOptions, DocxExportOptions, EpubExportOptions, LatexExportOptions, OdtExportOptions,
5    PdfExportOptions,
6};
7use serde::{Deserialize, Serialize};
8
9#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
10pub struct ImportPlainTextDto {
11    pub plain_text: String,
12}
13#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
14pub struct ExportPlainTextDto {
15    pub plain_text: String,
16}
17#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
18pub struct ImportMarkdownDto {
19    pub markdown_text: String,
20}
21#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
22pub struct ImportMarkdownResultDto {
23    pub block_count: i64,
24}
25#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
26pub struct ExportMarkdownDto {
27    pub markdown_text: String,
28}
29#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
30pub struct ImportDjotDto {
31    pub djot_text: String,
32    /// Per-feature selection for the optional block attributes (alignment, line
33    /// height, direction, non-breakable lines, background color). Defaults to
34    /// all enabled — the fully lossless import.
35    pub options: DjotImportOptions,
36}
37#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
38pub struct ImportDjotResultDto {
39    pub block_count: i64,
40}
41#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
42pub struct ExportDjotDto {
43    pub djot_text: String,
44}
45#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
46pub struct ImportHtmlDto {
47    pub html_text: String,
48}
49#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
50pub struct ImportHtmlResultDto {
51    pub block_count: i64,
52}
53#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
54pub struct ExportHtmlDto {
55    pub html_text: String,
56}
57
58// Hand-added (M-T3, mirrors `ExportDocxDto.options`/`ExportEpubDto.options`/
59// `ExportOdtDto.options`): `document_class`/`include_preamble` were declared here as flat
60// scalar fields (the qleany manifest cannot express a struct field — see the `replace_text`
61// NOTE in qleany.yaml), and `omit_images` was hand-added later still flat. M-T3 folds all three
62// into `LatexExportOptions`, the options struct every sibling export DTO already carries.
63// `#[serde(default)]` so an older `{}` payload still loads. If this file is regenerated, the
64// generator restores the flat `document_class`/`include_preamble` fields — drop those and
65// re-add `options` instead (or declare the change in the manifest).
66#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
67pub struct ExportLatexDto {
68    #[serde(default)]
69    pub options: LatexExportOptions,
70}
71#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
72pub struct ExportLatexResultDto {
73    pub latex_text: String,
74}
75#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
76pub struct ExportDocxDto {
77    pub output_path: String,
78    // Hand-added (mirrors `ImportDjotDto.options`): page geometry + base typography for a
79    // manuscript-style export. `#[serde(default)]` so an older `{ output_path }` payload still
80    // loads. If this file is regenerated, re-add this field (or declare it in the manifest).
81    #[serde(default)]
82    pub options: DocxExportOptions,
83}
84#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
85pub struct ExportDocxResultDto {
86    pub file_path: String,
87    pub paragraph_count: i64,
88}
89#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
90pub struct ExportEpubDto {
91    pub output_path: String,
92    // Hand-added (mirrors `ExportDocxDto.options`): book-level metadata (title, author,
93    // language, reading direction) for the EPUB package. `#[serde(default)]` so an older
94    // `{ output_path }` payload still loads. If this file is regenerated, re-add this field (or
95    // declare it in the manifest).
96    #[serde(default)]
97    pub options: EpubExportOptions,
98}
99#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
100pub struct ExportEpubResultDto {
101    pub file_path: String,
102    pub chapter_count: i64,
103}
104// Hand-added (mirrors `ExportDocxDto`/`ExportEpubDto`): M-T2a, the ODT (OpenDocument Text)
105// writer. `options` follows the same `#[serde(default)]` rule as its siblings so an older
106// `{ output_path }` payload still loads. If this file is regenerated, re-add this struct pair
107// (or declare them in the manifest).
108#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
109pub struct ExportOdtDto {
110    pub output_path: String,
111    #[serde(default)]
112    pub options: OdtExportOptions,
113}
114#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
115pub struct ExportOdtResultDto {
116    pub file_path: String,
117    pub paragraph_count: i64,
118}
119#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
120pub struct ExportPdfDto {
121    pub output_path: String,
122    // Hand-added (mirrors `ExportDocxDto.options`/`ExportEpubDto.options`): page geometry +
123    // typography + embedded font bytes for the PDF export. `#[serde(default)]` so an older
124    // `{ output_path }` payload still loads. If this file is regenerated, re-add this field (or
125    // declare it in the manifest).
126    #[serde(default)]
127    pub options: PdfExportOptions,
128}
129#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
130pub struct ExportPdfResultDto {
131    pub file_path: String,
132    pub page_count: i64,
133}