use serde::{Deserialize, Serialize};
#[cfg(feature = "openapi")]
use utoipa::ToSchema;
#[derive(Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "openapi", derive(ToSchema))]
#[cfg_attr(feature = "openapi", schema(
title ="Generic error response for API endpoints",
example = json!({
"error": "Resource not found",
"details": {
"resource_type": "contact",
"resource_id": "507f1f77bcf86cd799439011"
}
})
))]
pub struct ErrorResponse {
#[cfg_attr(feature = "openapi", schema(example = "Resource not found"))]
pub error: String,
#[cfg_attr(feature = "openapi", schema(example = json!({"field": "email", "reason": "already_exists"})))]
pub details: Option<serde_json::Value>,
}