use crate::{
    config::*,
    socket_connection_handler::Peer,
    ReactiveMessagingSerializer,
};
use std::{
    fmt::Debug,
    sync::Arc,
};
use reactive_mutiny::prelude::advanced::{
    UniZeroCopyAtomic,
    ChannelUniZeroCopyAtomic,
    OgreUnique,
    AllocatorAtomicArray,
};
pub(crate) type SenderChannel<ItemType, const BUFFER_SIZE: usize> = reactive_mutiny::uni::channels::movable::atomic::Atomic::<'static, ItemType, BUFFER_SIZE, 1>;
pub(crate) type SocketProcessorUniType<MessagesType>     = UniZeroCopyAtomic<MessagesType, RECEIVER_BUFFER_SIZE, 1, SOCKET_PROCESSOR_INSTRUMENTS>;
pub(crate) type SocketProcessorChannelType<MessagesType> = ChannelUniZeroCopyAtomic<MessagesType, RECEIVER_BUFFER_SIZE, 1>;
pub        type SocketProcessorDerivedType<MessagesType> = OgreUnique<MessagesType, AllocatorAtomicArray<MessagesType, RECEIVER_BUFFER_SIZE>>;
#[derive(Debug)]
pub enum ConnectionEvent<LocalPeerMessages:  'static + Send + Sync + PartialEq + Debug + ReactiveMessagingSerializer<LocalPeerMessages>> {
    PeerConnected {peer: Arc<Peer<LocalPeerMessages>>},
    PeerDisconnected {peer: Arc<Peer<LocalPeerMessages>>, stream_stats: Arc<reactive_mutiny::stream_executor::StreamExecutor>},
    ApplicationShutdown {timeout_ms: u32},
}