#ifndef COREAIIMAGEPROCESSENGINE_H
#define COREAIIMAGEPROCESSENGINE_H

#include <functional>
#include <string>

#include "aiengine.h"
#include "aiengineerror.h"
#include "aiengineresult.h"

namespace ai_engine {
namespace core_ai {
namespace vision {

struct ImageResult : public result::AiEngineModelResult {
    std::string imageFormat;
    std::string imageBase64Data;
};

using ImageResultCallback = std::function<void(const ImageResult &result)>;

class AbstractImageProcessEngine : public AbstractAiEngine {
public:
    virtual ~AbstractImageProcessEngine() {}

    // 抠图模块
    virtual result::AiEngineBaseResult initMattingsModule() = 0;
    virtual result::AiEngineBaseResult destroyMattingsModule() = 0;
    virtual void setMattingResultCallback(ImageResultCallback callback) = 0;
    virtual result::AiEngineBaseResult mattingFromBase64ImageData(
        const std::string &imageBase64Data) = 0;
    virtual result::AiEngineBaseResult mattingFromImageFile(
        const std::string &imageFilePath) = 0;
    virtual void stopMattingProcess() = 0;

    // 图像二值化模块
    virtual result::AiEngineBaseResult initImageBinaryModule() = 0;
    virtual result::AiEngineBaseResult destroyImageBinaryModule() = 0;
    virtual void setImageBinaryResultCallback(ImageResultCallback callback) = 0;
    virtual result::AiEngineBaseResult binarizeImageFromBase64ImageData(
        const std::string &imageBase64Data) = 0;
    virtual result::AiEngineBaseResult binarizeImageFromImageFile(
        const std::string &imageFilePath) = 0;
    virtual void stopImageBinarization() = 0;
};

}  // namespace vision
}  // namespace core_ai
}  // namespace ai_engine

#endif