/**
 * Failed to minify the file using Terser v5.39.0. Serving the original version.
 * Original file: /npm/react-native-appsmiles-apmservices@2.1.2/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
// @flow

"use strict";

import {
  NativeModules
} from 'react-native';

const APMServicesBridge = NativeModules.APMServicesModule;
const APMServicesConfigBridge = NativeModules.APMServicesConfigModule;
const APMServicesAdBridge = NativeModules.APMServicesAdModule;
const APMServicesGenerosityBridge = NativeModules.APMServicesGenerosityModule;
const APMServicesGiftBridge = NativeModules.APMServicesGiftModule;
const APMServicesLogBridge = NativeModules.APMServicesLogModule;
const APMServicesPageBridge = NativeModules.APMServicesPageModule;
const APMServicesPartnerBridge = NativeModules.APMServicesPartnerModule;
const APMServicesStatisticBridge = NativeModules.APMServicesStatisticModule;
const APMServicesStoreBridge = NativeModules.APMServicesStoreModule;
const APMServicesUserBridge = NativeModules.APMServicesUserModule;

/**
 * APMServices is the first class of SDK APMServices.
 * It is a singleton, use APMServicesPublic.sharedInstance(Context context) to retrieve the singleton.
 * The singleton is initialized at first call of sharedInstance(Context context)
 * Call sharedInstance(Context context) in the method onCreate() of the class Application.
 */
class APMServicesModule {
  /**
   * Init APMServices with a partnerId and a partnerSecret
   * If you use this method : the packageName send to server app's miles is "com.example.app" (com.example.app is retrieved from AndroidManifest.xml)
   * @param partnerId Example of partnerId 012345678901234
   * @param partnerSecret Example of partnerId 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
   */
  static initAppWithPartnerID(partnerID: string, partnerSecret: string): void {
    APMServicesBridge.initAppWithPartnerID(partnerID, partnerSecret);
  }

  /**
   * Init APMServices with a partnerId, a partnerSecret and a appId
   * If you use this method : the packageName send to server app's miles is "com.example.app"
   * @param partnerId Example of partnerId 012345678901234
   * @param partnerSecret Example of partnerId 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
   * @param appId Example of appId com.example.app
   */
  static initAppWithAppID(partnerID: string, partnerSecret: string, appID: string): void {
    APMServicesBridge.initAppWithAppID(partnerID, partnerSecret, appID);
  }

  /**
   * Refresh the SDK, call this method when you change the screen
   */
  static refreshSDK(): void {
    APMServicesBridge.refreshSDK();
  }

  /**
   * APMServices send events to APMServicesListener
   * - void apmServicesOnLoading();
   * - void apmServicesReady(boolean newInfos);
   * - void apmServicesDisable();
   * - void apmServicesUserWinPoints(APMEarn earn, APMUser user);
   * - void apmServicesUserWinChallenge(APMChallenge challenge, APMUser user);
   * - void apmServicesUserWinTrophy(APMTrophy trophy, APMUser user);
   * - void apmServicesUserWinLevel(APMUserStatus userStatus, APMUser user);
   */
  static setServicesListener(): void {
    APMServicesBridge.setServicesListener();
  }

  /**
   * APMServices send events to APMServicesUserListener
   * - void apmServicesUserChanged(APMUser user);
   */
  static setServicesUserListener(): void {
    APMServicesBridge.setServicesUserListener();
  }

  /**
   * Register a action
   * @param action A object APMAction
   */
  static registerAction(action: any): void {
    APMServicesBridge.registerAction(action);
  }

  /**
   * Remove the action
   * @param actionName The actionName
   */
  static removeActionWithActionName(actionName: string): void {
    APMServicesBridge.removeActionWithActionName(actionName);
  }

  /**
   * Get all actions from a classId
   * @param classId The classId
   * @return All actions associated with classId
   */
  static getActionsForClassId(classId: string): any {
    return APMServicesBridge.getActionsForClassId(classId);
  }

  /**
   * Change the current classId for the session
   * @param classID Select a new classID for the session
   */
  static selectClassID(classId: string): void {
    APMServicesBridge.selectClassID(classId);
  }

  /**
   * Call this method for a TAG, if the user is elligible, the user win some points
   * @param actionName The actionName which has been triggered
   */
  static triggerAction(action: string): void {
    APMServicesBridge.triggerAction(action);
  }

  /**
   * Set the baseUrl for API, default is PRODUCTION
   * PRODUCTION : https://api.appsmiles.eu/
   * SANDOX : https://api-sandbox.appsmiles.eu/
   * @param baseUrl the base url use for API
   */
  static setBaseUrl(url: string): void {
    APMServicesBridge.setBaseUrl(url);
  }

