using OF_DL.Models;
using ArchivedEntities = OF_DL.Models.Entities.Archived;
using CommonEntities = OF_DL.Models.Entities.Common;
using MessageEntities = OF_DL.Models.Entities.Messages;
using PostEntities = OF_DL.Models.Entities.Posts;
using PurchasedEntities = OF_DL.Models.Entities.Purchased;
using StreamEntities = OF_DL.Models.Entities.Streams;

namespace OF_DL.Services;

public interface IDownloadService
{
    Task<long> CalculateTotalFileSize(List<string> urls);

    Task<bool> ProcessMediaDownload(string folder, long media_id, string api_type, string url, string path,
        string serverFileName, string resolvedFileName, string extension, IProgressReporter progressReporter);

    Task<bool> DownloadArchivedMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, ArchivedEntities.ListItem? messageInfo,
        ArchivedEntities.Medium? messageMedia, CommonEntities.Author? author,
        Dictionary<string, long> users);

    Task<bool> DownloadArchivedPostDRMVideo(string policy, string signature, string kvp, string url,
        string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, ArchivedEntities.ListItem? postInfo,
        ArchivedEntities.Medium? postMedia,
        CommonEntities.Author? author, Dictionary<string, long> users);

    Task<bool> DownloadPostDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
        string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
        string filenameFormat, PostEntities.SinglePost postInfo, PostEntities.Medium postMedia,
        CommonEntities.Author author,
        Dictionary<string, long> users);

    Task<bool> DownloadPostDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
        string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
        string? filenameFormat, PostEntities.ListItem? postInfo, PostEntities.Medium? postMedia,
        CommonEntities.Author? author,
        Dictionary<string, long> users);

    Task DownloadAvatarHeader(string? avatarUrl, string? headerUrl, string folder, string username);

    Task<bool> DownloadMessageDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
        string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
        string? filenameFormat, MessageEntities.ListItem? messageInfo, MessageEntities.Medium? messageMedia,
        CommonEntities.FromUser? fromUser,
        Dictionary<string, long> users);

    Task<bool> DownloadMessageMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, MessageEntities.ListItem? messageInfo,
        MessageEntities.Medium? messageMedia, CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadPostMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PostEntities.ListItem? postInfo,
        PostEntities.Medium? postMedia,
        CommonEntities.Author? author, Dictionary<string, long> users);

    Task<bool> DownloadPostMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PostEntities.SinglePost? postInfo,
        PostEntities.Medium? postMedia,
        CommonEntities.Author? author, Dictionary<string, long> users);

    Task<bool> DownloadPurchasedMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PurchasedEntities.ListItem? messageInfo,
        MessageEntities.Medium? messageMedia,
        CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, MessageEntities.SingleMessage? messageInfo,
        MessageEntities.Medium? messageMedia, CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadPurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
        string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PurchasedEntities.ListItem? messageInfo,
        MessageEntities.Medium? messageMedia,
        CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadSinglePurchasedMessageDRMVideo(string policy, string signature, string kvp, string url,
        string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, MessageEntities.SingleMessage? messageInfo,
        MessageEntities.Medium? messageMedia, CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadPurchasedPostDRMVideo(string policy, string signature, string kvp, string url,
        string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PurchasedEntities.ListItem? postInfo,
        MessageEntities.Medium? postMedia,
        CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadPurchasedPostMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, PurchasedEntities.ListItem? messageInfo,
        MessageEntities.Medium? messageMedia,
        CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadStoryMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter);

    Task<bool> DownloadStreamMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, StreamEntities.ListItem? streamInfo,
        StreamEntities.Medium? streamMedia, CommonEntities.Author? author,
        Dictionary<string, long> users);

    Task<bool> DownloadStreamsDRMVideo(string policy, string signature, string kvp, string url, string decryptionKey,
        string folder, DateTime lastModified, long media_id, string api_type, IProgressReporter progressReporter,
        string? filenameFormat, StreamEntities.ListItem? streamInfo, StreamEntities.Medium? streamMedia,
        CommonEntities.Author? author,
        Dictionary<string, long> users);

    Task<bool> DownloadSingleMessagePreviewDRMVideo(string policy, string signature, string kvp, string url,
        string decryptionKey, string folder, DateTime lastModified, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, MessageEntities.SingleMessage? messageInfo,
        MessageEntities.Medium? messageMedia, CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, MessageEntities.SingleMessage? messageInfo,
        MessageEntities.Medium? messageMedia, CommonEntities.FromUser? fromUser, Dictionary<string, long> users);

    Task<DownloadResult> DownloadHighlights(string username, long userId, string path, HashSet<long> paidPostIds,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadStories(string username, long userId, string path, HashSet<long> paidPostIds,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadArchived(string username, long userId, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing, ArchivedEntities.ArchivedCollection archived,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadMessages(string username, long userId, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing, MessageEntities.MessageCollection messages,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadPaidMessages(string username, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing,
        PurchasedEntities.PaidMessageCollection paidMessageCollection,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadStreams(string username, long userId, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing, StreamEntities.StreamsCollection streams,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadFreePosts(string username, long userId, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing, PostEntities.PostCollection posts,
        IProgressReporter progressReporter);

    Task<DownloadResult> DownloadPaidPosts(string username, long userId, string path, Dictionary<string, long> users,
        bool clientIdBlobMissing, bool devicePrivateKeyMissing, PurchasedEntities.PaidPostCollection purchasedPosts,
        IProgressReporter progressReporter);
}
