#ifndef _FS_OCR_C_H_
#define _FS_OCR_C_H_

#ifdef __cplusplus
extern "C" {
#endif


typedef struct _FSOCRCallback {
  void* user_data;
  FS_BOOL (*NeedToCancelNow)(void* user_data, const wchar_t* info);
  FS_BOOL (*IsImageIgnored)(void* user_data,  FS_IMAGEOBJECT_HANDLE* image_object);
}FSOCRCallback;

typedef struct _FSOCRProgressCallback {
  void* user_data;
  void (*ProgressNotify)(void* user_data, int current_rate);
}FSOCRProgressCallback;

FSErrorCode FSDK_OCREngine_Initialize(const wchar_t* ocr_resource_path);
FSErrorCode FSDK_OCREngine_Initialize0(const wchar_t* ocr_resource_path, FS_BOOL is_shared_cpu_cores_mode);
FSErrorCode FSDK_OCREngine_Release();
FSErrorCode FSDK_OCREngine_SetLogFile(const wchar_t* log_file_path);
FSErrorCode FSDK_OCREngine_SetLanguages(const wchar_t* languages);
FSErrorCode FSDK_OCREngine_SetOCRCallback(FSOCRCallback* callback);
typedef struct _FSOCRConfig {
  FS_BOOL is_detect_pictures;
  FS_BOOL is_remove_noise;
  FS_BOOL is_correct_skew;
  FS_BOOL is_enable_text_extraction_mode;
  FS_BOOL is_sequentially_process;
  FS_BOOL is_auto_overwrite_resolution;
  int resolution_to_overwrite;
  int confidence;
}FSOCRConfig;

typedef struct _FSOCRSettingData {
  FS_PDFDOC_HANDLE pdf_doc;
  FS_RANGE_HANDLE page_range;
  FS_BOOL is_editable;
  FSOCRConfig ocr_config;
}FSOCRSettingData;

typedef struct _FSOCRSuspectInfo {
  int page_index;
  FSRectF words_rect;
  FS_WSTR suspect_words;
}FSOCRSuspectInfo;


typedef enum _FSOCRConvertFormat {
e_FSOCRConvertFormatDOCX  = 0,
e_FSOCRConvertFormatDOC = 1,
e_FSOCRConvertFormatRTF = 2,
e_FSOCRConvertFormatXLSX = 3,
e_FSOCRConvertFormatXLS = 4,
e_FSOCRConvertFormatPPTX = 5,
e_FSOCRConvertFormatHTML = 6,
}FSOCRConvertFormat;


FSErrorCode FSDK_OCR_Create(FS_OCR_HANDLE* ocr_return_value);
FSErrorCode FSDK_OCR_Release(FS_OCR_HANDLE ocr_handle);
FSErrorCode FSDK_OCR_IsEmpty(FS_OCR_HANDLE ocr_handle, FS_BOOL* return_value);
FSErrorCode FSDK_OCR_OCRPDFPage(FS_OCR_HANDLE ocr_handle,  FS_PDFPAGE_HANDLE pdf_page, FS_BOOL is_editable, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRPDFPage0(FS_OCR_HANDLE ocr_handle,  FS_PDFPAGE_HANDLE pdf_page, FS_BOOL is_editable, const FSOCRConfig config, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRPDFDocument(FS_OCR_HANDLE ocr_handle,  FS_PDFDOC_HANDLE pdf_doc, FS_BOOL is_editable, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRPDFDocument0(FS_OCR_HANDLE ocr_handle,  FS_PDFDOC_HANDLE pdf_doc, FS_BOOL is_editable, const FSOCRConfig config, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRConvertTo(FS_OCR_HANDLE ocr_handle, FSOCRConvertFormat format, const wchar_t* src_pdf_path, const wchar_t* password, const wchar_t* saved_file_path, FS_RANGE_HANDLE page_range, FS_BOOL is_retain_flowing_text, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRConvertTo0(FS_OCR_HANDLE ocr_handle, FSOCRConvertFormat format, const wchar_t* src_pdf_path, const wchar_t* password, const wchar_t* saved_file_path, FS_RANGE_HANDLE page_range, FS_BOOL is_retain_flowing_text, const FSOCRConfig config, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_OCRPDFDocuments(FS_OCR_HANDLE ocr_handle, const FSOCRSettingData* ocrdatasetting_array, FS_UINT32 array_length_settingdata_array, FSOCRProgressCallback* callback);
FSErrorCode FSDK_OCR_GetOCRSuspectsInfo(FS_OCR_HANDLE ocr_handle,  FS_PDFDOC_HANDLE ocred_pdf_doc, FSOCRSuspectInfo* return_ocr_suspect_info_array, FS_UINT32* return_array_length);
#ifdef __cplusplus
}
#endif
#endif
