using adas_core.Domain.Models;
using adas_core.Domain.Utils;

namespace adas_core.module.LightBeacons.Devices;

/// <summary>
/// Abstract class representing a light beacon device. This class defines the basic structure and behavior of a light beacon, including methods for controlling the beacon's colors and generating alerts based on patient observations.
/// The specific implementation of these methods will depend on the type of light beacon being used and the requirements of the application.
/// </summary>
/// <param name="options">A dictionary containing configuration options for the light beacon. This can include settings such as the beacon's IP address, port number, color configurations, and other relevant parameters.</param>
public abstract class LightBeacon(EquatableDictionary<string, object> options)
{
    /// <summary>
    /// A dictionary containing configuration options for the light beacon. This can include settings such as the beacon's IP address, port number, color configurations, and other relevant parameters.
    /// </summary>
    protected readonly EquatableDictionary<string, object> Options = options;

    /// <summary>
    /// Turns the light beacon blue. This method should be implemented to control the beacon's hardware or software interface to change its color to blue.
    /// </summary>
    /// <returns>A task representing the asynchronous operation.</returns>
    public abstract Task BlueCode();

    /// <summary>
    /// Turns the light beacon red. This method should be implemented to control the beacon's hardware or software interface to change its color to red.
    /// </summary>
    /// <returns>A task representing the asynchronous operation.</returns>
    public abstract Task RedCode();

    /// <summary>
    /// Turns the light beacon yellow. This method should be implemented to control the beacon's hardware or software interface to change its color to yellow.
    /// </summary>
    /// <returns>A task representing the asynchronous operation.</returns>
    public abstract Task YellowCode();

    /// <summary>
    /// Turns off the light beacon. This method should be implemented to control the beacon's hardware or software interface to turn off the light, regardless of its current color.
    /// </summary>
    /// <returns></returns>
    public abstract Task PowerOffLed();

    /// <summary>
    /// Generates a color alert based on the provided patient observation. This method should analyze the patient observation and determine the appropriate color alert to display on the light beacon. 
    /// The specific logic for determining the color alert will depend on the criteria defined in the patient observation, such as thresholds for vital signs or other relevant parameters.
    /// </summary>
    /// <param name="obs">The patient observation used to determine the appropriate color alert.</param>
    /// <returns>A task representing the asynchronous operation.</returns>
    public abstract Task GenerateColorAlert(PatientObservation obs);

    /// <summary>
    /// Retrieves the current color of the light beacon. This method should be implemented to query the beacon's hardware or software interface to determine its current color state and return it as a value from the LightBeaconColor enumeration.
    /// </summary>
    /// <returns>A task representing the asynchronous operation, with a result of the current color of the light beacon.</returns>
    public abstract Task<Domain.Enums.LightBeaconColor> GetBeaconColor();
}