#import <React/RCTBridgeModule.h>
#import <React/RCTEventEmitter.h>

@interface RCT_EXTERN_MODULE(RCTVivocha, RCTEventEmitter)

RCT_EXTERN_METHOD(start:(NSString *)acctId
                  withServId:(NSString *)servId
                  withOptions:(NSDictionary)options
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(stop)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getDeveloperMode)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setDeveloperMode:(BOOL)mode)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getSideTab)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setSideTab:(BOOL)show)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(registerAction:(NSString *)code)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setDataCollection:(NSArray)data)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getDataCollection)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setCustomerToken:(NSString *)jwt)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(unsetCustomerToken)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(showView:(BOOL)animated)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(hideView:(BOOL)animated)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(terminate:(BOOL)hideView)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setPushToken:(NSString *)token)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(registerEvent:(NSString *)event)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(unregisterEvent:(NSString *)event)

RCT_EXTERN_METHOD(createContact:(NSArray)data
                  withType:(NSString *)type
                  withParams:(NSDictionary)params
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(createChat:(NSArray)data
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getUnreadMessageCount)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getContact)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getConversation)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(stopScreenshotSession)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(isScreenshotSessionAuthorized)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setLanguage:(NSString *)language)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getAgent)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getVVCU)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getVVCT)

RCT_EXTERN_METHOD(storeSurvey:(NSString *)contactId
                  withData:(NSArray)data
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(createVideoChat:(NSArray)data
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(createCallBackNow:(NSString *)phoneNumber
                  withData:(NSArray)data
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(addLocalization:(NSString *)language
                                        withLocalization:(NSDictionary)localization)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getTheme)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(setTheme:(NSDictionary)theme)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getMedia)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(sendAction:(NSString *)name
                                        withId:(NSString *)id
                                        withData:(NSArray)data)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(sendMessage:(NSString *)body
                                        withType:(NSString *)type
                                        withPayload:(NSString *)payload)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(sendAttachment:(NSString *)url
                                        withReferenceId:(NSString *)referenceId
                                        withTitle:(NSString *)title
                                        withMimetype:(NSString *)mimetype
                                        withDescription:(NSString *)description
                                        withSize:(nonnull NSNumber)size)

RCT_EXTERN_METHOD(registerUrlTapped)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(urlTapped:(NSString *)id
                                        withHandled:(BOOL)handled)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getSdkVersion)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getSdkName)

RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(getSdkBaseUrl)

+ (BOOL)requiresMainQueueSetup
{
  return NO;
}

@end
