using DotNetty.Transport.Channels;
using System;
using System.Text;
using Team.Communicate.Data;

namespace Team.Communicate.EventArg
{
    public class TcpStateEventArgs : EventArgs
    {
        public TcpConnection ServerConnection { get; }

        public TcpStateEventArgs(TcpConnection serverConnection)
        {
            ServerConnection = serverConnection;
        }
    }

    public class UnRegisterEventArgs : EventArgs
    {
        public UnRegisterContent ServerConnection { get; }

        public UnRegisterEventArgs(UnRegisterContent serverConnection)
        {
            ServerConnection = serverConnection;
        }
    }

    public record UnRegisterContent
    {
        public string Content { get;  }
        public Encoding Encoding { get; set; }
        public IChannelHandlerContext ChannelHandlerContext { get; }
        public UnRegisterContent(string content, IChannelHandlerContext channelHandlerContext,Encoding encoding)
          => (Content, ChannelHandlerContext,Encoding) = (content, channelHandlerContext, encoding);
        public void Deconstruct(out string content, out IChannelHandlerContext channelHandlerContext,out Encoding encoding)
          => (content, channelHandlerContext,encoding) = (Content, ChannelHandlerContext,Encoding);
    }
  
}