namespace adas_core.Domain.Models;

public class PatientLocation : IEquatable<PatientLocation>
{
    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; }

    public bool Equals(PatientLocation? other)
    {
        return UnitName == other?.UnitName && Bed == other?.Bed && Room == other?.Room;
    }

    public bool IsEmpty()
    {
        return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed);
    }

    public bool IsFullEmpty()
    {
        return string.IsNullOrEmpty(UnitName) && string.IsNullOrEmpty(Bed) && string.IsNullOrEmpty(Room);
    }

    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<string>.Default.GetHashCode(UnitName);
    //    // ReSharper disable once NonReadonlyMemberInGetHashCode
    //    if (Bed != null) hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Bed);
    //    return hashCode;
    //}
}