import { AnyTypedQuizQuestion, UntypedQuizQuestion } from "@model/questionTypes/shared";
import { create } from "zustand";
import { devtools } from "zustand/middleware";


export type QuestionsStore = {
    questions: (AnyTypedQuizQuestion | UntypedQuizQuestion);
    openedModalSettingsId: string | null;
    dragQuestionContentId: string | null;
};

const initialState: QuestionsStore = {
    questions: [],
    openedModalSettingsId: null as null,
    dragQuestionContentId: null,
};

export const useQuestionsStore = create<QuestionsStore>()(
    devtools(
        () => initialState,
        {
            name: "QuestionsStore",
            enabled: process.env.NODE_ENV === "development",
            trace: process.env.NODE_ENV === "development",
            actionsBlacklist: "ignored",
        }
    )
);
