pub struct CustomerEngagement {
pub total_orders: u32,
pub orders_last_12_months: u32,
pub lifetime_revenue: Decimal,
pub revenue_last_12_months: Decimal,
pub average_order_value: Decimal,
pub days_since_last_order: u32,
pub last_order_date: Option<NaiveDate>,
pub first_order_date: Option<NaiveDate>,
pub products_purchased: u32,
pub support_tickets: u32,
pub nps_score: Option<i8>,
}Expand description
Customer engagement metrics.
Fields§
§total_orders: u32Total orders placed
orders_last_12_months: u32Orders in the last 12 months
lifetime_revenue: DecimalTotal revenue (lifetime)
revenue_last_12_months: DecimalRevenue in the last 12 months
average_order_value: DecimalAverage order value
days_since_last_order: u32Days since last order
last_order_date: Option<NaiveDate>Last order date
first_order_date: Option<NaiveDate>First order date
products_purchased: u32Number of products purchased
support_tickets: u32Support tickets created
nps_score: Option<i8>Net promoter score (if available)
Implementations§
Source§impl CustomerEngagement
impl CustomerEngagement
Sourcepub fn record_order(
&mut self,
amount: Decimal,
order_date: NaiveDate,
product_count: u32,
)
pub fn record_order( &mut self, amount: Decimal, order_date: NaiveDate, product_count: u32, )
Record an order.
Sourcepub fn update_days_since_last_order(&mut self, current_date: NaiveDate)
pub fn update_days_since_last_order(&mut self, current_date: NaiveDate)
Update days since last order (call periodically).
Sourcepub fn health_score(&self) -> f64
pub fn health_score(&self) -> f64
Calculate customer health score (0.0 to 1.0).
Trait Implementations§
Source§impl Clone for CustomerEngagement
impl Clone for CustomerEngagement
Source§fn clone(&self) -> CustomerEngagement
fn clone(&self) -> CustomerEngagement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CustomerEngagement
impl Debug for CustomerEngagement
Source§impl Default for CustomerEngagement
impl Default for CustomerEngagement
Source§impl<'de> Deserialize<'de> for CustomerEngagement
impl<'de> Deserialize<'de> for CustomerEngagement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CustomerEngagement
impl RefUnwindSafe for CustomerEngagement
impl Send for CustomerEngagement
impl Sync for CustomerEngagement
impl Unpin for CustomerEngagement
impl UnwindSafe for CustomerEngagement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more