47 lines
2.2 KiB
C#
47 lines
2.2 KiB
C#
namespace adas_core.Domain.Models.MongoModels;
|
|
|
|
/// <summary>
|
|
/// Represents a historical identifier that associates a specific point in time with a set of patient identifiers.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// The type holds a timestamp together with a dictionary of patient IDs, providing a snapshot of the identification data at the given time.
|
|
/// </remarks>
|
|
public class HistoricalId(DateTime time, Dictionary<string, string> patientIds)
|
|
{
|
|
// Propiedades
|
|
public DateTime? Time { get; set; } = time;
|
|
|
|
public Dictionary<string, string> PatientIds { get; set; } =
|
|
patientIds ?? throw new ArgumentNullException(nameof(patientIds));
|
|
|
|
|
|
/// <summary>
|
|
/// Determines whether the appointment is empty by checking if the <see cref="Time"/> has not been set (is the default <see cref="DateTime"/>) and no patient identifiers have been associated.
|
|
/// </summary>
|
|
/// <returns><see langword="true"/> if both the time is uninitialized and the patient list is empty; otherwise, <see langword="false"/>.</returns>
|
|
public bool IsEmpty()
|
|
{
|
|
return Time == default(DateTime) && PatientIds.Count == 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Determines whether the current entity is fully populated by verifying that a time has been explicitly assigned and at least one patient is associated.
|
|
/// </summary>
|
|
/// <returns><c>true</c> if both the <c>Time</c> property is set to a non-default <see cref="DateTime"/> value and the <c>PatientIds</c> collection contains at least one entry; otherwise, <c>false</c>.</returns>
|
|
public bool IsFull()
|
|
{
|
|
return Time != default(DateTime) && PatientIds.Count > 0;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Returns a string representation of the HistoricalId, including the time and a comma-separated list of patient identifiers.
|
|
/// </summary>
|
|
/// <returns>A formatted string in the form "HistoricalId[Time: {Time}, PatientIds: {idsString}]" where idsString is the patient identifiers joined by commas.</returns>
|
|
public override string ToString()
|
|
{
|
|
var idsString = string.Join(", ", PatientIds);
|
|
return $"HistoricalId[Time: {Time}, PatientIds: {idsString}]";
|
|
}
|
|
} |