@@ -3,8 +3,85 @@ use orbtk::prelude::*;
|
||||
use chrono::NaiveDateTime;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// An enumeration of valid policy codes
|
||||
/// right now, only "AS" is used
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub enum PolicyCode {
|
||||
AS
|
||||
}
|
||||
|
||||
impl Default for PolicyCode {
|
||||
fn default() -> Self { PolicyCode::AS }
|
||||
}
|
||||
|
||||
/// Status of a given policy data element (eg: active / inactive)
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub enum Status {
|
||||
Active,
|
||||
Inactive
|
||||
}
|
||||
|
||||
impl Default for Status {
|
||||
fn default() -> Self { Status::Active }
|
||||
}
|
||||
|
||||
/// A communication type describes possible classifications of customer calls.
|
||||
/// If not selected, the default will be 'unclassified'.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct HarmElement {
|
||||
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
|
||||
/// The structure elements are required for an export to a comma seperated text list.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CsvExportRecord {
|
||||
// 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_code: 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,
|
||||
}
|
||||
|
||||
/// CSV Import
|
||||
/// The structure elements provided as a comma seperated text list.
|
||||
/// Referenz: ERG.txt -> 'DION VERS POLLFNR'
|
||||
/// '1 AS 1515735810'
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct CsvImportRecord {
|
||||
// dion => Allianz Dion: 1
|
||||
// policy_code => Policy Typ: "AS"
|
||||
// policy_number => Versicherungsscheinnummer: "1515735810"
|
||||
pub dion: String,
|
||||
pub policy_code: String,
|
||||
pub policy_number: u32,
|
||||
}
|
||||
|
||||
/// Harm data are list/collections of harm types. You may toggle them to an unselected state.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct HarmData {
|
||||
pub harm_data: Vec<HarmType>,
|
||||
//pub name: String,
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
/// Harm types are destincted by a type code.
|
||||
/// The type code represents the unique harm identifier, bound with a literal name.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct HarmType {
|
||||
// Schadenersatz-RS im Verkehrsbereich (RS112)
|
||||
// Ordnungswidrigkeits-RS im Verkehrsbereich (RS122)
|
||||
// Straf-RS im Verkehrsbereich (RS121)
|
||||
@@ -15,158 +92,139 @@ pub struct HarmElement {
|
||||
// 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,
|
||||
pub harm_name: String,
|
||||
}
|
||||
|
||||
/// Structure used to verify a policy data element.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyCheck {
|
||||
pub policy_id: String,
|
||||
pub policy_check_number: String,
|
||||
pub policy_number: String,
|
||||
pub isvalid: bool
|
||||
pub policy_number_valid: bool
|
||||
}
|
||||
|
||||
// #[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
||||
// pub struct PolicyCheckList {
|
||||
// pub title: String,
|
||||
// pub list: Vec<PolicyCheck>
|
||||
// }
|
||||
|
||||
// impl PolicyCheckList {
|
||||
// pub fn new(title: impl Into<String>) -> Self {
|
||||
// PolicyCheckList {
|
||||
// title: title.into(),
|
||||
// ..Default::default()
|
||||
// }
|
||||
// }
|
||||
|
||||
/// Structure collecting policy data elements
|
||||
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct PolicyList {
|
||||
pub policy_list: Vec<PolicyData>,
|
||||
pub name: String,
|
||||
pub policy_list: Vec<PolicyDataList>,
|
||||
}
|
||||
|
||||
/// implements helper methods, that manage lists of policy data collections
|
||||
impl PolicyList {
|
||||
pub fn get(&self, index: usize) -> Option<&PolicyData> {
|
||||
self.policy_list.get(index)
|
||||
pub fn get(&self, index: usize) -> Option<&PolicyDataList> {
|
||||
self.policy_list.get(index)
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, index: usize) -> Option<&mut PolicyData> {
|
||||
self.policy_list.get_mut(index)
|
||||
pub fn get_mut(&mut self, index: usize) -> Option<&mut PolicyDataList> {
|
||||
self.policy_list.get_mut(index)
|
||||
}
|
||||
|
||||
pub fn insert_front(&mut self, policy_list: PolicyData) {
|
||||
self.policy_list.insert(0, policy_list);
|
||||
pub fn insert_front(&mut self, policy_list: PolicyDataList) {
|
||||
self.policy_list.insert(0, policy_list);
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.policy_list.is_empty()
|
||||
self.policy_list.is_empty()
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.policy_list.len()
|
||||
self.policy_list.len()
|
||||
}
|
||||
|
||||
pub fn push(&mut self, policy_list: PolicyData) {
|
||||
self.policy_list.push(policy_list);
|
||||
pub fn new(name: impl Into<String>) -> Self {
|
||||
PolicyList {
|
||||
name: name.into(),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
pub fn remove(&mut self, index: usize) -> PolicyData {
|
||||
self.policy_list.remove(index)
|
||||
pub fn push(&mut self, policy_list: PolicyDataList) {
|
||||
self.policy_list.push(policy_list);
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, index: usize) -> PolicyDataList {
|
||||
self.policy_list.remove(index)
|
||||
}
|
||||
}
|
||||
|
||||
// Valid policy codes are represented in this Enumeration
|
||||
// right now, only "AS" is used
|
||||
//enum PolicyCode {
|
||||
// CodeName(String),
|
||||
//}
|
||||
|
||||
/// Structure representing a policy data element.
|
||||
/// Structure representing a policy data element
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyElement {
|
||||
pub struct PolicyData {
|
||||
// DION VERS POLLFNR
|
||||
// 1 AS 1515735810
|
||||
// DION: Allianz id => len = 1??
|
||||
// VERS: policy_code => enum(AS; ??)
|
||||
// POLLFNR: policy_number => len = 10
|
||||
pub date_inserted: Option<NaiveDateTime>,
|
||||
pub dion: u8,
|
||||
// is String16 a better default-type?
|
||||
pub policy_code: String,
|
||||
pub policy_code: PolicyCode,
|
||||
pub policy_number: u32,
|
||||
pub date_inserted: Option<NaiveDateTime>,
|
||||
pub isactive: bool
|
||||
pub status: Status
|
||||
}
|
||||
|
||||
/// Structure grouping valid policy data elements
|
||||
/// Structure collects policy data elements.
|
||||
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct PolicyData {
|
||||
pub struct PolicyDataList {
|
||||
pub date_valid_until: Option<NaiveDateTime>,
|
||||
pub policy_elements: Vec<PolicyElement>,
|
||||
pub policy_data: Vec<PolicyData>,
|
||||
pub name: String,
|
||||
pub selected: bool
|
||||
}
|
||||
|
||||
/// implements the helper methods, to manage policy data collections.
|
||||
impl PolicyData {
|
||||
impl PolicyDataList {
|
||||
pub fn new(name: impl Into<String>) -> Self {
|
||||
// the new inserted element will be active by default
|
||||
PolicyData {
|
||||
date_valid_until: None,
|
||||
name: name.into(),
|
||||
selected: true,
|
||||
..Default::default()
|
||||
}
|
||||
// the new inserted element will be active by default
|
||||
PolicyDataList {
|
||||
date_valid_until: None,
|
||||
name: name.into(),
|
||||
selected: true,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push(&mut self, policy_element: PolicyElement) {
|
||||
self.policy_elements.push(policy_element);
|
||||
pub fn push(&mut self, policy_data: PolicyData) {
|
||||
self.policy_data.push(policy_data);
|
||||
}
|
||||
|
||||
pub fn insert_front(&mut self, policy_element: PolicyElement) {
|
||||
self.policy_elements.insert(0, policy_element);
|
||||
pub fn insert_front(&mut self, policy_data: PolicyData) {
|
||||
self.policy_data.insert(0, policy_data);
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, index: usize) -> PolicyElement {
|
||||
self.policy_elements.remove(index)
|
||||
pub fn remove(&mut self, index: usize) -> PolicyData {
|
||||
self.policy_data.remove(index)
|
||||
}
|
||||
|
||||
pub fn get(&self, index: usize) -> Option<&PolicyElement> {
|
||||
self.policy_elements.get(index)
|
||||
pub fn get(&self, index: usize) -> Option<&PolicyData> {
|
||||
self.policy_data.get(index)
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, index: usize) -> Option<&mut PolicyElement> {
|
||||
self.policy_elements.get_mut(index)
|
||||
pub fn get_mut(&mut self, index: usize) -> Option<&mut PolicyData> {
|
||||
self.policy_data.get_mut(index)
|
||||
}
|
||||
|
||||
pub fn len(&self) -> usize {
|
||||
self.policy_elements.len()
|
||||
self.policy_data.len()
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.policy_elements.is_empty()
|
||||
self.policy_data.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user