  /**
   * Get the current baseUrl for API, default is PRODUCTION
   * PRODUCTION : https://api.appsmiles.eu/
   * SANDOX : https://api-sandbox.appsmiles.eu/
   * @return A string url
   */
  static getBaseUrl(): string {
    return APMServicesBridge.getBaseUrl();
  }

  /**
   * DebugMode show all logs of APMServices
   * @param debugMode true to activate debugMode (debugMode show all logs of APMServices)
   */
  static setDebugMode(debugMode: boolean): void {
    APMServicesBridge.setDebugMode(debugMode);
  }

  /**
   * DebugMode show all logs of APMServices
   * @return DebugMode show all logs of APMServices
   */
  static isDebugMode(): boolean {
    return APMServicesBridge.isDebugMode();
  }

  /**
   * True retrieve the position of user when he win points, false otherwise (default is false)
   * @param geolocEnabled True retrieve the position of user when he win points, false otherwise (default is false)
   */
  static setGeolocEnabled(geolocEnabled: boolean): void {
    APMServicesBridge.setGeolocEnabled(geolocEnabled);
  }

  /**
   * True retrieve the position of user when he win points, false otherwise (default is false)
   * @return True retrieve the position of user when he win points, false otherwise (default is false)
   */
  static isGeolocEnabled(): boolean {
    return APMServicesBridge.isGeolocEnabled();
  }

  /**
   * Set a new appId for session
   * @param appId Example of appId "com.example.app"
   */
  static setAppID(appID: string): void {
    APMServicesBridge.setAppID(appID);
  }

  /**
   * Get the current appId for session
   * @return The current appId
   */
  static appID(): string {
    return APMServicesBridge.appID();
  }

  /**
   * Set a new partnerId for session
   * @param partnerId Example of partnerId "0123456789"
   */
  static setPartnerID(partnerID: string): void {
    APMServicesBridge.setPartnerID(partnerID);
  }

  /**
   * Get the current partnerId for session
   * @return The current partnerId
   */
  static partnerID(): string {
    return APMServicesBridge.partnerID();
  }

  /**
   * Set a new partnerSecret for session
   * @param partnerSecret Example of partnerId "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   */
  static setPartnerSecret(partnerSecret: string): void {
    APMServicesBridge.setPartnerSecret(partnerSecret);
  }

  /**
   * Get the current partnerSecret for session
   * @return The current partnerSecret
   */
  static partnerSecret(): string {
    return APMServicesBridge.partnerSecret();
  }

  /**
   * Set the versionCode of APM (use from a other SDK app's miles)
   * @param apmVersionCode the APM version code
   */
  static setApmVersionCode(apmVersionCode: string): void {
    APMServicesBridge.setApmVersionCode(apmVersionCode);
  }

  /**
   * Get the versionCode of APM (use from a other SDK app's miles)
   * @return The APM version code
   */
  static apmVersionCode(): string {
    return APMServicesBridge.apmVersionCode();
  }

  /**
   * Set the versionName of APM (use from a other SDK app's miles)
   * @param apmVersionName the APM version name
   */
  static setApmVersionName(apmVersionName: string): void {
    APMServicesBridge.setApmVersionName(apmVersionName);
  }

  /**
   * Get the versionName of APM (use from a other SDK app's miles)
   * @return The APM version name
   */
  static apmVersionName(): string {
    return APMServicesBridge.apmVersionName();
  }

  /**
   * TODO
   * @return TODO
   */
  static isInitialLevel(): boolean {
    return APMServicesBridge.isInitialLevel();
  }

  /**
   * ServicesIsOnError informs if the SDK is on error or not, use this method to check if session is correct
   * @return ServicesIsOnError informs if the SDK is on error or not, use this method to check if session is correct
   */
  static servicesIsOnError(): boolean {
    return APMServicesBridge.servicesIsOnError();
  }

  /**
   * ServicesIsDisabled infroms if the SDK is disabled willingly by the brand (BO app's miles)
   * @return ServicesIsDisabled infroms if the SDK is disabled willingly by the brand (BO app's miles
   */
  static servicesIsDisabled(): boolean {
    return APMServicesBridge.servicesIsDisabled();
  }

  /**
   * Get the user, can be null
   * @return Get the user, can be null
   */
  static user(): any {
    return APMServicesBridge.user();
  }

  /**
   * Get the current program, contains all informations of program, can be null
   * @return Get the current program, contains all informations of program, can be null
   */
  static prog(): any {
    return APMServicesBridge.prog();
  }

  /**
   * Get the current daily challenge, can be null
   * @return Get the current daily challenge, can be null
   */
  static generosity(): any {
    return APMServicesBridge.generosity();
  }

