using System.Collections.Generic; using GB5Shared.Tree; namespace FrameworkDAL.DTO.MenuGroup { /// /// Flat MMENUGROUP row, also usable directly as a TreeHelper.ConvertToTree node. /// ParentGroupId carries the raw -1 sentinel from the DB; the BLL is responsible for /// setting Parent = null when ParentGroupId == -1 before calling ConvertToTree, mirroring /// MenuBLL's existing MMENU ParentId handling — this DTO does not do that translation itself. /// public class MenuGroupDTO : ITreeNode { public int MenuGroupId { get; set; } public string GroupCode { get; set; } = string.Empty; public string GroupName { get; set; } = string.Empty; public int? ModuleId { get; set; } public int? MenuSetId { get; set; } public int ParentGroupId { get; set; } = -1; public string? ParentGroupIds { get; set; } public short? Levels { get; set; } public string IconName { get; set; } = string.Empty; public string? Remarks { get; set; } public short SortOrder { get; set; } = 9999; public byte Status { get; set; } = 1; public short Version { get; set; } public byte SourceType { get; set; } = 5; public int CreatedById { get; set; } = -1; public System.DateTime CreatedOn { get; set; } public int ModifiedById { get; set; } = -1; public System.DateTime ModifiedOn { get; set; } // ITreeNode — Id/Code are read-only pass-throughs so Dapper maps // straight into MenuGroupId/GroupCode without a separate flat/tree DTO pair. public int Id => MenuGroupId; public string Code => GroupCode; public MenuGroupDTO? Parent { get; set; } public IList children { get; set; } = new List(); /// Resolved leaf menus directly under this group — populated by /// MenuGroupBLL.GetMenuGroupTreeForSet after the tree walk, not by the DB query. public List Leaves { get; set; } = new(); } }