/*
 * 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};

/// ColumnProfileInfo : Statistics for a single column.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ColumnProfileInfo {
    /// Approximate number of distinct non-null values
    #[serde(rename = "cardinality")]
    pub cardinality: i64,
    /// Arrow data type (e.g. \"Utf8\", \"Int32\", \"Timestamp(Microsecond, Some(\\\"UTC\\\"))\")
    #[serde(rename = "data_type")]
    pub data_type: String,
    /// Column name
    #[serde(rename = "name")]
    pub name: String,
    /// Number of null values
    #[serde(rename = "null_count")]
    pub null_count: i64,
    /// Percentage of null values (0.0 to 100.0)
    #[serde(rename = "null_percentage")]
    pub null_percentage: f64,
    #[serde(
        rename = "profile",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub profile: Option<Option<Box<models::ColumnProfileDetail>>>,
}

impl ColumnProfileInfo {
    /// Statistics for a single column.
    pub fn new(
        cardinality: i64,
        data_type: String,
        name: String,
        null_count: i64,
        null_percentage: f64,
    ) -> ColumnProfileInfo {
        ColumnProfileInfo {
            cardinality,
            data_type,
            name,
            null_count,
            null_percentage,
            profile: None,
        }
    }
}
