Files
adas-core/adas-core.Domain/Models/Note.cs
T
2026-06-26 10:29:23 +02:00

29 lines
1.1 KiB
C#

namespace adas_core.Domain.Models;
/// <summary>
/// Represents a note entity used to store textual or descriptive information.
/// </summary>
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>
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) + "]";
}
}