use chrono::{DateTime, NaiveDateTime};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[allow(dead_code)]
pub(crate) trait Timestamp {
fn timestamp_from_nanos(&self) -> Option<NaiveDateTime>;
}
impl Timestamp for i64 {
fn timestamp_from_nanos(&self) -> Option<NaiveDateTime> {
let nanos = self % 1_000_000_000;
let seconds = (self - nanos) / 1_000_000_000;
let dt = DateTime::from_timestamp(seconds, nanos as u32);
dt.map(|dt| dt.naive_utc())
}
}
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
#[schemars(rename = "health")]
pub struct Health {
pub healthy: bool,
}