  /**
   * Get all challenges from program for this user, can be null
   * @return Get all challenges from program for this user, can be null
   */
  static generosities(): any {
    return APMServicesBridge.generosities();
  }

  /**
   * Get the next gift that the user can ben convert, can be null
   * @return Get the next gift that the user can ben convert, can be null
   */
  static gift(): any {
    return APMServicesBridge.gift();
  }

  /**
   * Get device's information, can be null
   * @return Get device's information, can be null
   */
  static device(): any {
    return APMServicesBridge.device();
  }

  /**
   * Get all frequencies availables for a action, can be null
   * @return Get all frequencies availables for a action, can be null
   */
  static frequencies(): any {
    return APMServicesBridge.frequencies();
  }

  /**
   * Get all values availables for a action, can be null
   * @return Get all values availables for a action, can be null
   */
  static values(): any {
    return APMServicesBridge.values();
  }

  /**
   * Get all status availables for a program, can be null
   * @return Get all status availables for a program, can be null
   */
  static status(): any {
    return APMServicesBridge.status();
  }

  /**
   * SdkLifeCycleEnabled can block lifecycle of SDK (onCreate, onResume, onNewIntent, onActivityResult, onPause), default value is true
   * @param sdkLifeCycleEnabled SdkLifeCycleEnabled can block lifecycle of SDK (onCreate, onResume, onNewIntent, onActivityResult, onPause), default value is true
   */
  static setSdkLifeCycleEnabled(sdkLifeCycleEnabled: boolean): void {
    APMServicesBridge.setSdkLifeCycleEnabled(sdkLifeCycleEnabled);
  }

  /**
   * SdkLifeCycleEnabled can block lifecycle of SDK (onCreate, onResume, onNewIntent, onActivityResult, onPause), default value is true
   * @return SdkLifeCycleEnabled can block lifecycle of SDK (onCreate, onResume, onNewIntent, onActivityResult, onPause), default value is true
   */
  static sdkLifeCycleEnabled(): boolean {
    return APMServicesBridge.sdkLifeCycleEnabled();
  }

  /**
   * SdkIsLoading informs if the SDK is currently refreshing information from server app's miles
   * @return SdkIsLoading informs if the SDK is currently refreshing information from server app's miles
   */
  static sdkIsLoading(): boolean {
    return APMServicesBridge.sdkIsLoading();
  }

  /**
   * Get the current classId for the session
   * @return The current classId
   */
  static classID(): string {
    return APMServicesBridge.classID();
  }

  /**
   * Get the theme (custo) of the session
   * @return The theme
   */
  static theme(): any {
    return APMServicesBridge.theme();
  }

  /**
     * Set the device status
     *      APMServicesConfig.APM_DEVICE_STATUS_NOT_SET
     *      APMServicesConfig.APM_DEVICE_STATUS_OK
     *      APMServicesConfig.APM_DEVICE_STATUS_ANONYMOUS
     *      APMServicesConfig.APM_DEVICE_STATUS_OPTIN_OFF
     * @param deviceStatus Set the device status
     */
  static setDeviceStatus(deviceStatus: number): void {
    APMServicesBridge.setDeviceStatus(deviceStatus);
  }

  /**
     * Set the device optIn
     *      APMServicesConfig.APM_DEVICE_OPT_IN_NOT_SET
     *      APMServicesConfig.APM_DEVICE_OPT_IN_REFUSE
     *      APMServicesConfig.APM_DEVICE_OPT_IN_ACCEPT
     * @param optIn Set the device optIn
     */
  static setDeviceOptIn(optIn: number): void {
    APMServicesBridge.setDeviceOptIn(optIn);
  }

  /**
     * Get the pending connection info if a connection failed with a optin not accepted
     * @return Get the pending connection info
     */
  static getPendingConnectionInfo(): any {
    return APMServicesBridge.getPendingConnectionInfo();
  }

  static getVersions(): any {
    return APMServicesBridge.getVersions();
  }
}

