1use std::io;
2use std::path::PathBuf;
3use getset::{CopyGetters, Getters, Setters};
4use thiserror::Error;
5use crate::resource::resource_reference::ResourceReferenceError;
6use crate::resource::ResourceError;
7
8
9
10
11#[derive(Error, Debug)]
12pub enum LoadError {
13
14 #[error("bucket of errors: '{0:#?}'")]
15 BucketOfErrors(Vec<LoadError>),
16
17 #[error(transparent)]
18 ResourceError(#[from] ResourceError),
19
20 #[error(transparent)]
21 ResourceReferenceError(#[from] ResourceReferenceError),
22
23 #[error("elaboration error: {0}")]
24 ElaborationError(String),
25
26 #[error(transparent)]
27 IoError(#[from] io::Error),
28
29 #[error("block error: {0}")]
30 BlockError(String),
31
32 #[error("invalid tag: {0}")]
33 InvalidTag(String)
34}
35
36impl Clone for LoadError {
37 fn clone(&self) -> Self {
38 match self {
39 Self::IoError(e) => Self::ElaborationError(e.to_string()),
40 other => other.clone()
41 }
42 }
43}
44
45
46#[derive(Debug, Getters, CopyGetters, Setters)]
47pub struct LoadConfiguration {
48
49 #[getset(get = "pub", set = "pub")]
50 input_location: PathBuf,
51
52 #[getset(get_copy = "pub", set = "pub")]
53 strict_focus_block_check: bool,
54
55 #[getset(get_copy = "pub", set = "pub")]
56 strict_paragraphs_loading_rules_check: bool,
57
58 #[getset(get_copy = "pub", set = "pub")]
59 parallelization: bool,
60}
61
62impl Default for LoadConfiguration {
63 fn default() -> Self {
64 Self {
65 input_location: PathBuf::from("."),
66 strict_focus_block_check: false,
67 strict_paragraphs_loading_rules_check: true,
68 parallelization: true
69 }
70 }
71}
72
73
74#[derive(Debug, Getters, Setters, Default, Clone)]
75pub struct LoadConfigurationOverLay {
76
77 #[getset(get = "pub", set = "pub")]
78 dossier_name: Option<String>,
79
80 #[getset(get = "pub", set = "pub")]
81 document_name: Option<String>,
82}