using Microsoft.SharePoint.Client;
using SharepointToolbox.Core.Models;

namespace SharepointToolbox.Services;

/// <summary>
/// Abstraction over SessionManager, enabling unit testing of ViewModels
/// without live MSAL/SharePoint connections.
/// </summary>
public interface ISessionManager
{
    /// <summary>Returns an existing ClientContext or creates one via interactive login.</summary>
    Task<ClientContext> GetOrCreateContextAsync(TenantProfile profile, CancellationToken ct = default);

    /// <summary>Clears the cached session for the given tenant URL.</summary>
    Task ClearSessionAsync(string tenantUrl);

    /// <summary>Returns true if an authenticated ClientContext exists for this tenantUrl.</summary>
    bool IsAuthenticated(string tenantUrl);
}
