use super::channel;
use super::object::Object;
use super::uuid::UUID;
use std::collections::HashMap;
pub mod respond_with {
#[derive(Debug, Clone, Copy)]
pub struct OccupancyOnly;
#[derive(Debug, Clone, Copy)]
pub struct OccupancyAndUUIDs;
#[derive(Debug, Clone, Copy)]
pub struct Full;
pub trait RespondWith {
type Response;
}
use super::{ChannelInfo, ChannelInfoWithOccupants, ChannelOccupantFullDetails, UUID};
impl RespondWith for OccupancyOnly {
type Response = ChannelInfo;
}
impl RespondWith for OccupancyAndUUIDs {
type Response = ChannelInfoWithOccupants<UUID>;
}
impl RespondWith for Full {
type Response = ChannelInfoWithOccupants<ChannelOccupantFullDetails>;
}
}
#[allow(missing_copy_implementations)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChannelInfo {
pub occupancy: u64,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChannelInfoWithOccupants<T> {
pub occupancy: u64,
pub occupants: Vec<T>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ChannelOccupantFullDetails {
pub uuid: UUID,
pub state: Object,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GlobalInfo<T: respond_with::RespondWith> {
pub total_channels: u64,
pub total_occupancy: u64,
pub channels: HashMap<channel::Name, T::Response>,
}