use std::collections::BTreeSet;
use opentalk_roomserver_signaling::signaling_module::InternalCommand;
use opentalk_roomserver_web_api::v1::livekit_proxy::{WebsocketRequest, WebsocketResponse};
use opentalk_types_signaling::ParticipantId;
use tokio::sync::oneshot;
use crate::MicrophoneRestrictionState;
#[derive(Debug)]
pub enum LiveKitInternal {
Mute {
sender: Option<ParticipantId>,
participants: BTreeSet<ParticipantId>,
return_channel: oneshot::Sender<ParticipantsMuted>,
},
UpdateMicrophoneRestrictions {
sender: ParticipantId,
new_state: MicrophoneRestrictionState,
return_channel:
oneshot::Sender<Result<MicrophoneRestrictionState, MicrophoneRestrictionError>>,
},
ProxyLivekitSocket {
websocket_request: Box<WebsocketRequest>,
return_channel: oneshot::Sender<WebsocketResponse>,
},
GetLivekitServiceUrl {
return_channel: oneshot::Sender<String>,
},
}
#[derive(Debug)]
pub enum MicrophoneRestrictionErrorKind {
ConflictingTask,
LivekitUnavailable,
}
#[derive(Debug)]
pub struct MicrophoneRestrictionError {
pub sender: ParticipantId,
pub error: MicrophoneRestrictionErrorKind,
}
#[derive(Debug)]
pub struct ParticipantsMuted {
pub sender: Option<ParticipantId>,
pub participants: BTreeSet<ParticipantId>,
}
impl InternalCommand for LiveKitInternal {}