namespace adas_core.Domain.Models.Observations;

/// <summary>
/// Represents an observation that is associated with string data, extending the base Observation type.
/// </summary>
/// <remarks>
/// This class specializes the Observation concept for textual or string-based content, inheriting the core observation behavior from its parent class.
/// </remarks>
public class StringObservation : Observation
{
    public string Value { get; set; } = string.Empty;

    /// <summary>
    /// Creates a <see cref="StringObservation"/> from the first <see cref="PatientObservation"/> in the provided list.
    /// Returns <c>null</c> when the list is empty.
    /// </summary>
    /// <param name="obs">The list of <see cref="PatientObservation"/> instances to convert.</param>
    /// <returns>A <see cref="StringObservation"/> populated with the string value of the first observation, or <c>null</c> if the list contains no elements.</returns>
    public static StringObservation? From(List<PatientObservation> obs)
        {
            if (obs.Count > 0)
                return new StringObservation
                {
                    Value = (string)obs[0].Value
                };
            return null;
        }
}