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

/// DatabaseDetailResponse : Response body for GET /databases/{database_id}
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatabaseDetailResponse {
    #[serde(rename = "attachments")]
    pub attachments: Vec<models::DatabaseAttachmentInfo>,
    /// Name the database's default catalog answers to inside its query scope (`default` unless overridden at create time).
    #[serde(rename = "default_catalog")]
    pub default_catalog: String,
    #[serde(rename = "default_connection_id")]
    pub default_connection_id: String,
    /// When this database expires.
    #[serde(
        rename = "expires_at",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub expires_at: Option<Option<String>>,
    #[serde(rename = "id")]
    pub id: String,
    #[serde(
        rename = "name",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub name: Option<Option<String>>,
}

impl DatabaseDetailResponse {
    /// Response body for GET /databases/{database_id}
    pub fn new(
        attachments: Vec<models::DatabaseAttachmentInfo>,
        default_catalog: String,
        default_connection_id: String,
        id: String,
    ) -> DatabaseDetailResponse {
        DatabaseDetailResponse {
            attachments,
            default_catalog,
            default_connection_id,
            expires_at: None,
            id,
            name: None,
        }
    }
}