const APMServicesConfigModule = {
  APM_API_VERSION: APMServicesConfigBridge.APM_API_VERSION,
  APM_URL_API_PROD: APMServicesConfigBridge.APM_URL_API_PROD,
  APM_URL_API_SANDBOX: APMServicesConfigBridge.APM_URL_API_SANDBOX,
  APM_URL_SITE_APPSMILES: APMServicesConfigBridge.APM_URL_SITE_APPSMILES,
  APM_PARTNER_LEVEL_INITIAL: APMServicesConfigBridge.APM_PARTNER_LEVEL_INITIAL,
  APM_PARTNER_LEVEL_STANDARD: APMServicesConfigBridge.APM_PARTNER_LEVEL_STANDARD,
  APM_PARTNER_LEVEL_PREMIUM: APMServicesConfigBridge.APM_PARTNER_LEVEL_PREMIUM,
  APM_K_USER_GENDER_MME: APMServicesConfigBridge.APM_K_USER_GENDER_MME,
  APM_K_USER_GENDER_M: APMServicesConfigBridge.APM_K_USER_GENDER_M,
  APM_GIFT_TYPE_TEXT: APMServicesConfigBridge.APM_GIFT_TYPE_TEXT,
  APM_GIFT_TYPE_BARCODE: APMServicesConfigBridge.APM_GIFT_TYPE_BARCODE,
  APM_GIFT_TYPE_OBJECT: APMServicesConfigBridge.APM_GIFT_TYPE_OBJECT,
  APM_GIFT_TYPE_URL: APMServicesConfigBridge.APM_GIFT_TYPE_URL,
  APM_GIFT_TYPE_EMAIL: APMServicesConfigBridge.APM_GIFT_TYPE_EMAIL,
  APM_GIFT_NATURE_POINTS: APMServicesConfigBridge.APM_GIFT_NATURE_POINTS,
  APM_GIFT_NATURE_STATUS: APMServicesConfigBridge.APM_GIFT_NATURE_STATUS,
  APM_SHOW_PAGE_CNIL: APMServicesConfigBridge.APM_SHOW_PAGE_CNIL,
  APM_SHOW_PAGE_CGU: APMServicesConfigBridge.APM_SHOW_PAGE_CGU,
  APM_SHOW_PAGE_MENTIONS: APMServicesConfigBridge.APM_SHOW_PAGE_MENTIONS,
  APM_SHOW_PAGE_HELPER: APMServicesConfigBridge.APM_SHOW_PAGE_HELPER,
  APM_SHOW_PAGE_TUTO: APMServicesConfigBridge.APM_SHOW_PAGE_TUTO,
  APM_SHOW_PAGE_INTERSTITIAL: APMServicesConfigBridge.APM_SHOW_PAGE_INTERSTITIAL,
  APM_SHOW_PAGE_APP_ONBOARDING: APMServicesConfigBridge.APM_SHOW_PAGE_APP_ONBOARDING,
  APM_SHOW_PAGE_APP_MENTION: APMServicesConfigBridge.APM_SHOW_PAGE_APP_MENTION,
  APM_SHOW_PAGE_APP_TUTORIAL: APMServicesConfigBridge.APM_SHOW_PAGE_APP_TUTORIAL,
  APM_SHOW_PAGE_APP_INTERSTITIAL: APMServicesConfigBridge.APM_SHOW_PAGE_APP_INTERSTITIAL,
  APM_HOW_WORKS_TYPE_WEBVIEW: APMServicesConfigBridge.APM_HOW_WORKS_TYPE_WEBVIEW,
  APM_HOW_WORKS_TYPE_ACTIONS: APMServicesConfigBridge.APM_HOW_WORKS_TYPE_ACTIONS,
  APM_HOW_WORKS_TYPE_GIFTS: APMServicesConfigBridge.APM_HOW_WORKS_TYPE_GIFTS,
  APM_PAGE_TARGET_ONLY_NOT_CONNECTED: APMServicesConfigBridge.APM_PAGE_TARGET_ONLY_NOT_CONNECTED,
  APM_PAGE_TARGET_ONLY_CONNECTED: APMServicesConfigBridge.APM_PAGE_TARGET_ONLY_CONNECTED,
  APM_PAGE_TARGET_BOTH: APMServicesConfigBridge.APM_PAGE_TARGET_BOTH,
  APM_WALKTHROUGH_STATUS_OFFLINE: APMServicesConfigBridge.APM_WALKTHROUGH_STATUS_OFFLINE,
  APM_WALKTHROUGH_STATUS_ONLINE: APMServicesConfigBridge.APM_WALKTHROUGH_STATUS_ONLINE,
  APM_EXCEPTION_NO_ERROR: APMServicesConfigBridge.APM_EXCEPTION_NO_ERROR,
  APM_EXCEPTION_ERROR_SERVER: APMServicesConfigBridge.APM_EXCEPTION_ERROR_SERVER,
  APM_EXCEPTION_INVALID_TOKEN: APMServicesConfigBridge.APM_EXCEPTION_INVALID_TOKEN,
  APM_EXCEPTION_MODE_TEST: APMServicesConfigBridge.APM_EXCEPTION_MODE_TEST,
  APM_EXCEPTION_NO_NETWORK: APMServicesConfigBridge.APM_EXCEPTION_NO_NETWORK,
  APM_EXCEPTION_UNKNOWN_ERROR: APMServicesConfigBridge.APM_EXCEPTION_UNKNOWN_ERROR,
  APM_EXCEPTION_SERVICE_LOADING: APMServicesConfigBridge.APM_EXCEPTION_SERVICE_LOADING,
  APM_EXCEPTION_SERVICE_NOT_ACTIVE: APMServicesConfigBridge.APM_EXCEPTION_SERVICE_NOT_ACTIVE,
  APM_EXCEPTION_CONFIG: APMServicesConfigBridge.APM_EXCEPTION_CONFIG,
  APM_EXCEPTION_ACCOUNT_NOT_CONNECTED: APMServicesConfigBridge.APM_EXCEPTION_ACCOUNT_NOT_CONNECTED,
  APM_EXCEPTION_HTTP_REQUEST_ERROR: APMServicesConfigBridge.APM_EXCEPTION_HTTP_REQUEST_ERROR,
  APM_EXCEPTION_URL_HTTP_INVALID: APMServicesConfigBridge.APM_EXCEPTION_URL_HTTP_INVALID,
  APM_EXCEPTION_OPT_IN_NOT_ACCEPTED: APMServicesConfigBridge.APM_EXCEPTION_OPT_IN_NOT_ACCEPTED,
  APM_DEFAULT_DATE_FORMAT: APMServicesConfigBridge.APM_DEFAULT_DATE_FORMAT,
  APM_DEVICE_STATUS_NOT_SET: APMServicesConfigBridge.APM_DEVICE_STATUS_NOT_SET,
  APM_DEVICE_STATUS_OK: APMServicesConfigBridge.APM_DEVICE_STATUS_OK,
  APM_DEVICE_STATUS_ANONYMOUS: APMServicesConfigBridge.APM_DEVICE_STATUS_ANONYMOUS,
  APM_DEVICE_STATUS_OPTIN_OFF: APMServicesConfigBridge.APM_DEVICE_STATUS_OPTIN_OFF,
  APM_DEVICE_OPT_IN_NOT_SET: APMServicesConfigBridge.APM_DEVICE_OPT_IN_NOT_SET,
  APM_DEVICE_OPT_IN_REFUSE: APMServicesConfigBridge.APM_DEVICE_OPT_IN_REFUSE,
  APM_DEVICE_OPT_IN_ACCEPT: APMServicesConfigBridge.APM_DEVICE_OPT_IN_ACCEPT,
  APM_CLASS_ID_GLOBAL: APMServicesConfigBridge.APM_CLASS_ID_GLOBAL,
  APM_AD_TYPE_BONUS: APMServicesConfigBridge.APM_AD_TYPE_BONUS,
  APM_AD_TYPE_NEWS: APMServicesConfigBridge.APM_AD_TYPE_NEWS,
  APM_AD_TYPE_SPECIALS: APMServicesConfigBridge.APM_AD_TYPE_SPECIALS,
  APM_GENEROSITY_TYPE_SYSTEMATIC: APMServicesConfigBridge.APM_GENEROSITY_TYPE_SYSTEMATIC,
  APM_GENEROSITY_TYPE_SUGGESTED: APMServicesConfigBridge.APM_GENEROSITY_TYPE_SUGGESTED
}

