sea_core/primitives/
mapping_contract.rs

1use crate::parser::ast::{MappingRule, TargetFormat};
2use crate::ConceptId;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct MappingContract {
7    id: ConceptId,
8    name: String,
9    namespace: String,
10    target_format: TargetFormat,
11    rules: Vec<MappingRule>,
12}
13
14impl MappingContract {
15    pub fn new(
16        id: ConceptId,
17        name: String,
18        namespace: String,
19        target_format: TargetFormat,
20        rules: Vec<MappingRule>,
21    ) -> Self {
22        Self {
23            id,
24            name,
25            namespace,
26            target_format,
27            rules,
28        }
29    }
30
31    pub fn id(&self) -> &ConceptId {
32        &self.id
33    }
34
35    pub fn name(&self) -> &str {
36        &self.name
37    }
38
39    pub fn namespace(&self) -> &str {
40        &self.namespace
41    }
42
43    pub fn target_format(&self) -> &TargetFormat {
44        &self.target_format
45    }
46
47    pub fn rules(&self) -> &[MappingRule] {
48        &self.rules
49    }
50}