import React, { useContext } from "react";
import { POIs } from "@local-logic/client";
import { RootProps } from "./types";

export type DefaultContext = RootProps["options"] & {
  activeTab: keyof POIs;
  setActiveTab: React.Dispatch<React.SetStateAction<keyof POIs>>;
};

const RootElementContext = React.createContext<DefaultContext>(
  {} as DefaultContext
);
const useRootElement = () => useContext(RootElementContext);

export { useRootElement, RootElementContext };
