use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize)]
pub struct UsagePayload<'a> {
    pub product: &'a str,
    pub feature: &'a str,
    pub date: &'a str,
    pub device_fp: &'a str,
    pub action: &'a str,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub count: Option<u32>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub platform: Option<&'a str>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub device_type: Option<&'a str>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub app_version: Option<&'a str>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct UsageResponse {
    pub count: u32,
    pub limit: Option<u32>,
    #[serde(default)]
    pub period: Option<String>,
    pub allowed: bool,
}
