| | 1 | | using CoWorkingApp.Core.Application.Abstracts; |
| | 2 | |
|
| | 3 | | namespace CoWorkingApp.Core.Domain.Entities |
| | 4 | | { |
| | 5 | | /// <summary> |
| | 6 | | /// Representa un asiento en el sistema. |
| | 7 | | /// </summary> |
| | 8 | | public class Seat : EntityBase |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Obtiene o establece el nombre del asiento. |
| | 12 | | /// </summary> |
| 236 | 13 | | public string Name { get; set; } |
| | 14 | |
|
| | 15 | | /// <summary> |
| | 16 | | /// Obtiene o establece un valor que indica si el asiento está bloqueado. |
| | 17 | | /// </summary> |
| 199 | 18 | | public bool IsBlocked { get; set; } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Obtiene o establece la descripción del asiento. |
| | 22 | | /// </summary> |
| 215 | 23 | | public string? Description { get; set; } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Obtiene o establece la lista de reservas asociadas al asiento. |
| | 27 | | /// </summary> |
| 177 | 28 | | public List<Reservation> Reservations { get; set; } = new List<Reservation>(); |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Determina si el objeto actual es igual a otro objeto. |
| | 32 | | /// Dos objetos de tipo Seat se consideran iguales si tienen el mismo identificador único (Id). |
| | 33 | | /// </summary> |
| | 34 | | /// <param name="obj">El objeto que se va a comparar con el objeto actual.</param> |
| | 35 | | /// <returns>True si el objeto actual es igual al parámetro obj; de lo contrario, false.</returns> |
| | 36 | | public override bool Equals(object obj) |
| 7 | 37 | | { |
| | 38 | | // Verifica si el objeto proporcionado no es nulo y es del mismo tipo que Seat |
| 7 | 39 | | if (obj is null || GetType() != obj.GetType()) |
| 2 | 40 | | { |
| | 41 | | // Si el objeto proporcionado es nulo o no es del mismo tipo que Seat, retorna false |
| 2 | 42 | | return false; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | // Convierte el objeto a tipo Seat |
| 5 | 46 | | Seat other = (Seat)obj; |
| | 47 | |
|
| | 48 | | // Compara los identificadores únicos para determinar la igualdad |
| 5 | 49 | | return Id.Equals(other.Id); |
| 7 | 50 | | } |
| | 51 | |
|
| | 52 | | /// <summary> |
| | 53 | | /// Obtiene un código hash para el objeto actual. |
| | 54 | | /// El código hash se basa en el identificador único (Id) del objeto Seat. |
| | 55 | | /// </summary> |
| | 56 | | /// <returns>Un código hash para el objeto actual.</returns> |
| | 57 | | public override int GetHashCode() |
| 4 | 58 | | { |
| | 59 | | // Retorna el código hash del identificador único (Id) |
| 4 | 60 | | return Id.GetHashCode(); |
| 4 | 61 | | } |
| | 62 | | } |
| | 63 | | } |