1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
pub mod list_bullet_configuration_record;
pub mod compilation_configuration_overlay;

use std::{collections::HashMap, path::PathBuf};
use getset::{CopyGetters, Getters, MutGetters, Setters};
use crate::{bibliography::Bibliography, resource::text_reference::TextReferenceMap, theme::Theme};
use self::list_bullet_configuration_record::ListBulletConfigurationRecord;



#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord)]
pub enum CompilableResourceType {
    Dossier,
    File,

    #[default]
    Unknown
}


/// Struct which contains all information about possible compilation options 
#[derive(Debug, Getters, CopyGetters, MutGetters, Setters, Clone)]
pub struct CompilationConfiguration {

    #[getset(get = "pub", set = "pub")]
    input_location: PathBuf,

    #[getset(get = "pub", set = "pub")]
    output_location: PathBuf,

    #[getset(get_copy = "pub", set = "pub")]
    embed_local_image: bool,

    #[getset(get_copy = "pub", set = "pub")]
    embed_remote_image: bool,
    
    #[getset(get_copy = "pub", set = "pub")]
    compress_embed_image: bool,

    #[getset(get_copy = "pub", set = "pub")]
    strict_image_src_check: bool,

    #[getset(get_copy = "pub", set = "pub")]
    parallelization: bool,

    #[getset(get = "pub", set = "pub")]
    list_bullets_configuration: Vec<ListBulletConfigurationRecord>,
    
    #[getset(get_copy = "pub", set = "pub")]
    strict_list_check: bool,

    #[getset(get_copy = "pub", set = "pub")]
    strict_focus_block_check: bool,

    #[getset(get = "pub", set = "pub")]
    references: TextReferenceMap,

    #[getset(get_copy = "pub", set = "pub")]
    fast_draft: bool,

    #[getset(get = "pub", set = "pub")]
    bibliography: Option<Bibliography>,

    #[getset(get = "pub", set = "pub")]
    theme: Theme,

    #[getset(get = "pub", set = "pub")]
    resource_type: CompilableResourceType,

    #[getset(get_copy = "pub", set = "pub")]
    strict_greek_letters_check: bool,

    #[getset(get_copy = "pub", set = "pub")]
    strict_cite_check: bool,

    #[getset(get_copy = "pub", set = "pub")]
    strict_reference_check: bool,
}

impl CompilationConfiguration {

    pub fn new(input_location: PathBuf, output_location: PathBuf, embed_local_image: bool, embed_remote_image: bool, 
                compress_embed_image: bool, strict_image_src_check: bool,
                parallelization: bool, list_bullets_configuration: Vec<ListBulletConfigurationRecord>, strict_list_check: bool, 
                strict_focus_block_check: bool, references: TextReferenceMap, fast_draft: bool, bibliography: Option<Bibliography>,
                theme: Theme, resource_type: CompilableResourceType, strict_greek_letters_check: bool, strict_cite_check: bool,
                strict_reference_check: bool,) -> Self {

        Self {
            input_location,
            output_location,
            embed_local_image,
            embed_remote_image,
            compress_embed_image,
            strict_image_src_check,
            parallelization,
            list_bullets_configuration,
            strict_list_check,
            strict_focus_block_check,
            references,
            fast_draft,
            bibliography,
            theme,
            resource_type,
            strict_cite_check,
            strict_greek_letters_check,
            strict_reference_check,
        }
    }
}

impl Default for CompilationConfiguration {
    fn default() -> Self {
        Self {
            input_location: PathBuf::from("."),
            output_location: PathBuf::from("."),
            embed_local_image: true,
            embed_remote_image: false,
            compress_embed_image: false,
            strict_image_src_check: false,
            parallelization: false,
            list_bullets_configuration: list_bullet_configuration_record::default_bullets_configuration(),
            strict_list_check: false,
            strict_focus_block_check: false,
            references: HashMap::new(),
            fast_draft: false,
            bibliography: None,
            theme: Theme::default(),
            resource_type: CompilableResourceType::default(),
            strict_cite_check: true,
            strict_greek_letters_check: true,
            strict_reference_check: true,
        }
    }
}