use axum::Json;
use axum::http::StatusCode;
use serde::Serialize;
use serde_json::{Value, json};
pub fn data_response<T: Serialize>(item: T) -> Json<Value> {
Json(json!({ "data": item }))
}
pub fn created_response<T: Serialize>(item: T) -> (StatusCode, Json<Value>) {
(StatusCode::CREATED, Json(json!({ "data": item })))
}
pub fn paginated_response<T: Serialize>(
data: Vec<T>,
total: i64,
limit: i64,
offset: i64,
) -> Json<Value> {
Json(json!({
"data": data,
"total": total,
"limit": limit,
"offset": offset,
}))
}