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

/// SqlQueryDatasetSource : Create dataset from a SQL query (auto-creates a saved query)
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SqlQueryDatasetSource {
    /// Optional description for the auto-created saved query.
    #[serde(
        rename = "description",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub description: Option<Option<String>>,
    /// Optional name for the auto-created saved query. Defaults to the dataset label.
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
    #[serde(rename = "sql")]
    pub sql: String,
}

impl SqlQueryDatasetSource {
    /// Create dataset from a SQL query (auto-creates a saved query)
    pub fn new(sql: String) -> SqlQueryDatasetSource {
        SqlQueryDatasetSource {
            description: None,
            name: None,
            sql,
        }
    }
}
