//! Admin API endpoints — protected by `x-admin-api-key` header.
//!
//! Only platform-wide operations remain. AI model management and billing
//! are handled directly by the admin Next.js app via database access.

use actix_web::web;

pub mod alerts;
pub mod sync;

pub fn init_admin_routes(cfg: &mut web::ServiceConfig) {
    cfg.service(
        web::scope("/api/admin")
            .route("/health", web::get().to(health_check))
            .route("/ai/sync", web::post().to(sync::admin_sync_models))
            .route("/alerts/check", web::post().to(alerts::admin_check_alerts)),
    );
}

#[utoipa::path(
    get,
    path = "/api/admin/health",
    responses(
        (status = 200, description = "Admin API is healthy"),
    ),
    tag = "Admin"
)]
async fn health_check() -> impl actix_web::Responder {
    actix_web::HttpResponse::Ok().json(serde_json::json!({ "ok": true }))
}
