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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatasetSourceOneOf2 {
    /// Optional description for the auto-created saved query.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Optional name for the auto-created saved query. Defaults to the dataset label.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(rename = "sql")]
    pub sql: String,
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl DatasetSourceOneOf2 {
    pub fn new(sql: String, r#type: Type) -> DatasetSourceOneOf2 {
        DatasetSourceOneOf2 {
            description: None,
            name: None,
            sql,
            r#type,
        }
    }
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "sql_query")]
    SqlQuery,
}

impl Default for Type {
    fn default() -> Type {
        Self::SqlQuery
    }
}
