#import <React/RCTBridgeModule.h>

@interface RCT_EXTERN_MODULE(TamaraSdk, NSObject)

RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
                 withResolver:(RCTPromiseResolveBlock)resolve
                 withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(initSdk:(NSString *)token
                  apiUrl:(NSString *)apiUrl
                  pushUrl:(NSString *)pushUrl
                  publishKey:(NSString *)publishKey
                  notificationToken:(NSString *)notificationToken
                  isSandbox:(BOOL)isSandbox
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(createOrder:(NSString *)orderReferenceId
                  withDescription:(NSString *)description
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(orderDetail:(NSString *)orderId
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setCountry:(NSString *)countryCode
                  withCurrency:(NSString *)currency
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setPaymentType:(NSString *)paymentType
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setPlatform:(NSString *)platform
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setInstalments:(NSInteger *)instalments
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setLocale:(NSString *)locale
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setOrderNumber:(NSString *)orderNumber
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setExpiresInMinutes:(NSInteger *)expiresInMinutes
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setRiskAssessment:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setAdditionalData:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(addCustomFieldsAdditionalData:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setCustomerInfo:(NSString *)firstName
                  withLastName:(NSString *)lastName
                  withPhoneNumber:(NSString *)phoneNumber
                  withEmail:(NSString *)email
                  withIsFirstOrder:(BOOL)isFirstOrder
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(addItem:(NSString *)name
                  withReferenceId:(NSString *)referenceId
                  withSku:(NSString *)sku
                  withType:(NSString *)type
                  withUnitPrice:(double)unitPrice
                  withTax:(double)tax
                  withDiscount:(double)discount
                  withQuantity:(NSInteger)quantity
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setShippingAddress:(NSString *)firstName
                  withLastName:(NSString *)lastName
                  withPhoneNumber:(NSString *)phoneNumber
                  withAddressLine1:(NSString *)addressLine1
                  withAddressLine2:(NSString *)addressLine2
                  withCountry:(NSString *)country
                  withRegion:(NSString *)region
                  withCity:(NSString *)city
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setBillingAddress:(NSString *)firstName
                  withLastName:(NSString *)lastName
                  withPhoneNumber:(NSString *)phoneNumber
                  withAddressLine1:(NSString *)addressLine1
                  withAddressLine2:(NSString *)addressLine2
                  withCountry:(NSString *)country
                  withRegion:(NSString *)region
                  withCity:(NSString *)city
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setCurrency:(NSString *)newCurrency
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setShippingAmount:(double)amount
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(setDiscount:(double)amount
                  withName:(NSString *)name
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(paymentOrder:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(clearItem)

RCT_EXTERN_METHOD(authoriseOrder:(NSString *)orderId
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(refunds:(NSString *)orderId
                  jsonData:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(capturePayment:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(cancelOrder:(NSString *)orderId
                  jsonData:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(updateOrderReference:(NSString *)orderId
                  orderReferenceId:(NSString *)orderReferenceId
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(renderCartPage:(NSString *)language
                  country:(NSString *)country
                  publicKey:(NSString *)publicKey
                  amount:(double)amount
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(renderProduct:(NSString *)language
                  country:(NSString *)country
                  publicKey:(NSString *)publicKey
                  amount:(double)amount
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(checkPaymentOptions:(NSString *)jsonData
                  withResolver:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)                                           

+ (BOOL)requiresMainQueueSetup
{
  return NO;
}

@end
