using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.SignalR;

namespace RobotNet.ScriptManager.Hubs;

[Authorize]
public class ConsoleHub : Hub
{
    public Task RegisterTasksConsole(string name) => Groups.AddToGroupAsync(Context.ConnectionId, $"task-{name}");
    public Task UnregisterTasksConsole(string name) => Groups.RemoveFromGroupAsync(Context.ConnectionId, $"task-{name}");
    public Task RegisterTaskConsoles() => Groups.AddToGroupAsync(Context.ConnectionId, "tasks");
    public Task UnregisterTaskConsoles() => Groups.RemoveFromGroupAsync(Context.ConnectionId, "tasks");
    public Task RegisterMissionConsole(Guid missionId) => Groups.AddToGroupAsync(Context.ConnectionId, $"mission-{missionId}");
    public Task UnregisterMissionConsole(Guid missionId) => Groups.RemoveFromGroupAsync(Context.ConnectionId, $"mission-{missionId}");
    public Task RegisterMissionConsoles() => Groups.AddToGroupAsync(Context.ConnectionId, "missions");
    public Task UnregisterMissionConsoles() => Groups.RemoveFromGroupAsync(Context.ConnectionId, "missions");
    public Task RegisterAllConsoles() => Groups.AddToGroupAsync(Context.ConnectionId, "alls");
    public Task UnregisterAllConsoles() => Groups.RemoveFromGroupAsync(Context.ConnectionId, "alls");

}