/**
 * APMServicesAd
 * - adList
 */
class APMServicesAdModule {

  /**
   * Retrieve all ads for this partner (bonuses)
   * @param listener Listener the get the results
   */
  static adList(): any {
    return APMServicesAdBridge.adList();
  }

  /**
   * Retrieve all news
   * @param listener Listener the get the results
   */
  static adNewsList(): any {
    return APMServicesAdBridge.adNewsList();
  }

  /**
   * Retrieve all specials news
   * @param listener Listener the get the results
   */
  static adSpecialsList(): any {
    return APMServicesAdBridge.adSpecialsList();
  }
}

/**
 * APMServicesGenerosity
 * - generosityList
 * - generositySave
 * - generosityRemove
 */
class APMServicesGenerosityModule {

  /**
   * Get all generosities for the program for a specific classId
   * @param classId The specific classId
   * @param listener Listener the get the results
   */
  static generosityList(classId: string): any {
    return APMServicesGenerosityBridge.generosityList(classId);
  }

  /**
   * Save a generosity to BO app's miles
   * @param generosity TODO
   * @param value [0, 100]
   * @param frequency TODO
   * @param listener Listener the get the results
   */
  static generositySave(generosity: any, value: number, frequence: number): any {
    return APMServicesGenerosityBridge.generositySave(generosity, value, frequence);
  }

  /**
   * Remove a generosity from BO app's miles
   * @param generosity TODO
   * @param listener Listener the get the results
   */
  static generosityRemove(generosity: any): any {
    return APMServicesGenerosityBridge.generosityRemove(generosity);
  }
}

