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

pub struct App<'a> {
    pub name : &'a str,
    pub options : Options<'a>,
}

pub struct Options<'a> {
    pub application_id: &'a str,
    pub api_key: &'a str,
    pub database_url: Option<&'a str>,
    pub ga_tracking_id: Option<&'a str>,
    pub storage_bucket: Option<&'a str>,
    pub project_id: Option<&'a str>,
    pub gcm_sender_id: Option<&'a str>,
    pub auth_domain: Option<&'a str>,
}

impl<'a> App<'a> {
    const fn new(name : &'a str,options : Options<'a>) -> Self {
        App {
            name : name ,
            options : options
        }
    }
}

impl<'a> Options<'a> {
    const fn new(application_id : &'a str,api_key : &'a str) -> Self {
        Options {
            application_id : application_id ,
            api_key : api_key,
            database_url : None,
            ga_tracking_id : None,
            storage_bucket : None,
            project_id : None,
            gcm_sender_id : None,
            auth_domain : None,
        }
    }

    const fn with_database_url(mut self,database_url: &'a str) -> Self {
        self.database_url = Some(database_url);
        self
    }

    const fn with_ga_tracking_id(mut self,ga_tracking_id: &'a str) -> Self {
        self.ga_tracking_id = Some(ga_tracking_id);
        self
    }
    
    const fn with_storage_bucket(mut self,storage_bucket: &'a str) -> Self {
        self.storage_bucket = Some(storage_bucket);
        self
    }

    const fn with_project_id(mut self,project_id: &'a str) -> Self {
        self.project_id = Some(project_id);
        self
    }

    const fn with_gcm_sender_id(mut self,gcm_sender_id: &'a str) -> Self {
        self.gcm_sender_id = Some(gcm_sender_id);
        self
    }

    const fn with_auth_domain(mut self,auth_domain: &'a str) -> Self {
        self.auth_domain = Some(auth_domain);
        self
    }
}