"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useSystem = exports.SystemProvider = exports.SystemContext = exports.MainContainer = void 0;
var _react = require("react");
var _Button = _interopRequireDefault(require("./components/buttons/Button"));
var _containerApi = require("./container-api");
var _store = require("./contexts/reducers/store");
var _OnboardingStack = _interopRequireDefault(require("./navigators/OnboardingStack"));
var _Developer = _interopRequireDefault(require("./screens/Developer"));
var _Onboarding = _interopRequireDefault(require("./screens/Onboarding"));
var _Preface = _interopRequireDefault(require("./screens/Preface"));
var _Terms = _interopRequireDefault(require("./screens/Terms"));
var _navigators = require("./types/navigators");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class MainContainer {
  static TOKENS = _containerApi.TOKENS;
  constructor(container) {
    this.container = container;
  }
  init() {
    // eslint-disable-next-line no-console
    console.log(`Initializing Bifold container`);
    this.container.registerInstance(_containerApi.TOKENS.SCREEN_PREFACE, _Preface.default);
    this.container.registerInstance(_containerApi.TOKENS.SCREEN_DEVELOPER, _Developer.default);
    this.container.registerInstance(_containerApi.TOKENS.SCREEN_TERMS, _Terms.default);
    this.container.registerInstance(_containerApi.TOKENS.SCREEN_ONBOARDING, _Onboarding.default);
    this.container.registerInstance(_containerApi.TOKENS.STACK_ONBOARDING, _OnboardingStack.default);
    this.container.registerInstance(_containerApi.TOKENS.COMP_BUTTON, _Button.default);
    this.container.registerInstance(_containerApi.TOKENS.FN_ONBOARDING_DONE, (dispatch, navigation) => {
      return () => {
        dispatch({
          type: _store.DispatchAction.DID_COMPLETE_TUTORIAL
        });
        navigation.navigate(_navigators.Screens.Terms);
      };
    });
    return this;
  }
  resolve(token) {
    // eslint-disable-next-line no-console
    console.log(`resolving ${token}`);
    return this.container.resolve(token);
  }
  getContainer() {
    return this.container;
  }
}
exports.MainContainer = MainContainer;
const SystemContext = /*#__PURE__*/(0, _react.createContext)(undefined);
exports.SystemContext = SystemContext;
const SystemProvider = SystemContext.Provider;

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
exports.SystemProvider = SystemProvider;
const useSystem = () => (0, _react.useContext)(SystemContext);
exports.useSystem = useSystem;
//# sourceMappingURL=container-impl.js.map