/**
 * APMServicesGift
 * - giftCheckAvailability
 * - giftList
 * - giftCategoryList
 * - giftView
 */
class APMServicesGiftModule {

  /**
   * Convert the gift
   * @param gift The gift to be converted
   * @param listener Listener the get the results
   */
  static giftCheckAvailability(gift: any): any {
    return APMServicesGiftBridge.giftCheckAvailability(gift);
  }

  /**
   * Get the list of all gifts for the program
   * @param categoryId 0 for all gifts, or set a categoryId (service giftCategoryList)
   * @param amount 0 for all gifts, amount of user also
   * @param listener Listener the get the results
   */
  static giftList(categoryId: string, amount: string): any {
    return APMServicesGiftBridge.giftList(categoryId, amount);
  }

  /**
   * Get the list of all categories of gifts
   * @param listener Listener the get the results
   */
  static giftCategoryList(): any {
    return APMServicesGiftBridge.giftCategoryList();
  }

  /**
   * Get a gift from a giftId
   * @param giftId The giftId of the gift
   * @param listener Listener the get the results
   */
  static giftView(giftID: string): any {
    return APMServicesGiftBridge.giftView(giftID);
  }
}

/**
 * TODO
 */
class APMServicesLogModule {

  /**
   * TODO
   * @param params TODO
   * @param listener TODO
   */
  static logSave(params: any): any {
    return APMServicesLogBridge.logSave(params);
  }
}

/**
 * APMServicesPage
 * - page
 */
class APMServicesPageModule {

  /**
   * Get the page from "page"
   * @param page "page" :
   *             - APMServicesConfig.APM_SHOW_PAGE_CNIL
   *             - APMServicesConfig.APM_SHOW_PAGE_CGU
   *             - APMServicesConfig.APM_SHOW_PAGE_MENTIONS
   *             - APMServicesConfig.APM_SHOW_PAGE_HELPER
   *             - APMServicesConfig.APM_SHOW_PAGE_TUTO
   *             - APMServicesConfig.APM_SHOW_PAGE_INTERSTITIAL
   *             - APMServicesConfig.APM_SHOW_PAGE_APP_ONBOARDING
   *             - APMServicesConfig.APM_SHOW_PAGE_APP_MENTION
   *             - APMServicesConfig.APM_SHOW_PAGE_APP_TUTORIAL
   *             - APMServicesConfig.APM_SHOW_PAGE_APP_INTERSTITIAL
   * @param listener Listener the get the results
   */
  static page(page: number): any {
    return APMServicesPageBridge.page(page);
  }
}

/**
 * APMServicesPartner
 * - partnerList
 */
class APMServicesPartnerModule {

  /**
   * Get all partners from a categoryId
   * @param categoryId 0 for all partners, or a specific category
   * @param listener Listener the get the results
   */
  static partnerList(categoryID: string): any {
    return APMServicesPartnerBridge.partnerList(categoryID);
  }
}

/**
 * APMServicesStatistic
 * - statisticGenerosityDisplay
 * - statisticGiftDisplay
 */
class APMServicesStatisticModule {

  /**
   * Call this when a daily challenge is showed to the user
   * @param generosityID The generosityId of the daily challenge
   * @param tagID The tagID of the daily challenge
   * @param listener Listener the get the results
   */
  static statisticGenerosityDisplay(generosityID: string, tagID: string): any {
    return APMServicesStatisticBridge.statisticGenerosityDisplay(generosityID, tagID);
  }

  /**
   * Call this when a gift is showed to the user
   * @param giftID The giftID of the gift
   * @param giftLabel The giftLabel of the gift
   * @param listener Listener the get the results
   */
  static statisticGiftDisplay(giftID: string, giftLabel: string): any {
    return APMServicesStatisticBridge.statisticGiftDisplay(giftID, giftLabel);
  }
}

/**
 * APMServicesStore
 * - storeList
 */
class APMServicesStoreModule {

  /**
   * Get all stores of partner
   * @param listener Listener the get the results
   */
  static storeList(): any {
    return APMServicesStoreBridge.storeList();
  }
}

/**
 * APMServicesUser
 * - userConnect
 * - userClientConnectWithJSON
 * - userClientConnect
 * - userLogout
 * - userCreate
 * - userSave
 * - userClientSaveWithJSON
 * - userClientSave
 * - userSavePassword
 * - userRefresh
 * - userResetPassword
 * - userHistory
 * - userHistoryBurns
 * - userHistoryEarns
 * - userUnsubscribe
 * - userContact
 * - userEvaluate
 * - userGetSettings
 * - userSaveSettings
 * - userCheckToken
 * - userFBConnect
 * - userSavePushToken
 * - userList
 * - userDelete
 */
