Files
adas-core/adas-core.Domain/Models/Note.cs
T

31 lines
1.2 KiB
C#

namespace adas_core.Domain.Models;
/// <summary>
/// Represents a note entity used to store textual or descriptive information.
/// </summary>
/// <!-- aidoc:v1 sig=bf82ed0 -->
public class Note
{
public string? CommentType { get; set; } = string.Empty;
public string Comment { get; set; } = string.Empty;
public DateTime? EnteredTime { get; set; }
/// <summary>
/// Returns a string representation of the note, conditionally including the comment type, comment text, and entered time when their values are present.
/// </summary>
/// <returns>A formatted string in the form "note[...]" containing the available note properties, or "note[]" when no properties are set.</returns>
/// <!-- aidoc:v1 sig=d27f326 body=2df1063 -->
public override string ToString()
{
List<string> items = [];
if (!string.IsNullOrEmpty(CommentType)) items.Add($", commentType: {CommentType}");
if (!string.IsNullOrEmpty(Comment)) items.Add($"comment: {Comment}");
if (EnteredTime != null) items.Add($", enteredTime: {EnteredTime}");
return "note[" + string.Join(", ", items) + "]";
}
}