#pragma once
#include "EpsonScan2.h"
#include "ESImageInfo.h"
#include "hpdf.h"
#include "KeyMgr.hpp"
#include <utils/ESBuffer.h>
#include <ES2FileFormat/FKPAPI.h>
#include <list>

namespace epsonscan
{
class WriteMessageQ;
class SearchablePDFPlugin
{

public:
    SearchablePDFPlugin() : procesPid_(0), writeMessageQ_(nullptr)
    {

    }

    static bool IsAvailable();

    bool Start(const char* destPath, std::shared_ptr<KeyMgr> keyMgr, ESNumber format);
    bool Add(ES_CMN_FUNCS::BUFFER::CESHeapBuffer dataBuf, int width, int height, int resolution, int samplesPerPixel, int bitsPerSample);
    bool Fin();
    void End();
    void Cleanup();
private:
    int procesPid_;
    std::shared_ptr<WriteMessageQ> writeMessageQ_;
    std::list<ESString> inputFileList_;
};

}