using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.SignalR;

namespace adas_core.Application.Services.Interfaces;

public interface IClientMessageService
{
    /// <summary>
    /// Asynchronously sends a message to the specified receiver, optionally categorized by an operation type.
    /// </summary>
    /// <param name="receiverId">The identifier of the intended message receiver.</param>
    /// <param name="type">The optional operation type used to classify the message.</param>
    /// <param name="msg">The optional message payload to be sent.</param>
    /// <returns>A task that represents the asynchronous send operation.</returns>
    Task SendAsync(string receiverId, OperationType? type, object? msg);
    /// <summary>
    /// Asynchronously broadcasts a message of the specified operation type to all connected recipients.
    /// </summary>
    /// <param name="type">The operation type that classifies the broadcast message.</param>
    /// <param name="msg">The message payload to send, or <c>null</c> when no payload is required.</param>
    /// <returns>A task that represents the asynchronous broadcast operation.</returns>
    Task SendToAllAsync(OperationType type, object? msg);
    /// <summary>
    /// Processes an incoming message within the context of the specified connection.
    /// </summary>
    /// <param name="msg">The message to be processed.</param>
    /// <param name="contextConnectionId">The identifier of the connection context associated with the message.</param>
    Task ProcessMessage(Message msg, string contextConnectionId);
    /// <summary>
    /// Sends an update message to the specified list of patient location boxes.
    /// </summary>
    /// <param name="boxes">The list of patient locations that will receive the update message.</param>
    void SendUpdateMessageToBoxes(List<PatientLocation> boxes);
}