using System;
using System.Net;

namespace Crysome.Common.Network.Transport;

public interface ITransportSession : IDisposable, IAsyncDisposable
{
	bool IsAlive { get; }

	IPEndPoint RemoteEndPoint { get; }

	IPEndPoint LocalEndPoint { get; }

	double RttMs { get; }

	double LossRate { get; }

	long BytesSent { get; }

	long BytesRecv { get; }

	event Action<byte[]> ReliableReceived;

	event Action<byte, byte[]> UnreliableFrameReceived;

	event Action<double> CongestionChanged;

	event Action Disconnected;

	void SendReliable(ReadOnlySpan<byte> payload);

	void SendReliableBulk(ReadOnlySpan<byte> payload);

	void SendUnreliableScreen(byte packetTypeId, ReadOnlySpan<byte> payload);

	void SendPacketUnreliable(ReadOnlySpan<byte> payload);

	void SendFin();
}
