using Connected.Configuration;
using Connected.Net.Endpoints;
namespace Connected.Net.Server;
///
/// Contains information about the currently active endpoint server. There is only one endpoint server at one point in the environment.
/// In the case of a single instance environment the points to this instance.
///
internal class EndpointServerDescriptor
{
///
/// Create a new instance of the
///
/// The currently server. Could be null if there are no endpoints defined.
///
public EndpointServerDescriptor(IEndpoint? endpoint, IConfigurationService configurationService)
{
Endpoint = endpoint;
IsRemote = Endpoint is not null && !string.Equals(configurationService.Endpoint.Address, Endpoint.Address, StringComparison.OrdinalIgnoreCase);
}
///
/// The Endpoint information about the server. This could point to this instance or can be null which also means
/// this instance is an .
///
public IEndpoint? Endpoint { get; }
///
/// Returns true
if the Endpoint server is not this instance.
///
public bool IsRemote { get; }
}