use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use serde_json::Value;

pub fn success_response(result: &Value) -> Response {
    axum::Json(result.clone()).into_response()
}

pub fn list_response(operation: &str, items: &[Value]) -> Response {
    axum::Json(serde_json::json!({ operation: items })).into_response()
}

pub fn error_response(status: StatusCode, code: &str, message: &str) -> Response {
    let body = serde_json::json!({
        "__type": code,
        "message": message,
    });
    (status, axum::Json(body)).into_response()
}
