using System;
namespace FishNet.Transporting
{
    /// 
    /// Container about data received on the server.
    /// 
    public struct ServerReceivedDataArgs
    {
        /// 
        /// Data received.
        /// 
        public ArraySegment Data;
        /// 
        /// Channel data was received on.
        /// 
        public Channel Channel;
        /// 
        /// ConnectionId from which client sent data, if data was received on the server.
        /// 
        public int ConnectionId;
        /// 
        /// Index of the transport that is for.
        /// This is primarily used when supporting multiple transports.
        /// 
        public int TransportIndex;
        /// 
        /// Delegate to invoke after data is processed.
        /// 
        /// 
        public Action FinalizeMethod;
        public ServerReceivedDataArgs(ArraySegment data, Channel channel, int connectionId, int transportIndex)
        {
            Data = data;
            Channel = channel;
            ConnectionId = connectionId;
            TransportIndex = transportIndex;
            FinalizeMethod = null;
        }
        public ServerReceivedDataArgs(ArraySegment data, Channel channel, int connectionId, int transportIndex, Action finalizeMethod)
        {
            Data = data;
            Channel = channel;
            ConnectionId = connectionId;
            TransportIndex = transportIndex;
            FinalizeMethod = finalizeMethod;
        }
    }
    /// 
    /// Container about data received on the local client.
    /// 
    public struct ClientReceivedDataArgs
    {
        /// 
        /// Data received.
        /// 
        public ArraySegment Data;
        /// 
        /// Channel data was received on.
        /// 
        public Channel Channel;
        /// 
        /// Index of the transport that is for.
        /// This is primarily used when supporting multiple transports.
        /// 
        public int TransportIndex;
        public ClientReceivedDataArgs(ArraySegment data, Channel channel, int transportIndex)
        {
            Data = data;
            Channel = channel;
            TransportIndex = transportIndex;
        }
    }
    /// 
    /// Container about a connection state change for a client.
    /// 
    public struct RemoteConnectionStateArgs
    {
        /// 
        /// Index of the transport that is for.
        /// This is primarily used when supporting multiple transports.
        /// 
        public int TransportIndex;
        /// 
        /// New connection state.
        /// 
        public RemoteConnectionState ConnectionState;
        /// 
        /// ConnectionId for which client the state changed. Will be -1 if ConnectionState was for the local server.
        /// 
        public int ConnectionId;
        public RemoteConnectionStateArgs(RemoteConnectionState connectionState, int connectionId, int transportIndex)
        {
            ConnectionState = connectionState;
            ConnectionId = connectionId;
            TransportIndex = transportIndex;
        }
    }
    /// 
    /// Container about a connection state change for the server.
    /// 
    public struct ServerConnectionStateArgs
    {
        /// 
        /// Index of the transport that is for.
        /// This is primarily used when supporting multiple transports.
        /// 
        public int TransportIndex;
        /// 
        /// New connection state.
        /// 
        public LocalConnectionState ConnectionState;
        public ServerConnectionStateArgs(LocalConnectionState connectionState, int transportIndex)
        {            
            ConnectionState = connectionState;
            TransportIndex = transportIndex;
        }
    }
    /// 
    /// Container about a connection state change for the local client.
    /// 
    public struct ClientConnectionStateArgs
    {
        /// 
        /// New connection state.
        /// 
        public LocalConnectionState ConnectionState;
        /// 
        /// Index of the transport that is for.
        /// This is primarily used when supporting multiple transports.
        /// 
        public int TransportIndex;
        public ClientConnectionStateArgs(LocalConnectionState connectionState, int transportIndex)
        {            
            ConnectionState = connectionState;
            TransportIndex = transportIndex;
        }
    }
}