using Microsoft.AspNetCore.SignalR.Client;
using RemoteExec.Shared.Models;
using System.Threading.Channels;
namespace RemoteExec.Client;
///
/// Represents a connection to a remote execution server, including communication channels and metrics.
///
public class ServerConnection(HubConnection connection, HttpClient httpClient)
{
///
/// Gets the SignalR hub connection to the server.
///
public HubConnection Connection { get; } = connection;
///
/// Gets the HTTP client for REST API communication with the server.
///
public HttpClient HttpClient { get; } = httpClient;
///
/// Gets the channel used to queue tasks for this server.
///
public Channel TaskChannel { get; } = Channel.CreateUnbounded();
///
/// Gets or sets the current metrics for this server.
///
public ServerMetrics? Metrics { get; set; }
///
/// Gets or sets the handler for connection closed events.
///
public Func? ClosedEventHandler { get; set; }
}