using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FrameworkDAL.DTO.MenuGroup;
using GB5Shared.DTO.Framework.Login;
namespace FrameworkBLL.MenuGroup
{
public interface IMenuGroupBLL
{
/// PRESENTATIONTYPE = 0 -> delegates unchanged to IMenuBLL.GetMenuForUserModule.
/// PRESENTATIONTYPE IN (1,2) -> walks MMENUGROUP from MMENUSET.MENUGROUPID, resolves
/// leaves per the documented override/fallback order. Returns a JSON string either way,
/// matching this Menu subsystem's existing BLL convention.
/// Unfiltered by role — full bundle membership, for admin/content-management callers
/// (the MenuGroup admin tree, the Client Menu Set Editor). Do not call this from an
/// end-user-facing path; use instead.
Task GetMenuGroupTreeForSet(int menuSetId, LoginDTO loginDTO, CancellationToken ct);
/// The production entry point for the left-nav module-click flow. Resolves
/// MenuSetId for (loginDTO.ClientId, moduleId) via MCLIENTMODULE, then behaves exactly
/// like GetMenuGroupTreeForSet except leaf resolution is filtered by loginDTO.RoleId
/// (the same MROLEVSMENU view-right check the legacy query enforces). Falls back
/// unchanged to IMenuBLL.GetMenuForUserModule when no MenuSet is bound to this module
/// or PRESENTATIONTYPE = 0 — so PRESENTATIONTYPE 0 clients see byte-for-byte legacy
/// output through this same endpoint.
Task GetMenuTreeForUserModule(int userId, int moduleId, LoginDTO loginDTO, CancellationToken ct);
Task SaveMenuGroup(MenuGroupDTO dto, LoginDTO loginDTO, CancellationToken ct);
Task DeleteMenuGroup(int menuGroupId, LoginDTO loginDTO, CancellationToken ct);
Task SaveMenuGroupDetail(int menuGroupId, List leaves, LoginDTO loginDTO, CancellationToken ct);
/// Throws if menuGroupId is private to a MenuSet other than callerMenuSetId.
/// A plain FK can't express "shared or private-to-this-set", so MMENUSETDETAIL writes
/// that set MENUGROUPID must call this first — see the write-boundary rule in
/// gb5_menu_presentation_layer.sql.
Task ValidateMenuGroupVisibility(int menuGroupId, int callerMenuSetId, LoginDTO loginDTO, CancellationToken ct);
}
}