use serde_json::Value as JsonValue;
pub type XmlElement = JsonValue;
#[derive(Debug, Clone)]
pub struct XmlElementParams<'a> {
pub element: XmlElement,
pub disassembled_path: &'a str,
pub unique_id_elements: Option<&'a str>,
pub root_element_name: &'a str,
pub root_attributes: XmlElement,
pub key: &'a str,
pub leaf_content: XmlElement,
pub leaf_count: usize,
pub has_nested_elements: bool,
pub format: &'a str,
pub xml_declaration: Option<XmlElement>,
pub strategy: &'a str,
}
#[derive(Debug, Clone)]
pub struct BuildDisassembledFileOptions<'a> {
pub content: XmlElement,
pub disassembled_path: &'a str,
pub output_file_name: Option<&'a str>,
pub subdirectory: Option<&'a str>,
pub wrap_key: Option<&'a str>,
pub is_grouped_array: bool,
pub root_element_name: &'a str,
pub root_attributes: XmlElement,
pub format: &'a str,
pub xml_declaration: Option<XmlElement>,
pub unique_id_elements: Option<&'a str>,
}
#[derive(Debug, Clone, Default)]
pub struct UnifiedParseResult {
pub leaf_content: XmlElement,
pub leaf_count: usize,
pub has_nested_elements: bool,
pub nested_groups: Option<XmlElementArrayMap>,
}
pub type XmlElementArrayMap = std::collections::HashMap<String, Vec<XmlElement>>;
#[derive(Debug, Clone)]
pub struct DecomposeRule {
pub tag: String,
pub path_segment: String,
pub mode: String,
pub field: String,
}
#[derive(Debug, Clone)]
pub struct BuildDisassembledFilesOptions<'a> {
pub file_path: &'a str,
pub disassembled_path: &'a str,
pub base_name: &'a str,
pub post_purge: bool,
pub format: &'a str,
pub unique_id_elements: Option<&'a str>,
pub strategy: &'a str,
pub decompose_rules: Option<&'a [DecomposeRule]>,
}
#[derive(Debug, Clone)]
pub struct LeafWriteParams<'a> {
pub leaf_count: usize,
pub leaf_content: XmlElement,
pub strategy: &'a str,
pub key_order: Vec<String>,
pub options: LeafWriteOptions<'a>,
}
#[derive(Debug, Clone)]
pub struct LeafWriteOptions<'a> {
pub disassembled_path: &'a str,
pub output_file_name: &'a str,
pub root_element_name: &'a str,
pub root_attributes: XmlElement,
pub xml_declaration: Option<XmlElement>,
pub format: &'a str,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct MultiLevelRule {
pub file_pattern: String,
pub root_to_strip: String,
pub unique_id_elements: String,
#[serde(default)]
pub path_segment: String,
#[serde(default)]
pub wrap_root_element: String,
#[serde(default)]
pub wrap_xmlns: String,
}
#[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)]
pub struct MultiLevelConfig {
pub rules: Vec<MultiLevelRule>,
}