namespace adas_core.Domain.Models.Observations;

/// <summary>
/// Represents an observation that conveys a boolean value, extending the base <see cref="Observation"/> type.
/// </summary>
public class BoolObservation : Observation
{
    public bool Value { get; set; }

    /// <summary>
    /// Creates a <see cref="BoolObservation"/> from the first item in the provided list of patient observations.
    /// Returns <see langword="null"/> when the list is empty.
    /// </summary>
    /// <param name="obs">The list of patient observations from which the first entry is converted.</param>
    /// <returns>A <see cref="BoolObservation"/> containing the boolean value of the first observation, or <see langword="null"/> if the list contains no observations.</returns>
    internal static BoolObservation? From(List<PatientObservation> obs)
        {
            if (obs.Count > 0)
                return new BoolObservation
                {
                    Value = (bool)obs[0].Value
                };
            return null;
        }
}