/*
 * Orvanta API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.2
 * Contact: contact@orvanta.cloud
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// HealthStatusResponse : Health status response (cached with 5s TTL)
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct HealthStatusResponse {
    /// Overall health status
    #[serde(rename = "status")]
    pub status: Status,
    /// Timestamp when the health check was actually performed (not cache return time)
    #[serde(rename = "checked_at")]
    pub checked_at: String,
    /// Whether the database is reachable
    #[serde(rename = "database_healthy")]
    pub database_healthy: bool,
    /// Number of workers that pinged within last 5 minutes
    #[serde(rename = "workers_alive")]
    pub workers_alive: i64,
}

impl HealthStatusResponse {
    /// Health status response (cached with 5s TTL)
    pub fn new(status: Status, checked_at: String, database_healthy: bool, workers_alive: i64) -> HealthStatusResponse {
        HealthStatusResponse {
            status,
            checked_at,
            database_healthy,
            workers_alive,
        }
    }
}
/// Overall health status
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "healthy")]
    Healthy,
    #[serde(rename = "degraded")]
    Degraded,
    #[serde(rename = "unhealthy")]
    Unhealthy,
}

impl Default for Status {
    fn default() -> Status {
        Self::Healthy
    }
}

