use serde::Serialize;
use uuid::Uuid;
#[derive(Debug, Clone, Serialize)]
pub struct RestoreCapabilitiesRequest<'a> {
pub intents: &'a [&'a str],
}
#[derive(Debug, Clone, Serialize)]
pub struct RestoreCredentialsRequest<'a> {
pub group: Uuid,
pub r#type: &'a str,
}
#[cfg(test)]
mod tests {
use serde_json::json;
use super::*;
#[test]
fn capabilities_request_lists_intents() {
let intents = ["verify", "analytics", "disaster-recovery"];
let req = RestoreCapabilitiesRequest { intents: &intents };
assert_eq!(
serde_json::to_value(&req).unwrap(),
json!({"intents": ["verify", "analytics", "disaster-recovery"]})
);
}
#[test]
fn credentials_request_carries_group_and_type() {
let group = "11111111-1111-1111-1111-111111111111".parse().unwrap();
let req = RestoreCredentialsRequest {
group,
r#type: "tamanu-postgres",
};
assert_eq!(
serde_json::to_value(&req).unwrap(),
json!({
"group": "11111111-1111-1111-1111-111111111111",
"type": "tamanu-postgres",
})
);
}
}