using Opc.Ua;

namespace ZB.MOM.WW.OtOpcUa.Client.Shared.Adapters;

/// <summary>
///     Abstracts OPC UA endpoint discovery for testability.
/// </summary>
internal interface IEndpointDiscovery
{
    /// <summary>
    ///     Discovers endpoints at the given URL and returns the best match for the requested security mode.
    ///     Also rewrites the endpoint URL hostname to match the requested URL when they differ.
    /// </summary>
    /// <param name="config">The OPC UA application configuration.</param>
    /// <param name="endpointUrl">The endpoint URL to discover.</param>
    /// <param name="requestedMode">The requested message security mode.</param>
    /// <returns>The best-matching endpoint description, with its URL hostname rewritten to match <paramref name="endpointUrl"/> when they differ.</returns>
    EndpointDescription SelectEndpoint(ApplicationConfiguration config, string endpointUrl,
        MessageSecurityMode requestedMode);
}