using SQLite; namespace Backend.Model; public abstract class TreeNode { [PrimaryKey, AutoIncrement] public Int64 Id { get; set; } public String Name { get; set; } = ""; public String Information { get; set; } = ""; // unstructured random info protected Boolean Equals(TreeNode other) { return Id == other.Id && ParentId == other.ParentId; } public override Boolean Equals(Object? obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj.GetType() == this.GetType() && Equals((TreeNode)obj); } public override Int32 GetHashCode() { return HashCode.Combine(Id, ParentId); } [Indexed] // parent/child relation public Int64 ParentId { get; set; } [Ignore] // not in DB, can be used in typescript as type discriminator public String Type => GetType().Name; }