1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub enum SemanticType {
8 Document,
10 Div,
12 Paragraph,
14 Span,
16 Table,
18 TableHeaders,
20 TableFooter,
22 TableBody,
24 TableRow,
26 TableHeader,
28 TableCell,
30 Form,
32 Link,
34 Annot,
36 Caption,
38 List,
40 ListLabel,
42 ListBody,
44 ListItem,
46 TableOfContent,
48 TableOfContentItem,
50 Figure,
52 NumberHeading,
54 Heading,
56 Title,
58 BlockQuote,
60 Note,
62 Header,
64 Footer,
66 Code,
68 Part,
70}
71
72impl SemanticType {
73 pub fn is_ignored_standard_type(&self) -> bool {
75 matches!(
76 self,
77 SemanticType::Div
78 | SemanticType::Span
79 | SemanticType::Form
80 | SemanticType::Link
81 | SemanticType::Annot
82 )
83 }
84}
85
86#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
88pub enum TextAlignment {
89 Left,
91 Right,
93 Center,
95 Justify,
97}
98
99#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
101pub enum TextFormat {
102 #[default]
104 Normal,
105 Superscript,
107 Subscript,
109}
110
111#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
113pub enum TextType {
114 #[default]
116 Regular,
117 Large,
119 Logo,
121}
122
123#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
125pub enum PdfLayer {
126 #[default]
128 Main,
129 Content,
131 TableCells,
133 ListItems,
135 TableContent,
137 ListContent,
139 TextBlockContent,
141 HeaderAndFooterContent,
143}
144
145#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
147pub enum TriageDecision {
148 Local,
150 Backend,
152 Both,
154}
155
156#[cfg(test)]
157mod tests {
158 use super::*;
159
160 #[test]
161 fn test_semantic_type_ignored() {
162 assert!(SemanticType::Div.is_ignored_standard_type());
163 assert!(SemanticType::Span.is_ignored_standard_type());
164 assert!(!SemanticType::Paragraph.is_ignored_standard_type());
165 assert!(!SemanticType::Heading.is_ignored_standard_type());
166 assert!(!SemanticType::Table.is_ignored_standard_type());
167 }
168
169 #[test]
170 fn test_text_format_default() {
171 assert_eq!(TextFormat::default(), TextFormat::Normal);
172 }
173}