"use strict";

import { NavigationRoot } from "./Navigation.js";
import { NativeCommandsSender } from "./adapters/NativeCommandsSender.js";
import { NativeEventsReceiver } from "./adapters/NativeEventsReceiver.js";
import { AppRegistryService } from "./adapters/AppRegistryService.js";
export class NavigationDelegate {
  constructor() {
    this.concreteNavigation = this.createConcreteNavigation(new NativeCommandsSender(), new NativeEventsReceiver(), new AppRegistryService());
  }
  createConcreteNavigation(nativeCommandsSender, nativeEventsReceiver, appRegistryService) {
    return new NavigationRoot(nativeCommandsSender, nativeEventsReceiver, appRegistryService);
  }

  /**
   * Every navigation component in your app must be registered with a unique name.
   * The component itself is a traditional React component extending React.Component.
   */
  registerComponent(componentName, componentProvider, concreteComponentProvider) {
    return this.concreteNavigation.registerComponent(componentName, componentProvider, concreteComponentProvider);
  }

  /**
   * Adds an option processor which allows option interpolation by optionPath.
   */
  addOptionProcessor(optionPath, processor) {
    return this.concreteNavigation.addOptionProcessor(optionPath, processor);
  }

  /**
   * Method to be invoked when a layout is processed and is about to be created. This can be used to change layout options or even inject props to components.
   */
  addLayoutProcessor(processor) {
    return this.concreteNavigation.addLayoutProcessor(processor);
  }
  setLazyComponentRegistrator(lazyRegistratorFn) {
    this.concreteNavigation.setLazyComponentRegistrator(lazyRegistratorFn);
  }

  /**
   * Utility helper function like registerComponent,
   * wraps the provided component with a react-redux Provider with the passed redux store
   * @deprecated
   */
  registerComponentWithRedux(componentName, getComponentClassFunc, ReduxProvider, reduxStore) {
    return this.concreteNavigation.registerComponentWithRedux(componentName, getComponentClassFunc, ReduxProvider, reduxStore);
  }

  /**
   * Reset the app to a new layout
   */
  setRoot(layout) {
    return this.concreteNavigation.setRoot(layout);
  }

  /**
   * Set default options to all screens. Useful for declaring a consistent style across the app.
   */
  setDefaultOptions(options) {
    this.concreteNavigation.setDefaultOptions(options);
  }

  /**
   * Change a component's navigation options
   */
  mergeOptions(componentId, options) {
    this.concreteNavigation.mergeOptions(componentId, options);
  }

  /**
   * Update a mounted component's props
   */
  updateProps(componentId, props, callback) {
    this.concreteNavigation.updateProps(componentId, props, callback);
  }

  /**
   * Show a screen as a modal.
   */
  showModal(layout) {
    return this.concreteNavigation.showModal(layout);
  }

  /**
   * Dismiss a modal by componentId. The dismissed modal can be anywhere in the stack.
   */
  dismissModal(componentId, mergeOptions) {
    return this.concreteNavigation.dismissModal(componentId, mergeOptions);
  }

  /**
   * Dismiss all Modals
   */
  dismissAllModals(mergeOptions) {
    return this.concreteNavigation.dismissAllModals(mergeOptions);
  }

  /**
   * Push a new layout into this screen's navigation stack.
   */
  push(componentId, layout) {
    return this.concreteNavigation.push(componentId, layout);
  }

  /**
   * Pop a component from the stack, regardless of it's position.
   */
  pop(componentId, mergeOptions) {
    return this.concreteNavigation.pop(componentId, mergeOptions);
  }

  /**
   * Pop the stack to a given component
   */
  popTo(componentId, mergeOptions) {
    return this.concreteNavigation.popTo(componentId, mergeOptions);
  }

  /**
   * Pop the component's stack to root.
   */
  popToRoot(componentId, mergeOptions) {
    return this.concreteNavigation.popToRoot(componentId, mergeOptions);
  }

  /**
   * Sets new root component to stack.
   */
  setStackRoot(componentId, layout) {
    return this.concreteNavigation.setStackRoot(componentId, layout);
  }

  /**
   * Show overlay on top of the entire app
   */
  showOverlay(layout) {
    return this.concreteNavigation.showOverlay(layout);
  }

  /**
   * dismiss overlay by componentId
   */
  dismissOverlay(componentId) {
    return this.concreteNavigation.dismissOverlay(componentId);
  }

  /**
   * dismiss all overlays
   */
  dismissAllOverlays() {
    return this.concreteNavigation.dismissAllOverlays();
  }

  /**
   * Resolves arguments passed on launch
   */
  getLaunchArgs() {
    return this.concreteNavigation.getLaunchArgs();
  }

  /**
   * Configure deep link handling.
   */
  setLinking(config) {
    this.concreteNavigation.setLinking(config);
  }

  /**
   * Manually feed a URL into the deep link pipeline.
   */
  handleDeepLink(url) {
    this.concreteNavigation.handleDeepLink(url);
  }

  /**
   * Signal readiness to process deep links. Flushes any queued links.
   */
  setLinkingReady(ready) {
    this.concreteNavigation.setLinkingReady(ready);
  }

  /**
   * Obtain the events registry instance
   */
  events() {
    return this.concreteNavigation.events();
  }

  /**
   * Constants coming from native
   */
  async constants() {
    return await this.concreteNavigation.constants();
  }
  constantsSync() {
    return this.concreteNavigation.constantsSync();
  }
  get TouchablePreview() {
    return this.concreteNavigation.TouchablePreview;
  }
  mockNativeComponents(mockedNativeCommandsSender, mockedNativeEventsReceiver, mockedAppRegistryService) {
    this.concreteNavigation = this.createConcreteNavigation(mockedNativeCommandsSender, mockedNativeEventsReceiver, mockedAppRegistryService);
  }
  get mock() {
    return {
      store: this.concreteNavigation.store
    };
  }
}
//# sourceMappingURL=NavigationDelegate.js.map