use serde::{Deserialize, Serialize};
use std::collections::HashSet;
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UserProfile {
pub global_id: String,
pub updated_at: i64,
pub mobile: Option<String>,
pub register_time: Option<i64>,
pub register_channel: Option<String>,
pub member_level: Option<String>,
pub email: Option<String>,
pub birthday: Option<String>,
pub is_verified: Option<bool>,
pub nickname: Option<String>,
pub avatar_url: Option<String>,
pub inviter_id: Option<String>,
pub gender: Option<String>,
pub age: Option<u32>,
pub predicted_min_age: Option<u32>,
pub predicted_max_age: Option<u32>,
pub city: Option<String>,
pub province: Option<String>,
pub view_count: u32,
pub cart_count: u32,
pub favorite_count: u32,
pub share_count: u32,
pub comment_count: u32,
pub like_count: u32,
pub last_view_time: Option<i64>,
pub last_cart_time: Option<i64>,
pub last_favorite_time: Option<i64>,
pub last_share_time: Option<i64>,
pub last_comment_time: Option<i64>,
pub last_like_time: Option<i64>,
pub view_count_1d: u32,
pub view_count_3d: u32,
pub view_count_7d: u32,
pub view_count_15d: u32,
pub view_count_30d: u32,
pub view_count_90d: u32,
pub view_count_180d: u32,
pub view_count_360d: u32,
pub view_count_1080d: u32,
pub cart_count_1d: u32,
pub cart_count_3d: u32,
pub cart_count_7d: u32,
pub cart_count_15d: u32,
pub cart_count_30d: u32,
pub cart_count_90d: u32,
pub cart_count_180d: u32,
pub cart_count_360d: u32,
pub cart_count_1080d: u32,
pub favorite_count_1d: u32,
pub favorite_count_3d: u32,
pub favorite_count_7d: u32,
pub favorite_count_15d: u32,
pub favorite_count_30d: u32,
pub favorite_count_90d: u32,
pub favorite_count_180d: u32,
pub favorite_count_360d: u32,
pub favorite_count_1080d: u32,
pub share_count_1d: u32,
pub share_count_3d: u32,
pub share_count_7d: u32,
pub share_count_15d: u32,
pub share_count_30d: u32,
pub share_count_90d: u32,
pub share_count_180d: u32,
pub share_count_360d: u32,
pub share_count_1080d: u32,
pub comment_count_1d: u32,
pub comment_count_3d: u32,
pub comment_count_7d: u32,
pub comment_count_15d: u32,
pub comment_count_30d: u32,
pub comment_count_90d: u32,
pub comment_count_180d: u32,
pub comment_count_360d: u32,
pub comment_count_1080d: u32,
pub like_count_1d: u32,
pub like_count_3d: u32,
pub like_count_7d: u32,
pub like_count_15d: u32,
pub like_count_30d: u32,
pub like_count_90d: u32,
pub like_count_180d: u32,
pub like_count_360d: u32,
pub like_count_1080d: u32,
pub order_count_1d: u32,
pub order_count_3d: u32,
pub order_count_7d: u32,
pub order_count_15d: u32,
pub order_count_30d: u32,
pub order_count_90d: u32,
pub order_count_180d: u32,
pub order_count_360d: u32,
pub order_count_1080d: u32,
pub order_amount_1d: f64,
pub order_amount_3d: f64,
pub order_amount_7d: f64,
pub order_amount_15d: f64,
pub order_amount_30d: f64,
pub order_amount_90d: f64,
pub order_amount_180d: f64,
pub order_amount_360d: f64,
pub order_amount_1080d: f64,
pub payment_count_1d: u32,
pub payment_count_3d: u32,
pub payment_count_7d: u32,
pub payment_count_15d: u32,
pub payment_count_30d: u32,
pub payment_count_90d: u32,
pub payment_count_180d: u32,
pub payment_count_360d: u32,
pub payment_count_1080d: u32,
pub payment_amount_1d: f64,
pub payment_amount_3d: f64,
pub payment_amount_7d: f64,
pub payment_amount_15d: f64,
pub payment_amount_30d: f64,
pub payment_amount_90d: f64,
pub payment_amount_180d: f64,
pub payment_amount_360d: f64,
pub payment_amount_1080d: f64,
pub refund_count_1d: u32,
pub refund_count_3d: u32,
pub refund_count_7d: u32,
pub refund_count_15d: u32,
pub refund_count_30d: u32,
pub refund_count_90d: u32,
pub refund_count_180d: u32,
pub refund_count_360d: u32,
pub refund_count_1080d: u32,
pub refund_amount_1d: f64,
pub refund_amount_3d: f64,
pub refund_amount_7d: f64,
pub refund_amount_15d: f64,
pub refund_amount_30d: f64,
pub refund_amount_90d: f64,
pub refund_amount_180d: f64,
pub refund_amount_360d: f64,
pub refund_amount_1080d: f64,
pub active_days_1d: u32,
pub active_days_3d: u32,
pub active_days_7d: u32,
pub active_days_15d: u32,
pub active_days_30d: u32,
pub active_days_90d: u32,
pub active_days_180d: u32,
pub active_days_360d: u32,
pub active_days_1080d: u32,
pub avg_order_value_1d: f64,
pub avg_order_value_3d: f64,
pub avg_order_value_7d: f64,
pub avg_order_value_15d: f64,
pub avg_order_value_30d: f64,
pub avg_order_value_90d: f64,
pub avg_order_value_180d: f64,
pub avg_order_value_360d: f64,
pub avg_order_value_1080d: f64,
pub max_order_amount_1d: f64,
pub max_order_amount_3d: f64,
pub max_order_amount_7d: f64,
pub max_order_amount_15d: f64,
pub max_order_amount_30d: f64,
pub max_order_amount_90d: f64,
pub max_order_amount_180d: f64,
pub max_order_amount_360d: f64,
pub max_order_amount_1080d: f64,
pub min_order_amount_1d: f64,
pub min_order_amount_3d: f64,
pub min_order_amount_7d: f64,
pub min_order_amount_15d: f64,
pub min_order_amount_30d: f64,
pub min_order_amount_90d: f64,
pub min_order_amount_180d: f64,
pub min_order_amount_360d: f64,
pub min_order_amount_1080d: f64,
pub avg_refund_amount_1d: f64,
pub avg_refund_amount_3d: f64,
pub avg_refund_amount_7d: f64,
pub avg_refund_amount_15d: f64,
pub avg_refund_amount_30d: f64,
pub avg_refund_amount_90d: f64,
pub avg_refund_amount_180d: f64,
pub avg_refund_amount_360d: f64,
pub avg_refund_amount_1080d: f64,
pub recency_days: Option<u32>,
pub frequency_count: u32,
pub monetary_total: f64,
pub login_days_last_30: u32,
pub avg_session_duration_seconds: f32,
pub avg_order_value: f64,
pub refund_rate: f32,
pub rfm_segment: Option<RfmSegment>,
pub cluster_id: Option<u32>,
pub churn_probability: Option<f32>,
pub tags: HashSet<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum RfmSegment {
ImportantRetention,
ImportantDevelopment,
ImportantMaintenance,
ImportantRecovery,
GeneralRetention,
GeneralDevelopment,
GeneralMaintenance,
GeneralRecovery,
}