| | | 1 | | using CoWorkingApp.Core.Application.Abstracts; |
| | | 2 | | |
| | | 3 | | namespace CoWorkingApp.Core.Domain.Entities |
| | | 4 | | { |
| | | 5 | | /// <summary> |
| | | 6 | | /// Representa a un usuario en el sistema. |
| | | 7 | | /// </summary> |
| | | 8 | | public class User : EntityBase |
| | | 9 | | { |
| | | 10 | | /// <summary> |
| | | 11 | | /// Obtiene o establece el nombre del usuario. |
| | | 12 | | /// </summary> |
| | 238 | 13 | | public string Name { get; set; } |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Obtiene o establece el apellido del usuario. |
| | | 17 | | /// </summary> |
| | 229 | 18 | | public string LastName { get; set; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Obtiene o establece el correo electrónico del usuario. |
| | | 22 | | /// </summary> |
| | 232 | 23 | | public string Email { get; set; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Obtiene o establece la contraseña del usuario. |
| | | 27 | | /// </summary> |
| | 187 | 28 | | public string Password { get; set; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Obtiene o establece la lista de reservas asociadas al usuario. |
| | | 32 | | /// </summary> |
| | 172 | 33 | | public List<Reservation> Reservations { get; set; } = new List<Reservation>(); |
| | | 34 | | |
| | | 35 | | /// <summary> |
| | | 36 | | /// Sobrecarga del método Equals para comparar objetos User por su identificador único. |
| | | 37 | | /// </summary> |
| | | 38 | | /// <param name="obj">El objeto a comparar con el usuario actual.</param> |
| | | 39 | | /// <returns>True si los objetos son iguales, de lo contrario, false.</returns> |
| | | 40 | | public override bool Equals(object obj) |
| | 9 | 41 | | { |
| | | 42 | | // Verifica si el objeto proporcionado no es nulo y es del mismo tipo que User |
| | 9 | 43 | | if (obj is null || GetType() != obj.GetType()) |
| | 2 | 44 | | { |
| | 2 | 45 | | return false; |
| | | 46 | | } |
| | | 47 | | |
| | | 48 | | // Convierte el objeto a tipo User |
| | 7 | 49 | | User other = (User)obj; |
| | | 50 | | |
| | | 51 | | // Compara los identificadores únicos para determinar la igualdad |
| | 7 | 52 | | return Id.Equals(other.Id); |
| | 9 | 53 | | } |
| | | 54 | | |
| | | 55 | | /// <summary> |
| | | 56 | | /// Obtiene un código hash para el objeto actual. |
| | | 57 | | /// El código hash se basa en el identificador único (Id) del objeto User. |
| | | 58 | | /// </summary> |
| | | 59 | | /// <returns>Un código hash para el objeto actual.</returns> |
| | | 60 | | public override int GetHashCode() |
| | 4 | 61 | | { |
| | | 62 | | // Retorna el código hash del identificador único (Id) |
| | 4 | 63 | | return Id.GetHashCode(); |
| | 4 | 64 | | } |
| | | 65 | | } |
| | | 66 | | } |