using OF_DL.Models;
using OF_DL.Models.Archived;
using OF_DL.Models.Messages;
using OF_DL.Models.Post;
using OF_DL.Models.Purchased;
using OF_DL.Models.Streams;
using static OF_DL.Models.Messages.Messages;
using FromUser = OF_DL.Models.Messages.FromUser;

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, Archived.List? messageInfo,
        Archived.Medium? messageMedia, Archived.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, Archived.List? postInfo, Archived.Medium? postMedia,
        Archived.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, SinglePost postInfo, SinglePost.Medium postMedia, SinglePost.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, Post.List? postInfo, Post.Medium? postMedia, Post.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, List? messageInfo, Medium? messageMedia, Messages.FromUser? fromUser,
        Dictionary<string, long> users);

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

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

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

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

    Task<bool> DownloadSinglePurchasedMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo, Medium? messageMedia,
        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, Purchased.List? messageInfo, Medium? messageMedia,
        Purchased.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, SingleMessage? messageInfo, Medium? messageMedia,
        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, Purchased.List? postInfo, Medium? postMedia,
        Purchased.FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadPurchasedPostMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, Purchased.List? messageInfo, Medium? messageMedia,
        Purchased.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, Streams.List? streamInfo,
        Streams.Medium? streamMedia, Streams.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, Streams.List? streamInfo, Streams.Medium? streamMedia, Streams.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, SingleMessage? messageInfo, Medium? messageMedia,
        FromUser? fromUser, Dictionary<string, long> users);

    Task<bool> DownloadMessagePreviewMedia(string url, string folder, long media_id, string api_type,
        IProgressReporter progressReporter, string? filenameFormat, SingleMessage? messageInfo, Medium? messageMedia,
        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, ArchivedCollection archived,
        IProgressReporter progressReporter);

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

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

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

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

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