using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;

namespace ZB.MOM.WW.OtOpcUa.AdminUI.Hubs;

/// <summary>Extension methods for mapping OtOpcUa SignalR hubs to routes.</summary>
public static class HubRouteBuilderExtensions
{
    /// <summary>
    ///     Maps all OtOpcUa Admin UI SignalR hubs to their configured endpoints.
    /// </summary>
    /// <param name="app">The endpoint route builder to register hubs on.</param>
    /// <returns>The same endpoint route builder, for chaining.</returns>
    public static IEndpointRouteBuilder MapOtOpcUaHubs(this IEndpointRouteBuilder app)
    {
        app.MapHub<FleetStatusHub>(FleetStatusHub.Endpoint);
        app.MapHub<AlertHub>(AlertHub.Endpoint);
        app.MapHub<ScriptLogHub>(ScriptLogHub.Endpoint);
        app.MapHub<DriverStatusHub>(DriverStatusHub.Endpoint);
        return app;
    }
}
