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

/// SchemaRefreshResult : Response for schema refresh operations
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SchemaRefreshResult {
    #[serde(rename = "connections_failed")]
    pub connections_failed: i32,
    #[serde(rename = "connections_refreshed")]
    pub connections_refreshed: i32,
    #[serde(rename = "errors", skip_serializing_if = "Option::is_none")]
    pub errors: Option<Vec<models::ConnectionSchemaError>>,
    #[serde(rename = "tables_added")]
    pub tables_added: i32,
    #[serde(rename = "tables_discovered")]
    pub tables_discovered: i32,
    #[serde(rename = "tables_modified")]
    pub tables_modified: i32,
}

impl SchemaRefreshResult {
    /// Response for schema refresh operations
    pub fn new(
        connections_failed: i32,
        connections_refreshed: i32,
        tables_added: i32,
        tables_discovered: i32,
        tables_modified: i32,
    ) -> SchemaRefreshResult {
        SchemaRefreshResult {
            connections_failed,
            connections_refreshed,
            errors: None,
            tables_added,
            tables_discovered,
            tables_modified,
        }
    }
}
