/**
 * The configuration used while initializing the SDK.
 */
declare interface InitData {
  app_id: string;
  cluster: string;
  debug_logs?: number;
  disable_onsite?: boolean;
  enableSPA?: boolean;
  cards?: {
    enable: boolean;
    placeholder?: string;
    backgroundColor?: string;
    overLayColor?: string;
    fontFaces?: {
      family?: string;
      url?: string;
    }[];
    cardDismiss?: {
      color?: string;
      enable?: boolean;
    };
    optionButtonColor?: string;
    dateTimeColor?: string;
    unclickedCardIndicatorColor?: string;
    pinIcon?: string;
    refreshIcon?: string;
    navigationBar?: {
      backgroundColor?: string;
      text?: string;
      color?: string;
      fontSize?: string;
      fontFamily?: string;
    };
    closeButton?: {
      webIcon?: string;
      mWebIcon?: string;
    };
    tab?: {
      active?: {
        color?: string;
        underlineColor?: string;
        backgroundColor?: string;
      };
      inactiveTabFontColor?: string;
      fontSize?: string;
      fontFamily?: string;
      backgroundColor?: string;
    };
    webFloating?: {
      enable?: boolean;
      icon?: string;
      postion?: string;
      countBackgroundColor?: string;
      countColor?: string;
      iconBackgroundColor?: string;
      fontFamily?: string;
    };
    mWebFloating?: {
      enable?: boolean;
      icon?: string;
      postion?: string;
      countBackgroundColor?: string;
      countColor?: string;
      iconBackgroundColor?: string;
      fontFamily?: string;
    };
    card?: {
      headerFontSize?: string;
      descriptionFontSize?: string;
      ctaFontSize?: string;
      fontFamily?: string;
      horizontalRowColor?: string;
    };
    noDataContent?: {
      img?: string;
      text?: string;
    };
  };
  disable_web_push?: boolean;
  swPath?: string;
  disableCookies?: boolean;
  useLatest?: boolean;
  sdkVersion?: string;
}

declare interface Identity {
  [identity: string]: string;
}

/**
 * Initializes the SDK.
 * @param initData - configuration for SDK intialization.
 */
declare function initialize(initData: InitData): void;

/**
 * Indicates if the SDK has been loaded in the DOM and is available for use.
 * @returns `true` if the SDK has been successfully loaded; `false` otherwise.
 */
declare function isMoeLoaded(): boolean;

/**
 * Tracks an event with the given name and attributes.
 * @param eventName - The name of the event to track.
 * @param eventAttrs - The attributes associated with the event.
 * @returns A Promise that resolves when the event tracking is completed.
 */
declare function track_event(eventName: string, eventAttrs: any): Promise<any>;

/**
 * Provides the current-build version.
 * @returns The current version of the SDK in use.
 */
declare function getSdkVersion(): string;

/**
 * Explicitly set new debug level. To be used to see log messages in live environment too.
 * @note This does not append '_DEBUG' to the workspace ID.
 * @param level Debug level to set.
 */
declare function setDebugLevel(level: number): Promise<void>;

/**
 * Sets an identifier for the user.
 * @param id - The identifier associated to the user.
 * @returns A Promise that resolves when setting of the identifier is complete.
 */
declare function add_unique_user_id(id: string | number): Promise<any>;

/**
 * Updates the identifier of the user whose identifier is already set.
 * @param id - The identifier associated to the user.
 * @returns A Promise that resolves when the identifier is updated.
 */
declare function update_unique_user_id(id: string | number): Promise<any>;

/**
 * Adds/updates the identities of the user.
 * @param identity - The identities associated to the user.
 * @returns A promise that resolves when setting of the identities is complete.
 */
declare function identifyUser(identity: Identity): Promise<any>;

/**
 * Adds/updates the UID of the user.
 * @param identity - The UID associated to the user.
 * @returns A promise that resolves when setting of the UID is complete.
 */
declare function identifyUser(identity: string): Promise<any>;

/**
 * Provides the current identities associated to the user.
 * @returns the current identities of the user or null, if no identities have been set.
 */
declare function getUserIdentities(): Identity | null;

/**
 * Adds a user attribute with the given name and value.
 * @param attrName - The name of the user attribute.
 * @param attrValue - The value of the user attribute.
 * @returns A Promise that resolves when the user attribute is added.
 */
declare function add_user_attribute(
  attrName: string,
  attrValue: any,
): Promise<any>;

/**
 * Sets the first name of the user.
 * @param firstName - the first name of the user.
 * @returns A Promise that resolves when the first name is set.
 */
declare function add_first_name(firstName: string): Promise<any>;

/**
 * Sets the last name of the user.
 * @param lastName - the last name of the user.
 * @returns A Promise that resolves when the last name is set.
 */
declare function add_last_name(lastName: string): Promise<any>;

/**
 * Sets the email of the user.
 * @param email - the email of the user.
 * @returns A Promise that resolves when the email is set.
 */
declare function add_email(email: string): Promise<any>;

/**
 * Sets the mobile number of the user.
 * @param mobile - the mobile number of the user.
 * @returns A Promise that resolves when the mobile number is set.
 */
declare function add_mobile(mobile: string): Promise<any>;

/**
 * Sets the name of the user.
 * @param user_name - the name of the user.
 * @returns A Promise that resolves when the name is set.
 */
declare function add_user_name(user_name: string): Promise<any>;

/**
 * Sets the gender of the user.
 * @param gender - the gender of the user.
 * @returns A Promise that resolves when the gender is set.
 */
declare function add_gender(gender: string): Promise<any>;

/**
 * Sets the birthday of the user.
 * @param dob - the birthday of the user.
 * @returns A Promise that resolves when the birthday is set.
 */
declare function add_birthday(dob: Date): Promise<any>;

/**
 * Logs out the current user.
 * @returns A Promise that resolves when the user is logged out.
 */
declare function destroy_session(): Promise<any>;

/**
 * Starts the web push operations.
 * @note Self-handled web push must be configured from MoEngage dashboard in order to use this method.
 */
declare function call_web_push(config?: any): void;

/**
 * Tracks events related to page-view.
 * @returns A Promise that resolves when tracking of page-view events is completed.
 */
declare function track_page_view(): Promise<any>;

/**
 * Enforces the functionaly of page-change.
 * Tracks page-view events and resets all the SDK modules.
 */
declare function handle_page_change(): void;

/**
 * Emits an event on the window object when the cards module has been successfully initialized.
 * Use this method at the beginning of your code. Start using the cards module after the Promise resolves.
 * @note Refer this guide on how to use the cards module: https://developers.moengage.com/hc/en-us/articles/9526886582292-Cards
 * @returns A Promise that resolves when the cards module is successfully initialized.
 */
declare function on_cards_loaded(): Promise<any>;

/**
 * Contains the properties and methods of the cards module.
 * @note Refer this guide on how to use the cards module: https://developers.moengage.com/hc/en-us/articles/9526886582292-Cards
 */
declare const cards: any;

export {
  initialize,
  isMoeLoaded,
  track_event,
  getSdkVersion,
  setDebugLevel,
  add_unique_user_id,
  update_unique_user_id,
  identifyUser,
  getUserIdentities,
  add_user_attribute,
  add_first_name,
  add_last_name,
  add_email,
  add_mobile,
  add_user_name,
  add_gender,
  add_birthday,
  destroy_session,
  call_web_push,
  track_page_view,
  handle_page_change,
  on_cards_loaded,
  cards,
  InitData,
};
