using C4IT.FASD.Base;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace C4IT_DataHistoryProvider_Base.Services
{
    public interface IStagedRelationService
    {
        /// <summary>
        /// Triggers search for relations to given information objects.
        /// </summary>
        Task<cF4sdStagedSearchResultRelationTaskId> StartGatheringRelatedObjects(IEnumerable<cFasdApiSearchResultEntry> relatedTo, int ageInDays);

        /// <summary>
        /// Used after triggering search for related objects in <see cref="StartGatheringRelatedObjects"/> to retrieve the already found relations.
        /// </summary>
        /// <param name="id">Id returned by <see cref="StartGatheringRelatedObjects"/> to reference the results to a search term.</param>
        Task<cF4sdStagedSearchResultRelations> GetRelatedObjectsAsync(Guid id, CancellationToken token);

        /// <summary>
        /// Cancels the gathering of related objects.
        /// </summary>
        /// <param name="id">Id returned by <see cref="StartGatheringRelatedObjects"/> to reference the gathering process.</param>
        void StopGatheringRelatedObjects(Guid id);
    }
}
