namespace Universal.IO;

public enum ConnectionType
{
    None = 0,
    Serial,
    Tcp,
    Udp,
    Pipe
}

public class Connection(ConnectionType connectionType)
{
    public ConnectionType ConnectionType { get; } = connectionType;
}

public class TcpConnection(IPEndPoint localEndPoint, IPEndPoint remoteEndPoint, TcpClient tcpClient) : Connection(ConnectionType.Tcp)
{
    public IPEndPoint LocalEndPoint { get; } = localEndPoint;
    public IPEndPoint RemoteEndPoint { get; } = remoteEndPoint;

    public TcpClient TcpClient { get; } = tcpClient;
}

public class SerialConnection(string serialPortName, SerialPort serialPort) : Connection(ConnectionType.Serial)
{
    public string SerialPortName { get; } = serialPortName;

    public SerialPort SerialPort { get; } = serialPort;
}
