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
use getset::{CopyGetters, Getters, Setters};

use crate::{dossier::dossier_configuration::DossierConfiguration, theme::Theme};


#[derive(Debug, Getters, CopyGetters, Setters)]
pub struct AssemblerConfiguration {

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

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

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

    #[getset(get = "pub", set = "pub")]
    styles_raw_path: Vec<String>,
}

impl AssemblerConfiguration {
    
    pub fn new(theme: Theme, use_remote_addons: bool, parallelization: bool) -> Self {
        Self {
            theme,
            use_remote_addons,
            parallelization,
            styles_raw_path: Vec::new(),
        }
    }
}

impl Default for AssemblerConfiguration {
    fn default() -> Self {
        Self {
            theme: Theme::default(),
            use_remote_addons: false,
            parallelization: false,
            styles_raw_path: Vec::new(),
        }
    }
}

impl From<DossierConfiguration> for AssemblerConfiguration {
    fn from(dossier_configuration: DossierConfiguration) -> Self {
        Self {
            theme: dossier_configuration.style().theme().clone(),
            use_remote_addons: dossier_configuration.compilation().use_remote_addons(),
            parallelization: dossier_configuration.compilation().parallelization(),

            ..Default::default()
        }
    }
}