/*
 * Hotdata API
 *
 * Powerful data platform API for datasets, queries, and analytics.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: developers@hotdata.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// CategoryValueInfo : A distinct value with its frequency count, used in categorical profiles.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CategoryValueInfo {
    /// Number of occurrences
    #[serde(rename = "count")]
    pub count: i64,
    /// The distinct value (as a string, or null)
    #[serde(
        rename = "value",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub value: Option<Option<String>>,
}

impl CategoryValueInfo {
    /// A distinct value with its frequency count, used in categorical profiles.
    pub fn new(count: i64) -> CategoryValueInfo {
        CategoryValueInfo { count, value: None }
    }
}
