import type { AiImportResponse, AiExtractedCategory } from "@menulio/shared";

let currentImportData: AiImportResponse | null = null;

export const aiStore = {
  setImportData: (data: AiImportResponse) => {
    currentImportData = data;
  },
  getImportData: (): AiImportResponse | null => {
    return currentImportData;
  },
  updateCategories: (categories: AiExtractedCategory[]) => {
    if (currentImportData) {
      currentImportData = {
        ...currentImportData,
        categories,
      };
    }
  },
  clear: () => {
    currentImportData = null;
  },
};
