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

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

// Offsite event type configuration
const offsiteConfig = {
  eventType: EVENT_TYPE_OFFSITE,
  labels: {
    wizardTitle: "Add New Offsite Event",
    eventTypeName: "Offsite Event",
    backToList: "Back to Offsite Events",
  },
  icons: {
    wizard: TruckIcon,
  },
  routes: {
    list: "/admin/events/field-trips",
    step1: "/admin/events/field-trips/add/step-1",
    step2: "/admin/events/field-trips/add/step-2",
    step3: "/admin/events/field-trips/add/step-3",
    step4: "/admin/events/field-trips/add/step-4",
  },
};

function AdminEventFieldTripAddStep1Page() {
  const offsiteEventWizardStorage = useOffsiteEventWizardStorage();

  // Wrapper for Offsite storage to match the generic interface - memoized to prevent re-renders
  const wrappedStorage = useMemo(
    () => ({
      getWizardData: () => offsiteEventWizardStorage.getOffsiteEventWizard(),
      saveWizardData: (data) =>
        offsiteEventWizardStorage.saveOffsiteEventWizard(data),
      clearWizardData: () =>
        offsiteEventWizardStorage.clearOffsiteEventWizard(),
    }),
    [],
  );

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

export default AdminEventFieldTripAddStep1Page;
