using adas_core.Domain.Enums;
using adas_core.Domain.Models;
using adas_core.Domain.Models.DTO;
using adas_core.Domain.Models.MongoModels;
using adas_core.Domain.Models.Recording;
using Patient = adas_core.Domain.Models.MongoModels.Patient;

namespace adas_core.Application.Services.Interfaces;

public interface IRecordingService : IApiRequestService
{
    /// <summary>
    /// Asynchronously sends a cancel recording request to the recording API for the specified patient and point of care.
    /// </summary>
    /// <param name="patient">The patient whose recording should be cancelled.</param>
    /// <param name="poc">The point of care associated with the recording to be cancelled.</param>
    /// <returns>A task that represents the asynchronous operation, containing a boolean value indicating the outcome of the cancel recording request.</returns>
    Task<bool> SendCancelRecordingToRecordingApi(Patient patient, PointOfCare poc);

    /// <summary>
    /// Queues alarm recording data for the specified patient at the given point of care,
    /// using the provided alarm details to be processed asynchronously.
    /// </summary>
    /// <param name="patient">The patient associated with the recording data.</param>
    /// <param name="poc">The point of care where the recording originated.</param>
    /// <param name="date">The start date of the recording, if applicable.</param>
    /// <param name="endDate">The end date of the recording, if applicable.</param>
    /// <param name="eventDate">The date of the event, if applicable.</param>
    /// <param name="alarmName">The name of the alarm, if applicable.</param>
    /// <param name="severity">The severity level of the alarm.</param>
    /// <param name="alarmDescription">The description of the alarm, if applicable.</param>
    /// <param name="start">Indicates whether to start the recording (default is true).</param>
    /// <param name="type">The type of alarm (default is Manual).</param>
    Task SendRecordingDataToQueue(Patient patient, PointOfCare poc, DateTime? date, DateTime? endDate,
            DateTime? eventDate, AlarmEnum.Name? alarmName, AlarmEnum.Severity severity, string? alarmDescription,
            bool start = true, AlarmEnum.Type type = AlarmEnum.Type.Manual);

    /// <summary>
    /// Asynchronously sends manual recording data for the specified patient at the given point of care, using the provided manual recording and a flag indicating whether to start the recording.
    /// </summary>
    /// <param name="patient">The patient whose recording data is being sent.</param>
    /// <param name="poc">The point of care associated with the recording.</param>
    /// <param name="manualRecording">The manual recording payload to transmit.</param>
    /// <param name="start">A flag indicating whether the recording is being started or stopped.</param>
    Task SendRecordingData(Patient patient, PointOfCare poc, ManualRecording manualRecording, bool start);

    /// <summary>
    /// Asynchronously sends automatic recording data for a patient at the specified point of care.
    /// </summary>
    /// <param name="patient">The patient associated with the automatic recording data.</param>
    /// <param name="poc">The point of care where the recording was taken.</param>
    /// <param name="automaticRecording">The automatic recording data to be sent.</param>
    /// <returns>A task that represents the asynchronous operation, containing a boolean indicating whether the data was sent successfully.</returns>
    Task<bool> SendAutoRecordingData(Patient patient, PointOfCare poc, RecordingData automaticRecording);

    /// <summary>
    /// Retrieves the list of recordings associated with the specified room.
    /// </summary>
    /// <param name="roomName">The identifier of the room whose recordings are being requested.</param>
    /// <returns>A task that returns a list of <see cref="RecordingData"/> for the room, or <c>null</c> if no recordings are available.</returns>
    Task<List<RecordingData>?> GetRecordings(int roomName);
}