using Microsoft.SharePoint.Client;
using SharepointToolbox.Core.Models;
namespace SharepointToolbox.Services;
///
/// Resolves SharePoint group names to their transitive member lists via CSOM + Microsoft Graph.
/// Used as a pre-render step in HTML report export (Phase 17).
///
public interface ISharePointGroupResolver
{
///
/// Resolves the given SharePoint group names to their transitive leaf-user members.
///
/// For each group name:
/// - CSOM loads the direct members from .
/// - Any members that are nested AAD groups (login prefix c:0t.c|tenant|) are expanded
/// transitively via the Microsoft Graph groups/{id}/transitiveMembers/microsoft.graph.user endpoint.
/// - Members are de-duplicated by login (OrdinalIgnoreCase).
///
/// Failures (throttling, group not found, Graph errors) are handled gracefully:
/// the group entry is included in the result with an empty member list rather than throwing.
///
/// SharePoint ClientContext for CSOM group member loading.
/// App registration client ID used by .
/// List of SharePoint group display names to resolve.
/// Cancellation token.
///
/// A read-only dictionary keyed by group name (OrdinalIgnoreCase) mapping to the list of resolved members.
/// Never throws — a group with a resolution failure maps to an empty list.
///
Task>> ResolveGroupsAsync(
ClientContext ctx,
string clientId,
IReadOnlyList groupNames,
CancellationToken ct);
}