import { QuizSettings } from "@model/settingsData";
import { createContext, useContext } from "react";

export const QuizSettingsContext = createContext<
  | (QuizSettings & {
      quizId: string;
      preview: boolean;
      changeFaviconAndTitle: boolean;
    })
  | null
>(null);

export const useQuizSettings = () => {
  const quizSettings = useContext(QuizSettingsContext);
  if (quizSettings === null) throw new Error("QuizSettings context is null");

  return quizSettings;
};
