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
use crate::documents::BuildXML;
use crate::xml_builder::*;

use serde::Serialize;

#[derive(Debug, Clone, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct HeaderReference {
    pub header_type: String,
    pub id: String,
}

impl Default for HeaderReference {
    fn default() -> HeaderReference {
        HeaderReference {
            header_type: "default".to_owned(),
            id: "rId4".to_owned(),
        }
    }
}

impl HeaderReference {
    pub fn new(t: impl Into<String>, id: impl Into<String>) -> HeaderReference {
        HeaderReference {
            header_type: t.into(),
            id: id.into(),
        }
    }
}

impl BuildXML for HeaderReference {
    fn build(&self) -> Vec<u8> {
        XMLBuilder::new()
            .header_reference(&self.header_type, &self.id)
            .build()
    }
}