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

/// ConnectionHealthResponse : Response body for GET /connections/{connection_id}/health
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ConnectionHealthResponse {
    #[serde(rename = "connection_id")]
    pub connection_id: String,
    #[serde(
        rename = "error",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub error: Option<Option<String>>,
    #[serde(rename = "healthy")]
    pub healthy: bool,
    #[serde(rename = "latency_ms")]
    pub latency_ms: i64,
}

impl ConnectionHealthResponse {
    /// Response body for GET /connections/{connection_id}/health
    pub fn new(connection_id: String, healthy: bool, latency_ms: i64) -> ConnectionHealthResponse {
        ConnectionHealthResponse {
            connection_id,
            error: None,
            healthy,
            latency_ms,
        }
    }
}
