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

/// ColumnTypeSpec : Detailed column type specification with optional properties.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ColumnTypeSpec {
    /// Geometry type for GEOMETRY/GEOGRAPHY columns. E.g., \"Point\", \"LineString\", \"Polygon\", \"MultiPoint\", \"MultiLineString\", \"MultiPolygon\", \"GeometryCollection\", or \"Geometry\" (any).
    #[serde(
        rename = "geometry_type",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub geometry_type: Option<Option<String>>,
    /// Precision for DECIMAL type (1-38)
    #[serde(
        rename = "precision",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub precision: Option<Option<i32>>,
    /// Scale for DECIMAL type
    #[serde(
        rename = "scale",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub scale: Option<Option<i32>>,
    /// Spatial Reference System Identifier for GEOMETRY/GEOGRAPHY types. Common values: 4326 (WGS84), 3857 (Web Mercator).
    #[serde(
        rename = "srid",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub srid: Option<Option<i32>>,
    /// The data type name (e.g., \"DECIMAL\", \"TIMESTAMP\", \"GEOMETRY\")
    #[serde(rename = "type")]
    pub r#type: String,
}

impl ColumnTypeSpec {
    /// Detailed column type specification with optional properties.
    pub fn new(r#type: String) -> ColumnTypeSpec {
        ColumnTypeSpec {
            geometry_type: None,
            precision: None,
            scale: None,
            srid: None,
            r#type,
        }
    }
}
