//! Shared Athena availability checks for admin APIs (503 + client borrow).

use actix_web::HttpResponse;
use athena_rs::AthenaClient;
use serde_json::json;
use std::sync::Arc;

use crate::AppState;

pub fn no_athena_response() -> HttpResponse {
    HttpResponse::ServiceUnavailable().json(json!({
        "error": "Athena is not configured; set ATHENA_URL and ATHENA_API_KEY"
    }))
}

pub fn athena_client(state: &AppState) -> Option<&Arc<AthenaClient>> {
    state.athena.as_ref()
}