class APMServicesUserModule {

  /**
   * Connect a user with email and password
   * @param email Mandatory : email of user
   * @param password Mandatory : password of user
   * @param segments Segments of user
   * @param listener Listener the get the results
   */
  static userConnect(email: string, password: string, segments: any): any {
    return APMServicesUserBridge.userConnect(email, password, segments);
  }

  /**
   * Connect a user with firstname, email and partnerClientId
   * @param user A JSONObject,
   *             example :
   *             "partnerClientID": "demo-awesome-ios"
   *             "email": "demo-awesome-ios@demo.com"
   * @param listener Listener the get the results
   */
  static userClientConnectWithJSON(user: any): any {
    return APMServicesUserBridge.userClientConnectWithJSON(user);
  }

  /**
   * Connect a user with firstname, email and partnerClientId
   * @param firstname Mandatory : Firstname of user
   * @param lastname : Lastname of user
   * @param email Mandatory : Email of user
   * @param facebookId FacebookId of user
   * @param partnerClientId Mandatory : PartnerClientId of user (unique ID of user in your BDD)
   * @param oldClientId OldClientId of user (unique ID of user in your BDD)
   * @param segments Segments of user
   * @param optIn RGPD Opt In,
    APMServicesConfig.APM_DEVICE_OPT_IN_NOT_SET = -1;
    APMServicesConfig.APM_DEVICE_OPT_IN_REFUSE  = 1;
    APMServicesConfig.APM_DEVICE_OPT_IN_ACCEPT  = 0;
   * @param listener Listener the get the results
   */
  static userClientConnect(firstname: string, lastname: ? string, email : string, facebookId : ? string, partnerClientId : ? string, oldClientId : ? string, segments : ? any, optIn : ? number): any {
    return APMServicesUserBridge.userClientConnect(firstname, lastname, email, facebookId, partnerClientId, oldClientId, segments, optIn);
  }

  /**
   * Disconnect a user
   * @param listener Listener the get the results
   */
  static userLogout(): any {
    return APMServicesUserBridge.userLogout();
  }

  /**
   * Create a user
   * @param firstname Firstname of user
   * @param lastname Lastname of user
   * @param email Mandatory : Email of user
   * @param password Mandatory : Password of user
   * @param facebookId FacebookId of user
   * @param segments Segments of user
   * @param listener Listener the get the results
   */
  static userCreate(firstname: string, lastname: string, email: string, password: string, facebookId: string, segments: any): any {
    return APMServicesUserBridge.userCreate(firstname, lastname, email, password, facebookId, segments);
  }

  /**
   * Update a user
   * @param firstname Firstname of user
   * @param lastname Lastname of user
   * @param mobile Mobile of user
   * @param gender Gender of user
   *               - APMServicesConfig.APM_K_USER_GENDER_MME
   *               - APMServicesConfig.APM_K_USER_GENDER_M
   * @param birthday Birthday of user
   * @param city City of user
   * @param facebookId FacebookId of user
   * @param segments Segments of user
   * @param listener Listener the get the results
   */
  static userSave(firstname: string, lastname: ? string, mobile : ? string, gender : ? string, birthday : ? string, city : ? string, facebookId : ? string, segments : ? any): any {
    return APMServicesUserBridge.userSave(firstname, lastname, mobile, gender, birthday, city, facebookId, segments);
  }

  /**
   * Update a user
   * @param user A JSONObject
   *             example :
   *             "partnerClientID": "demo-awesome-ios"
   *             "email": "demo-awesome-ios@demo.com"
   *             "town": "Bordeaux"
   * @param listener Listener the get the results
   */
  static userClientSaveWithJSON(user: any): any {
    return APMServicesUserBridge.userClientSaveWithJSON(user);
  }

  /**
   * Update a user
   * @param email Email of user
   * @param firstname Firstname of user
   * @param lastname Lastname of user
   * @param mobile Mobile of user
   * @param gender Gender of user
   *               - APMServicesConfig.APM_K_USER_GENDER_MME
   *               - APMServicesConfig.APM_K_USER_GENDER_M
   * @param birthday Birthday of user
   * @param city City of user
   * @param facebookId FacebookId of user
   * @param partnerClientId PartnerClientId of user
   * @param segments Segments of user
   * @param listener Listener the get the results
   */
  static userClientSave(email: string, firstname: string, lastname: ? string, mobile : ? string, gender : ? string, birthday : ? string, city : ? string, facebookId : ? string, partnerClientId : string, segments: ? any): any {
    return APMServicesUserBridge.userClientSave(email, firstname, lastname, mobile, gender, birthday, city, facebookId, partnerClientId, segments);
  }

