use actix_web::HttpResponse;
use once_cell::sync::Lazy;
use serde_json::json;
use std::time::Instant;

static START_TIME: Lazy<Instant> = Lazy::new(Instant::now);

pub async fn health_handler() -> HttpResponse {
    let uptime_secs = START_TIME.elapsed().as_secs();
    HttpResponse::Ok().json(json!({
        "status": "ok",
        "uptime_seconds": uptime_secs,
        "service": "dexter-sentinel",
    }))
}
