namespace Umbraco.Cms.Core.Services.Navigation; /// /// Placeholder for sharing logic between the document and media navigation services /// for managing the navigation structure. /// public interface INavigationManagementService { /// /// Rebuilds the entire navigation structure by refreshing the navigation tree based /// on the current state of the underlying repository. /// Task RebuildAsync(); /// /// Removes a node from the main navigation structure and moves it, along with /// its descendants, to the root of the recycle bin structure. /// /// The unique identifier of the node to remove. /// /// true if the node and its descendants were successfully removed from the /// main navigation structure and added to the recycle bin; otherwise, false. /// bool MoveToBin(Guid key); /// /// Adds a new node to the main navigation structure. If a parent key is provided, /// the new node is added as a child of the specified parent. If no parent key is /// provided, the new node is added at the root level. /// /// The unique identifier of the new node to add. /// /// The unique identifier of the parent node. If null, the new node will be added to /// the root level. /// /// /// Optional value to define the node's position among its siblings when /// adding node at root level. /// /// true if the node was successfully added to the main navigation structure; /// otherwise, false. /// /// /// The sort order is particularly important when adding nodes at the root level. For child nodes, /// it can usually be determined by the number of existing children under the parent. However, /// when adding nodes directly to the root (where parentKey is null), a sort order must be provided /// to ensure the item appears in the correct position among other root-level items. /// bool Add(Guid key, Guid? parentKey = null, int? sortOrder = null); /// /// Moves an existing node to a new parent in the main navigation structure. If a /// target parent key is provided, the node is moved under the specified parent. /// If no target parent key is provided, the node is moved to the root level. /// /// The unique identifier of the node to move. /// /// The unique identifier of the new parent node. If null, the node will be moved to /// the root level. /// /// /// true if the node and its descendants were successfully moved to the new parent /// in the main navigation structure; otherwise, false. /// bool Move(Guid key, Guid? targetParentKey = null); /// /// Updates the sort order of a node in the main navigation structure. /// The sort order of other nodes in the same level will be adjusted accordingly. /// /// The unique identifier of the node to update. /// The new sort order for the node. /// /// true if the node's sort order was successfully updated; otherwise, false. /// bool UpdateSortOrder(Guid key, int newSortOrder); }