  /**
   * Change the password of the user
   * @param oldPassword OldPassword of user
   * @param newPassword NewPassword of user
   * @param confirmPassword ConfirmPassword of user
   * @param listener Listener the get the results
   */
  static userSavePassword(oldPassword: string, newPassword: string, confirmPassword: string): any {
    return APMServicesUserBridge.userSavePassword(oldPassword, newPassword, confirmPassword);
  }

  /**
   * Refresh the user from the server app's miles
   * @param listener Listener the get the results
   */
  static userRefresh(): any {
    return APMServicesUserBridge.userRefresh();
  }

  /**
   * Send a email with a new password
   * @param email Email of user
   * @param listener Listener the get the results
   */
  static userResetPassword(email: string): any {
    return APMServicesUserBridge.userResetPassword(email);
  }

  /**
   * Get the history of user, earns and burns
   * @param listener Listener the get the results
   */
  static userHistory(): any {
    return APMServicesUserBridge.userHistory();
  }

  /**
   * Get all burns of user
   * @param listener Listener the get the results
   */
  static userHistoryBurns(): any {
    return APMServicesUserBridge.userHistoryBurns();
  }

  /**
   * Get all earns of user
   * @param listener Listener the get the results
   */
  static userHistoryEarns(): any {
    return APMServicesUserBridge.userHistoryEarns();
  }

  /**
   * Unsubscribe the user from the program
   * @param comment Comment leave by the user, can be null
   * @param listener Listener the get the results
   */
  static userUnsubscribeWithComment(comment: string): any {
    return APMServicesUserBridge.userUnsubscribeWithComment(comment);
  }

  /**
   * Contact form
   * @param comment Comment leave by the user
   * @param listener Listener the get the results
   */
  static userContact(comment: string): any {
    return APMServicesUserBridge.userContact(comment);
  }

  /**
   * Evaluate form
   * @param note Note leave by the user
   * @param comment Comment leave by the user
   * @param listener Listener the get the results
   */
  static userEvaluate(note: string, comment: string): any {
    return APMServicesUserBridge.userEvaluate(note, comment);
  }

  /**
   * Get settings of user
   * @param listener Listener the get the results
   */
  static userGetSettings(): any {
    return APMServicesUserBridge.userGetSettings();
  }

  /**
   * Set settings of user
   * @param push Push on/off
   * @param mail Mail on/off
   * @param sms Sms on/off
   * @param phone Mobile number if sms is true
   * @param listener Listener the get the results
   */
  static userSaveSettings(push: boolean, mail: boolean, sms: boolean, mobile: string): any {
    return APMServicesUserBridge.userSaveSettings(push, mail, sms, mobile);
  }

  /**
   * Check if the token of user is correct (not expired)
   * @param listener Listener the get the results
   */
  static userCheckToken(): any {
    return APMServicesUserBridge.userCheckToken();
  }

  /**
   * Connect a user with FBConnect
   * @param email Email of user
   * @param facebookId FacebookId of user
   * @param partnerClientId PartnerClientId of user (unique ID of user in your BDD)
   * @param segments Segments of user
   * @param listener Listener the get the results
   */
  static userFBConnect(email: string, fbID: string, partnerClientId: string, segments: any): any {
    return APMServicesUserBridge.userFBConnect(email, fbID, partnerClientId, segments);
  }

  /**
   * Send the push token in server app's miles
   * @param pushToken The pushToken of user
   * @param listener Listener the get the results
   */
  static userSavePushToken(pushToken: string): any {
    return APMServicesUserBridge.userSavePushToken(pushToken);
  }

  /**
   * Delete the user
   * @param listener Listener the get the results
   */
  static userDelete(): any {
    return APMServicesUserBridge.userDelete();
  }

  /**
   * Get a list of user
   * @param partnerClientIds A array of partnerClientIds
   * @param listener Listener the get the results
   */
  static userList(partnerClientIds: any): any {
    return APMServicesUserBridge.userList(partnerClientIds);
  }
}

module.exports.APMServicesModule = APMServicesModule;
module.exports.APMServicesConfigModule = APMServicesConfigModule;
module.exports.APMServicesAdModule = APMServicesAdModule;
module.exports.APMServicesGenerosityModule = APMServicesGenerosityModule;
module.exports.APMServicesGiftModule = APMServicesGiftModule;
module.exports.APMServicesLogModule = APMServicesLogModule;
module.exports.APMServicesPageModule = APMServicesPageModule;
module.exports.APMServicesPartnerModule = APMServicesPartnerModule;
module.exports.APMServicesStatisticModule = APMServicesStatisticModule;
module.exports.APMServicesStoreModule = APMServicesStoreModule;
module.exports.APMServicesUserModule = APMServicesUserModule;
