namespace adas_core.Domain.Models.Observations;

/// <summary>
/// Represents an observation that is associated with a chart, providing chart-specific contextual data derived from the base <see cref="Observation"/> type.
/// </summary>
public class ChartObservation : Observation
{
    public List<double> Values { get; set; } = [];
    public List<double> SecondaryValues { get; set; } = [];
    public List<double> Labels { get; set; } = [];
    public double Min { get; set; }
    public double Max { get; set; }
    public double? MinWarn { get; set; }
    public double? MaxWarn { get; set; }

    /// <summary>
    /// Creates a new <see cref="ChartObservation"/> instance from the provided list of patient observations.
    /// Throws an exception when the source list is null; otherwise returns a new empty <see cref="ChartObservation"/>.
    /// </summary>
    /// <param name="obs">The list of patient observations to convert.</param>
    /// <returns>A new <see cref="ChartObservation"/> instance.</returns>
    /// <exception cref="ArgumentNullException">Thrown when <paramref name="obs"/> is null.</exception>
    internal static ChartObservation From(List<PatientObservation> obs)
        {
            return obs == null ? throw new ArgumentNullException(nameof(obs)) : new ChartObservation();
        }
}