use serde::{Serialize, Deserialize};
use super::{
Customer360AccountVo, Customer360AgreementVo, Customer360AppointmentVo,
Customer360CustomerBillVo, Customer360CustomerVo, Customer360LoyaltyAccountVo,
Customer360PartyInteractionVo, Customer360PaymentMethodVo, Customer360ProductOrderVo,
Customer360ProductVo, Customer360PromotionVo, Customer360QuoteVo,
Customer360RecommendationVo, Customer360ServiceProblemVo, Customer360TroubleTicketVo,
};
use crate::common::entity::Entity;
use crate::TimePeriod;
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Customer360 {
#[serde(flatten)]
pub entity: Entity,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub account: Vec<Customer360AccountVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub agreement: Vec<Customer360AgreementVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub appointment: Vec<Customer360AppointmentVo>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub customer: Option<Customer360CustomerVo>,
#[serde(rename = "customerBill")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub customer_bill: Vec<Customer360CustomerBillVo>,
#[serde(rename = "loyaltyAccount")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub loyalty_account: Vec<Customer360LoyaltyAccountVo>,
#[serde(rename = "partyInteraction")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub party_interaction: Vec<Customer360PartyInteractionVo>,
#[serde(rename = "paymentMethod")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub payment_method: Vec<Customer360PaymentMethodVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub product: Vec<Customer360ProductVo>,
#[serde(rename = "productOrder")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub product_order: Vec<Customer360ProductOrderVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub promotion: Vec<Customer360PromotionVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub quote: Vec<Customer360QuoteVo>,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub recommendation: Vec<Customer360RecommendationVo>,
#[serde(rename = "serviceProblem")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub service_problem: Vec<Customer360ServiceProblemVo>,
#[serde(rename = "troubleTicket")]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub trouble_ticket: Vec<Customer360TroubleTicketVo>,
#[serde(rename = "validFor")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub valid_for: Option<TimePeriod>,
}
impl std::fmt::Display for Customer360 {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
write!(f, "{}", serde_json::to_string(self).unwrap())
}
}
impl std::ops::Deref for Customer360 {
type Target = Entity;
fn deref(&self) -> &Self::Target {
&self.entity
}
}
impl std::ops::DerefMut for Customer360 {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.entity
}
}