#nullable enable using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace UserService.Infrastructure.DataModels { public abstract class Node : ICloneable { public Guid Id { get; set; } [Required] public string CommonName { get; set; } = null!; public string? Description { get; set; } public ICollection Children { get; set; } = new List(); public Node? Parent { get; set; } //Parent public Guid? ParentId { get; set; } public override string ToString() => CommonName; public int Level => Parent?.Level + 1 ?? 0; /// public virtual object Clone() => MemberwiseClone(); } }