using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Wabbajack.DTOs;
using Wabbajack.DTOs.DownloadStates;
using Wabbajack.DTOs.Validation;
using Wabbajack.Hashing.xxHash64;
using Wabbajack.Paths;
using Wabbajack.RateLimiter;
namespace Wabbajack.Downloaders.Interfaces;
public interface IDownloader
{
public Priority Priority { get; }
///
/// Returns true if this downloader works with the download state of the given archive
///
///
///
public bool CanDownload(Archive archive);
///
/// Download the given archive to the given path, returning the hashcode of the downloaded data. This
/// will never be called on an archive for which `CanDownload` returned false.
///
///
///
///
///
public Task Download(Archive archive, AbsolutePath destination, IJob job, CancellationToken token);
///
/// Return true if the given archive state is still valid.
///
///
///
///
public Task Verify(Archive archive, IJob job, CancellationToken token);
///
/// Starts the downloader and configures it to start downloading. Should return null if more data is needed
/// before this download can download data
///
///
public Task Prepare();
public bool IsAllowed(ServerAllowList allowList, IDownloadState state);
IEnumerable MetaIni(Archive a);
public IDownloadState? Resolve(IReadOnlyDictionary iniData);
}
public interface IDownloader : IDownloader
where T : IDownloadState
{
public Task Download(Archive archive, T state, AbsolutePath destination, IJob job, CancellationToken token);
}