#ifndef _FS_COMMON_C_H_
#define _FS_COMMON_C_H_

#ifdef __cplusplus
extern "C" {
#endif


FSErrorCode FSDK_BStr_Init(FS_BSTR* bstr);

FSErrorCode FSDK_BStr_SetLength(FS_BSTR* bstr, FS_UINT32 length);

FSErrorCode FSDK_BStr_Set(FS_BSTR* bstr, const char* str, FS_UINT32 length);

FSErrorCode FSDK_BStr_Clear(FS_BSTR* bstr);

FSErrorCode FSDK_WStr_Init(FS_WSTR* wstr);

FSErrorCode FSDK_WStr_SetLength(FS_WSTR* wstr, FS_UINT32 length);

FSErrorCode FSDK_WStr_Set(FS_WSTR* wstr, const wchar_t* str, FS_UINT32 length);

FSErrorCode FSDK_WStr_Clear(FS_WSTR* wstr);

FSErrorCode FSDK_WStr_UTF8Encode(FS_WSTR* src_wstr, FS_BSTR* dst_bstr);

FSErrorCode FSDK_WStr_UTF16LEEncode(FS_WSTR* src_wstr, FS_BSTR* dst_bstr);

FSErrorCode FSDK_BStr_UTF8Decode(FS_BSTR* src_wstr, FS_WSTR* dst_bstr);


typedef enum _FSState {
e_FSError = 0,
e_FSToBeContinued = 1,
e_FSFinished = 2,
}FSState;



typedef enum _FSUserPermissions {
e_FSPermPrint = 0x0004,
e_FSPermModify = 0x0008,
e_FSPermExtract = 0x0010,
e_FSPermAnnotForm = 0x0020,
e_FSPermFillForm = 0x0100,
e_FSPermExtractAccess = 0x0200,
e_FSPermAssemble = 0x0400,
e_FSPermPrintHigh = 0x0800,
}FSUserPermissions;


typedef struct _FSConvertCheckCallback {
  void* user_data;
  FS_BOOL (*CheckUserPermissions)(void* user_data, FS_UINT32 user_permissions);
}FSConvertCheckCallback;

FSErrorCode FSDK_Library_Initialize(const char* sn, const char* key);
FSErrorCode FSDK_Library_Reinitialize();
FSErrorCode FSDK_Library_Release();
FSErrorCode FSDK_Library_GetVersion(FS_BSTR* return_value);
FSErrorCode FSDK_Library_EnableThreadSafety(FS_BOOL is_enable_thread_safety);
FSErrorCode FSDK_Library_SetConvertCheckCallback(FSConvertCheckCallback* convert_check_callback, FS_BOOL* return_value);
FSErrorCode FSDK_Progressive_Release(FS_PROGRESSIVE_HANDLE progressive_handle);
FSErrorCode FSDK_Progressive_Continue(FS_PROGRESSIVE_HANDLE progressive_handle, FSState* return_value);
FSErrorCode FSDK_Progressive_GetRateOfProgress(FS_PROGRESSIVE_HANDLE progressive_handle, int* return_value);

typedef enum _FSFilter {
e_FSAll = 0,
e_FSEven = 1,
e_FSOdd = 2,
}FSFilter;


FSErrorCode FSDK_Range_Create(FS_RANGE_HANDLE* range_return_value);
FSErrorCode FSDK_Range_Create0(int index, FS_RANGE_HANDLE* range_return_value);
FSErrorCode FSDK_Range_Create1(int start_index, int end_index, FSFilter filter, FS_RANGE_HANDLE* range_return_value);
FSErrorCode FSDK_Range_Release(FS_RANGE_HANDLE range_handle);
FSErrorCode FSDK_Range_IsEmpty(FS_RANGE_HANDLE range_handle, FS_BOOL* return_value);
FSErrorCode FSDK_Range_AddSingle(FS_RANGE_HANDLE range_handle, int index);
FSErrorCode FSDK_Range_AddSegment(FS_RANGE_HANDLE range_handle, int start_index, int end_index, FSFilter filter);
FSErrorCode FSDK_Range_GetSegmentCount(FS_RANGE_HANDLE range_handle, int* return_value);
FSErrorCode FSDK_Range_GetSegmentStart(FS_RANGE_HANDLE range_handle, int segment_index, int* return_value);
FSErrorCode FSDK_Range_GetSegmentEnd(FS_RANGE_HANDLE range_handle, int segment_index, int* return_value);
FSErrorCode FSDK_Range_RemoveAll(FS_RANGE_HANDLE range_handle);
#ifdef __cplusplus
}
#endif
#endif
