#ifndef OTAMANAGER_H
#define OTAMANAGER_H

#include "OTAUpdater.h"
#include "SDCardManager.h"
#include "BoardConfig.h"

class OTAManager
{
    friend class SAB;
    public:
        ~OTAManager();

        boolean init(void);
        boolean isEnabled(void) const;
        OTAUpdater& getOTAUpdater(void);

    protected:
        OTAManager(SDCardManager &sdCardManager, const BoardConfig &boardConfig);

    private:
        void updateStartedCb(void);
        void updateFinishedCb(void);
        void updateProgressdCb(int cur, int total);
        void updateErrorCb(int err);

        OTAUpdater _otaUpdater;
        SDCardManager *_sdCardManager = nullptr;
        const BoardConfig * _boardConfig = nullptr;
        boolean _isServiceEnabled = false;

};

#endif //OTAMANAGER_H