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

/// TableRefreshResult : Result payload for a `data_refresh_table` job.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TableRefreshResult {
    #[serde(rename = "connection_id")]
    pub connection_id: String,
    #[serde(rename = "duration_ms")]
    pub duration_ms: i64,
    #[serde(rename = "rows_synced")]
    pub rows_synced: i32,
    #[serde(rename = "schema_name")]
    pub schema_name: String,
    #[serde(rename = "table_name")]
    pub table_name: String,
    #[serde(rename = "warnings", skip_serializing_if = "Option::is_none")]
    pub warnings: Option<Vec<models::RefreshWarning>>,
}

impl TableRefreshResult {
    /// Result payload for a `data_refresh_table` job.
    pub fn new(
        connection_id: String,
        duration_ms: i64,
        rows_synced: i32,
        schema_name: String,
        table_name: String,
    ) -> TableRefreshResult {
        TableRefreshResult {
            connection_id,
            duration_ms,
            rows_synced,
            schema_name,
            table_name,
            warnings: None,
        }
    }
}
