using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Transactional.Abstractions; namespace back.DataModels; [Table("Persons")] public partial class Person: IEquatable, ISoftDeletable { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public string Id { get; set; } = null!; [Required, MaxLength(100)] public string Name { get; set; } = null!; public string? ProfilePicture { get; set; } public string? Avatar { get; set; } public string? SocialMediaId { get; set; } [MaxLength(250)] public string? Bio { get; set; } // Optional field for a short biography or description public string CreatedAt { get; set; } = null!; public string? UpdatedAt { get; set; } public int IsDeleted { get; set; } public string? DeletedAt { get; set; } public virtual ICollection Photos { get; set; } = []; public virtual SocialMedia? SocialMedia { get; set; } public virtual User? User { get; set; } public virtual ICollection PhotosNavigation { get; set; } = []; public override int GetHashCode() => HashCode.Combine(Id, Name); public override bool Equals(object? obj) => obj is Person other && Equals(other); public bool Equals(Person? other) { if (other is null) return false; if (ReferenceEquals(this, other)) return true; return Id == other.Id || GetHashCode() == other.GetHashCode(); } public const string SystemPersonId = "00000000-0000-0000-0000-000000000001"; public static readonly Person SystemPerson = new() { Id = SystemPersonId, Name = "System", CreatedAt = DateTime.UtcNow.ToString("dd-MM-yyyy HH:mm:ss zz"), User = User.SystemUser }; }