import { PrimariaShell } from "./UI/components/primaria-shell/primaria-shell";
import { activityMonitor, sessionRefreshTimer, shellApi } from "./api/api";
import { EcapContext } from "./api/context-manager/context-manager";
import { useFeatures } from "./features/bootstrapper";
import { useLocalization } from "./locales";
import { useUI } from "./UI/bootstrapper";

export const initializeShell = (hostAppElement: HTMLElement, ecapContext?: EcapContext) => {
  if (ecapContext) {
    (shellApi.contextManager as any).initializeContext(ecapContext);
  }

  activityMonitor.start();
  sessionRefreshTimer.start();
  useLocalization(shellApi);
  useUI();
  useFeatures(shellApi);
  const shell = new PrimariaShell();
  hostAppElement.appendChild(shell as any);
};
