51 lines
2.4 KiB
C#
51 lines
2.4 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>
|
|
/// <!-- aidoc:v1 sig=0e1354d -->
|
|
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>
|
|
/// <!-- aidoc:v1 sig=1112d99 body=8e5afe5 -->
|
|
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>
|
|
/// <!-- aidoc:v1 sig=49eac56 body=64ddc12 -->
|
|
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>
|
|
/// <!-- aidoc:v1 sig=d27f326 body=7cb507c -->
|
|
public override string ToString()
|
|
{
|
|
var idsString = string.Join(", ", PatientIds);
|
|
return $"HistoricalId[Time: {Time}, PatientIds: {idsString}]";
|
|
}
|
|
} |