use mail4agent_api::{Address, ParticipantId, RoomId, SessionCard};
use mail4agent_core::ParticipantPermissions;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize)]
pub struct WhoAmIResponse {
pub address: Address,
pub label: Option<String>,
pub rooms: Vec<RoomId>,
pub card: Option<SessionCard>,
}
#[derive(Debug, Serialize)]
pub struct StatusResponse {
pub card: SessionCard,
}
#[derive(Debug, Deserialize)]
pub struct RegisterParticipantRequest {
pub id: ParticipantId,
#[serde(default)]
pub label: Option<String>,
#[serde(default)]
pub may_send: bool,
#[serde(default)]
pub may_read: bool,
#[serde(default)]
pub operator: bool,
}
impl RegisterParticipantRequest {
pub fn permissions(&self) -> ParticipantPermissions {
ParticipantPermissions {
may_send: self.may_send,
may_read: self.may_read,
operator: self.operator,
}
}
}
#[derive(Debug, Serialize)]
pub struct SecretResponse {
pub id: ParticipantId,
pub secret: String,
}
#[derive(Debug, Deserialize)]
pub struct ParticipantIdRequest {
pub id: ParticipantId,
}
#[derive(Debug, Deserialize)]
pub struct RoomIdRequest {
pub id: RoomId,
}
#[derive(Debug, Deserialize)]
pub struct RoomMemberRequest {
pub room: RoomId,
pub participant: ParticipantId,
}
#[derive(Debug, Serialize)]
pub struct EmptyResponse {}
#[derive(Debug, Deserialize)]
pub struct SetListenerRequest {
pub account: ParticipantId,
pub url: String,
}
#[derive(Debug, Deserialize)]
pub struct RemoveListenerRequest {
pub account: ParticipantId,
}