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
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, theme::Theme}, resource::text_reference::TextReferenceMap};
use self::list_bullet_configuration_record::ListBulletConfigurationRecord;
use crate::codex::modifier::modifiers_bucket::ModifiersBucket;



#[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 = "pub", set = "pub")]
    excluded_modifiers: ModifiersBucket,

    #[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,
}

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, excluded_modifiers: ModifiersBucket, 
                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) -> Self {

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

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,
            excluded_modifiers: ModifiersBucket::None,
            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(),
        }
    }
}