using System.Net;
using System.Net.Sockets;

namespace eSuite.API.HealthChecks;

/// <summary>
/// Interface that allows a socket to be created and mocked
/// </summary>
public interface ISocketFacade : IDisposable
{
    /// <summary>
    /// Calls the socket connect method.
    /// </summary>
    /// <param name="endPoint"></param>
    void Connect(IPEndPoint endPoint);
    
    /// <summary>
    /// Calls the socket Send method.
    /// </summary>
    /// <param name="dataArray"></param>
    /// <param name="offset"></param>
    /// <param name="size"></param>
    /// <param name="socketFlags"></param>
    void Send(byte[] dataArray, int offset, int size, SocketFlags socketFlags);
    
    /// <summary>
    /// Number of bytes available for reading
    /// </summary>
    int Available { get; }
    
    /// <summary>
    /// Receive data from the socket using the parameters provided
    /// </summary>
    /// <param name="responseArray"></param>
    /// <param name="offset"></param>
    /// <param name="size"></param>
    /// <param name="socketFlags"></param>
    /// <returns></returns>
    int Receive(byte[] responseArray, int offset, int size, SocketFlags socketFlags);
}