using SharepointToolbox.Core.Models;
namespace SharepointToolbox.Services;
///
/// Manages Azure AD app registration and removal for a target tenant.
///
public interface IAppRegistrationService
{
///
/// Returns true if the currently-authenticated user has the Global Administrator
/// directory role (checked via transitiveMemberOf for nested-group coverage).
/// Returns false on any failure, including 403, rather than throwing.
///
Task IsGlobalAdminAsync(string clientId, CancellationToken ct);
///
/// Creates an Azure AD Application + ServicePrincipal + OAuth2PermissionGrants
/// atomically. On any intermediate failure the Application is deleted before
/// returning a Failure result (best-effort rollback).
///
Task RegisterAsync(string clientId, string tenantDisplayName, CancellationToken ct);
///
/// Deletes the registered application by its appId.
/// Logs a warning on failure but does not throw.
///
Task RemoveAsync(string clientId, string appId, CancellationToken ct);
///
/// Clears the live SessionManager context, evicts all in-memory MSAL accounts,
/// and unregisters the persistent token cache for the given clientId.
///
Task ClearMsalSessionAsync(string clientId, string tenantUrl);
}