use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Deserialize)]
pub struct MeetingRequest {
pub connection_user_id: String,
pub existing_external_event_id: Option<String>,
pub title: String,
pub description: String,
pub location_url: String,
pub recurrence_rule: String,
pub start: String,
pub end: String,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct MeetingResponse {
pub external_event_id: String,
}
pub type MeetingResult = Result<MeetingResponse, crate::OpError>;
#[derive(Debug, Clone, Default, Deserialize)]
pub struct DeleteMeetingRequest {
pub connection_user_id: String,
pub external_event_id: String,
}
pub type DeleteMeetingResult = Result<(), crate::OpError>;
#[derive(Debug, Clone, Default, Deserialize)]
pub struct FreeBusyRequest {
pub connection_user_id: String,
pub start: String,
pub end: String,
pub exclude_external_event_id: String,
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct FreeBusyResponse {
pub busy: bool,
}
pub type FreeBusyResult = Result<FreeBusyResponse, crate::OpError>;
#[derive(Debug, Clone, Default, Deserialize)]
pub struct EnsureWatchRequest {
pub connection_user_id: String,
}
pub type EnsureWatchResult = Result<(), crate::OpError>;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn meeting_response_serializes_to_the_go_wire_shape() {
let got = serde_json::to_value(MeetingResponse {
external_event_id: "evt_123".into(),
})
.expect("serialize");
assert_eq!(got, serde_json::json!({"external_event_id": "evt_123"}));
}
#[test]
fn meeting_request_decodes_the_host_input() {
let req: MeetingRequest = serde_json::from_str(
r#"{"connection_user_id":"u1","existing_external_event_id":null,"title":"Renewal call","description":"","location_url":"","recurrence_rule":"","start":"2026-08-12T10:00:00Z","end":"2026-08-12T10:30:00Z"}"#,
)
.expect("decode");
assert_eq!(req.connection_user_id, "u1");
assert_eq!(req.existing_external_event_id, None);
assert_eq!(req.title, "Renewal call");
}
#[test]
fn free_busy_response_serializes_to_the_go_wire_shape() {
let got = serde_json::to_value(FreeBusyResponse { busy: true }).expect("serialize");
assert_eq!(got, serde_json::json!({"busy": true}));
}
}