data: define Allianz export structure for csv files
* data need to be transfered as a csv-file attachment via email * each row takes a semicolon separeted list of string fields * this structure is defined as rust 'struct CSVExport' * the struct CSVExport will reference to its child stuctures. Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -3,10 +3,63 @@ use orbtk::prelude::*;
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct HarmElement {
|
||||
// Schadenersatz-RS im Verkehrsbereich (RS112)
|
||||
// Ordnungswidrigkeits-RS im Verkehrsbereich (RS122)
|
||||
// Straf-RS im Verkehrsbereich (RS121)
|
||||
// Vertrags-RS im Verkehrsbereich (RS118)
|
||||
// Vertrags-RS im Privatbereich (RS218)
|
||||
// Arbeits-RS im Berufsbereich (RS315)
|
||||
// WuG-RS im Privatbereich (RS220)
|
||||
// Sozialgerichts-RS im Privatbereich (RS216)
|
||||
// Rechtsschutz im Familien- und Erbrecht (RS217)
|
||||
// Wagnis nicht versicherbar / versichert (RS999)
|
||||
pub harm_id: String,
|
||||
pub harm_name: String,
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct HarmType {
|
||||
pub harm_type: Vec<HarmElement>,
|
||||
pub name: String,
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CommunicationType {
|
||||
// Unfall, Bußgeldbescheid, Anhörung, Unfallflucht, Kaufvertrag,
|
||||
// Vodafone, Kündigung, Lohn, Zeugnis, Nachbar, Vermieter, Rente, GdB, Verwaltungsrecht, Unterhalt, Geburt, Hochzeit
|
||||
pub communication_id: String,
|
||||
pub communication_name: String,
|
||||
}
|
||||
|
||||
|
||||
/// CSV Export
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CSVExport {
|
||||
// policy_code => Versicherungsscheinnummer: "AS1234567890"
|
||||
// policy_holder => Anrufer: "Vorname, Nachname"
|
||||
// facts => Sachverhalt: "Kurzschilderung"
|
||||
// harm_type => Schadensart: "harm_name (harm_id)"
|
||||
// communication_type => Kommunikationszeichen: "(communication_name)"
|
||||
// ra_hotline => RA_Hotline: Kanzlei Laqua, Kanzlei Buschbell, Kanzlei DAH, Kanzlei Hiedemann
|
||||
// ivr_comment => Haftungs-/Deckungskommentar; #IVR (ggf. ergänzt um das Beratungsergebnis)
|
||||
pub policy_id: String,
|
||||
pub policy_number: u32,
|
||||
pub policy_holder: String,
|
||||
pub facts: String,
|
||||
pub harm_type: String,
|
||||
pub communication_name: String,
|
||||
pub ra_hotline: String, // const "Kanzlei Hiedemann",
|
||||
pub ivr_comment: String,
|
||||
}
|
||||
|
||||
/// Structure used to verify a policy data element.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyCheck {
|
||||
pub policy_code: String,
|
||||
pub policy_id: String,
|
||||
pub policy_number: String,
|
||||
pub isvalid: bool
|
||||
}
|
||||
|
||||
@@ -45,16 +98,29 @@ impl PolicyList {
|
||||
}
|
||||
}
|
||||
|
||||
// Valid policy codes are represented in this Enumeration
|
||||
// right now, only "AS" is used
|
||||
//enum PolicyCode {
|
||||
// CodeName(String),
|
||||
//}
|
||||
|
||||
/// Structure representing a policy data element.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyElement {
|
||||
// DION VERS POLLFNR
|
||||
// 1 AS 1515735810
|
||||
// DION: Allianz id => len = 1??
|
||||
// VERS: policy_code => enum(AS; ??)
|
||||
// POLLFNR: policy_number => len = 10
|
||||
pub dion: u8,
|
||||
// is String16 a better default-type?
|
||||
pub policy_code: String,
|
||||
pub policy_number: u32,
|
||||
pub date_inserted: Option<NaiveDateTime>,
|
||||
pub isvalid: bool
|
||||
pub isactive: bool
|
||||
}
|
||||
|
||||
/// Structure grouping valid policy data elemnts
|
||||
/// Structure grouping valid policy data elements
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyData {
|
||||
pub date_valid_until: Option<NaiveDateTime>,
|
||||
@@ -63,44 +129,44 @@ pub struct PolicyData {
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
/// implements helper methods, that manage the policy data collections.
|
||||
/// implements the helper methods, to manage policy data collections.
|
||||
impl PolicyData {
|
||||
pub fn new(name: impl Into<String>) -> Self {
|
||||
// the new inserted element will be active by default
|
||||
PolicyData {
|
||||
name: name.into(),
|
||||
date_valid_until: None,
|
||||
name: name.into(),
|
||||
selected: true,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push(&mut self, policy_element: PolicyElement) {
|
||||
self.list.push(policy_element);
|
||||
self.policy_elements.push(policy_element);
|
||||
}
|
||||
|
||||
pub fn insert_front(&mut self, policy_element: PolicyElement) {
|
||||
self.list.insert(0, policy_element);
|
||||
self.policy_elements.insert(0, policy_element);
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, index: usize) -> PolicyElement {
|
||||
self.list.remove(index)
|
||||
self.policy_elements.remove(index)
|
||||
}
|
||||
|
||||
pub fn get(&self, index: usize) -> Option<&PolicyElement> {
|
||||
self.list.get(index)
|
||||
self.policy_elements.get(index)
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, index: usize) -> Option<&mut PolicyElement> {
|
||||
self.list.get_mut(index)
|
||||
self.policy_elements.get_mut(index)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.list.len()
|
||||
self.policy_elements.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.list.is_empty()
|
||||
self.policy_elements.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user