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

/// CreateDatasetRequest : Request body for POST /v1/datasets
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateDatasetRequest {
    #[serde(rename = "label")]
    pub label: String,
    #[serde(rename = "source")]
    pub source: Box<models::DatasetSource>,
    /// Optional storage backend: `\"parquet\"` (default) or `\"ducklake\"`. `\"ducklake\"` requires `ducklake.metadata_pg_url` to be configured at engine boot; the engine also rejects the combo of `storage_backend: \"ducklake\"` with a saved-query source or with explicit geometry columns (both deferred to a follow-up).
    #[serde(
        rename = "storage_backend",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub storage_backend: Option<Option<String>>,
    /// Optional table_name - if not provided, derived from label
    #[serde(
        rename = "table_name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub table_name: Option<Option<String>>,
}

impl CreateDatasetRequest {
    /// Request body for POST /v1/datasets
    pub fn new(label: String, source: models::DatasetSource) -> CreateDatasetRequest {
        CreateDatasetRequest {
            label,
            source: Box::new(source),
            storage_backend: None,
            table_name: None,
        }
    }
}
