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

namespace SharepointToolbox.Services;

public interface IVersionCleanupService
{
    /// <summary>
    /// Enumerates document libraries (filtered by <see cref="VersionCleanupOptions.LibraryTitles"/>
    /// when non-empty) and deletes historical file versions per file according to
    /// <see cref="VersionCleanupOptions.KeepLast"/> and <see cref="VersionCleanupOptions.KeepFirst"/>.
    /// The current published version is never touched. Returns one result row per file
    /// where at least one version was inspected.
    /// </summary>
    Task<IReadOnlyList<VersionCleanupResult>> DeleteOldVersionsAsync(
        ClientContext ctx,
        VersionCleanupOptions options,
        IProgress<OperationProgress> progress,
        CancellationToken ct);

    /// <summary>
    /// Lists non-hidden document libraries on the site. Used by the library picker
    /// so callers can present a checkbox UI.
    /// </summary>
    Task<IReadOnlyList<string>> ListLibraryTitlesAsync(
        ClientContext ctx,
        CancellationToken ct);
}
