// File Path: monorepo/web/frontend/src/pages/Admin/Event/InSchool/Add/Step1Page.jsx

import React, { useMemo } from "react";
import { useOnsiteEventWizardStorage } from "../../../../../services/Services";
import { EventStep1Component } from "../../../../../components/business/events";
import { HomeIcon } from "@heroicons/react/24/outline";
import { EVENT_TYPE_ONSITE } from "../../../../../constants/Event";

// Onsite event type configuration
const onsiteConfig = {
  eventType: EVENT_TYPE_ONSITE,
  labels: {
    wizardTitle: "Add New Onsite Event",
    eventTypeName: "Onsite Event",
    backToList: "Back to Onsite Events",
  },
  icons: {
    wizard: HomeIcon,
  },
  routes: {
    list: "/admin/events/in-schools",
    step1: "/admin/events/in-schools/add/step-1",
    step2: "/admin/events/in-schools/add/step-2",
    step3: "/admin/events/in-schools/add/step-3",
    step4: "/admin/events/in-schools/add/step-4",
  },
};

function AdminEventInSchoolAddStep1Page() {
  const onsiteEventWizardStorage = useOnsiteEventWizardStorage();

  // Wrapper for Onsite storage to match the generic interface - memoized to prevent re-renders
  const wrappedStorage = useMemo(
    () => ({
      getWizardData: () => onsiteEventWizardStorage.getOnsiteEventWizard(),
      saveWizardData: (data) =>
        onsiteEventWizardStorage.saveOnsiteEventWizard(data),
      clearWizardData: () => onsiteEventWizardStorage.clearOnsiteEventWizard(),
    }),
    [],
  );

  return (
    <EventStep1Component
      wizardStorage={wrappedStorage}
      eventTypeConfig={onsiteConfig}
    />
  );
}

export default AdminEventInSchoolAddStep1Page;
