/***
   This file is part of libfly-ocr.

   Copyright (C) 2021 LLC "RusBITech-Astra" (https://astralinux.ru)

   libfly-ocr is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation, either version 3 of the
   License, or (at your option) any later version.

   Foobar is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with libfly-ocr.  If not, see <https://www.gnu.org/licenses/>.
***/

#ifndef OCRENGINEFACTORY_H
#define OCRENGINEFACTORY_H

#include <QObject>
#include <QString>
#include <QList>
#include <QAction>
#include "fly-ocr.h"

class OcrEngine;

struct PageSegmentationMode {
    int id = -1;
    QString label;
};

class OcrEngineFactory
{
public:
    enum Format {
        TXT =  0x001,
        HOCR = 0x002,
        HTML = 0x004,
        PDF =  0x008,
        ODT =  0x010,
        DOCX = 0x020,
        RTF  = 0x040,
        CSV  = 0x080,
        XML  = 0x100
    };
    Q_DECLARE_FLAGS(Formats, Format)

    virtual ~OcrEngineFactory() {}

    virtual QString name() const = 0;
    virtual QString shortName() const = 0;
    virtual QString version() const = 0;
    virtual QList<FlyOcr::Lang> languages() const = 0;
    virtual QList<PageSegmentationMode> pageSegmentationModes() const = 0;
    virtual QStringList defaultLanguages() const = 0;
    virtual int defaultPageSegmentationModeId() const = 0;
    virtual OcrEngine* create(QObject* parent) = 0;
    virtual Formats supportedPageDataFormats() const = 0;
    virtual Formats supportedExportFormats() const = 0;
    virtual QList<QAction*> createActions(QWidget* parent = nullptr) = 0;
    virtual QString about() const = 0;
};

Q_DECLARE_INTERFACE(OcrEngineFactory, "OcrEngineFactory/1.0")

#endif
