namespace adas_core.Domain.Models;
///
/// Represents the location of a patient within a healthcare or clinical context.
/// Implements to provide type-specific equality comparison between patient location instances.
///
public class PatientLocation : IEquatable
{
public PatientLocation(string? unitName, string? bed, string? room)
{
UnitName = unitName;
Bed = bed;
Room = room;
}
public PatientLocation(string? unitName, string? bed)
{
UnitName = unitName;
Bed = bed;
Room = bed;
}
public PatientLocation()
{
// Constructor vacío
}
public string? UnitName { get; init; }
public string? Bed { get; set; }
public string? Room { get; init; }
///
/// Determines whether the specified is equal to the current instance by comparing the UnitName, Bed, and Room properties.
///
/// The to compare with the current instance.
/// when all three properties (UnitName, Bed, and Room) match; otherwise, . Returns if is .
public bool Equals(PatientLocation? other)
{
return UnitName == other?.UnitName && Bed == other?.Bed && Room == other?.Room;
}
///
/// Determines whether the current instance is considered empty by checking that both the and values are null or empty strings.
///
/// if both UnitName and Bed are null or empty; otherwise, .
public bool IsEmpty()
{
return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed);
}
///
/// Determines whether the unit name, bed, and room fields are all null or empty, indicating the entity is fully empty.
///
/// true if , , and are all null or empty; otherwise, false.
public bool IsFullEmpty()
{
return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed) && string.IsNullOrEmpty(Room);
}
///
/// Returns a human-readable string representation of the PatientLocation, including the unit name, room, and bed.
///
/// A formatted string in the form "PatientLocation[Unit: {UnitName},room: {Room} ,bed: {Bed}]".
public override string ToString()
{
return "PatientLocation[Unit: " + UnitName + ",room: " + Room + " ,bed: " + Bed + "]";
}
//public override bool Equals(object? obj)
//{
// return obj is PatientLocation objPl && Equals(objPl);
//}
//public override int GetHashCode()
//{
// var hashCode = 511378865;
// if (UnitName != null)
// hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(UnitName);
// // ReSharper disable once NonReadonlyMemberInGetHashCode
// if (Bed != null) hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Bed);
// return hashCode;
//}
}