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

/// TableInfo : Single table metadata
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TableInfo {
    #[serde(
        rename = "columns",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub columns: Option<Option<Vec<models::ColumnInfo>>>,
    #[serde(rename = "connection")]
    pub connection: String,
    #[serde(
        rename = "last_sync",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub last_sync: Option<Option<String>>,
    #[serde(rename = "schema")]
    pub schema: String,
    #[serde(rename = "synced")]
    pub synced: bool,
    #[serde(rename = "table")]
    pub table: String,
}

impl TableInfo {
    /// Single table metadata
    pub fn new(connection: String, schema: String, synced: bool, table: String) -> TableInfo {
        TableInfo {
            columns: None,
            connection,
            last_sync: None,
            schema,
            synced,
            table,
        }
    }
}
