Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
namespace adas_core.Domain.Models;
|
||||
|
||||
public class HistoricalLocation : IEquatable<HistoricalLocation>
|
||||
{
|
||||
// Propiedades con get y set para que MongoDB pueda escribir en ellas
|
||||
public DateTime? AdmTime { get; set; }
|
||||
public PatientLocation? PatientLocation { get; set; }
|
||||
|
||||
// Constructor vacío necesario para la deserialización de MongoDB
|
||||
public HistoricalLocation() { }
|
||||
|
||||
// Tu constructor actual
|
||||
public HistoricalLocation(DateTime admTime, PatientLocation patientLocation)
|
||||
{
|
||||
AdmTime = admTime;
|
||||
PatientLocation = patientLocation ?? throw new ArgumentNullException(nameof(patientLocation));
|
||||
}
|
||||
|
||||
public bool Equals(HistoricalLocation? other)
|
||||
{
|
||||
if (other == null) return false;
|
||||
return AdmTime == other.AdmTime &&
|
||||
(PatientLocation?.Equals(other.PatientLocation) ?? other.PatientLocation == null);
|
||||
}
|
||||
|
||||
public bool IsEmpty() => !AdmTime.HasValue && (PatientLocation == null || PatientLocation.IsEmpty());
|
||||
|
||||
public bool IsFull() => AdmTime.HasValue && PatientLocation != null && !PatientLocation.IsFullEmpty();
|
||||
|
||||
public override string ToString() => $"HistoricalLocation[AdmTime: {AdmTime}, PatientLocation: {PatientLocation}]";
|
||||
}
|
||||
Reference in New Issue
Block a user