#pragma once

#include "idownload_observer.h"
#include "dubbing_global.h"
#include "dubbing_base.h"

namespace DUBBING
{
    class DUBBING_CLIENT_EXPORT IDubbbingCallBack : public IDownloadObserver
    {
    public:
        virtual void onDownload(int percent, int index, int count) = 0;
        virtual void onComplete() = 0;
        virtual void onError() = 0;
        virtual void onActionResult(DubbingAction actionType, DubbingRetCode retCode, const std::string& msg) = 0;

    public:
        /*
        * Set download total
        */
        void setDownloadCount(int count);

        /*
        * Set current download index
        */
        void setDownloadIndex(int index);

    public:
        /*
        * Download progress event
        */
        void onDownloadProgress(const std::string& url, const std::wstring& localPath, double dltotal, double dlnow) override;

        /*
        * Download completion event
        */
        void onDownloadComplete(const std::string& url, const std::wstring& localPath) override;

        /*
        * Download failure event
        */
        void onDownloadFailed(const std::string& url, const std::wstring& localPath) override;

    private:
        int m_downloadCount = 0;
        int m_downloadIndex = 0;
    };
}