#![allow(dead_code)]
#![allow(unused_imports)]
#![allow(clippy::redundant_pattern_matching)]
use crate::config::AppState;
use axum::{extract::State, response::Json};
use serde_json::{json, Value};

pub async fn health_check(State(state): State<AppState>) -> Json<Value> {
    let status = if let Ok(_) = state.db.health_check().await {
        "connected"
    } else {
        "error"
    };

    // Use timestamp_millis for consistency with other endpoints
    let timestamp = mongodb::bson::DateTime::now().timestamp_millis();

    Json(json!({
        "status": "ok",
        "database": status,
        "timestamp": timestamp
    }))
}

pub async fn ready_check() -> Json<Value> {
    Json(json!({
        "status": "ready"
    }))
}
