namespace MinicsConsole.Hubs.UI;

public partial class UIHub(
    UISender uIConnector,
    UserOperator userOperator,
    DatabaseOperator databaseOperator,
    HardwareOperator hardwareOperator,
    ConfigFileOperator configFileOperator) : Hub
{
    public override Task OnConnectedAsync()
    {
        uIConnector.Clients = this.Clients;
        return base.OnConnectedAsync();
    }

    public override Task OnDisconnectedAsync(Exception? exception)
    {
        uIConnector.Clients = null;
        return base.OnDisconnectedAsync(exception);
    }

    public void ShutDown()
    {
        Program.WebApplication?.StopAsync();
    }
}