using System.Collections.Generic; namespace AccountsDAL.DTO.AccountTree { // Flat-list-with-ParentId -> nested-tree node shared by the whole Account Tree navigator // (Type -> Schedule -> Group -> Account). Mirrors the existing AccountGroupTreeDTO pattern // (AccountsDAL/DTO/AccountGroup/AccountGroupTreeDTO.cs) but extended up to a synthetic Type // root and down to Account leaves. NodeType disambiguates ids that are not unique across // entity types (a Schedule id and a Group id can collide as plain ints). public class AccountTreeNodeDTO { // 0=Type(synthetic), 1=Schedule, 2=Group, 3=Account public byte NodeType { get; set; } // Type: synthetic bucket id 0-3 (Asset/Liability/Income/Expense); else the real PK public int Id { get; set; } public string Code { get; set; } public string Name { get; set; } // -1 = root; Schedule's parent is its synthetic Type bucket id public int ParentId { get; set; } // Schedule/Group: computed; Account: always false public bool HasChildren { get; set; } // Account only (0 otherwise). AccountType=3 marks a Party-linked control sub-ledger account // (PartyBLL.LinkPartyAccountAsync creates it with AccountId == the owning Party's PartyId) — // the tree/FE uses this to route to the Party Branch maintenance screen instead of the // generic Account Master screen. See AccountTreeBLL.GetAccountTreeLeaves. public int AccountType { get; set; } public List Children { get; set; } = new List(); } }