"use client";

import VolunteerLocationFields from "./VolunteerLocationFields";
import VolunteerHoursFields from "./VolunteerHoursFields";
import type { VolunteerFormValues } from "./volunteerFormTypes";

interface VolunteerContextSectionsProps {
  values: VolunteerFormValues;
  setFieldValue: (field: string, value: unknown) => void;
  setFieldTouched: (field: string, touched: boolean) => void;
  selectedLanguage: string;
  /** Map picker vs. a pasted link — one or the other, never both. */
  showMapPicker: boolean;
  onUseMapPicker: () => void;
  onUseLocationLink: () => void;
  skipNextGeocodeRef: { current: boolean };
  /** The flags describing the opportunity's nature. */
  selectedCheckBoxes: string[];
  handleCheckboxChange: (key: string, checked: boolean) => void;
}

/**
 * Where the opportunity happens and what kind of thing it is — the two answers
 * that sit between the field grid and the description.
 */
export default function VolunteerContextSections({
  values,
  setFieldValue,
  setFieldTouched,
  selectedLanguage,
  showMapPicker,
  onUseMapPicker,
  onUseLocationLink,
  skipNextGeocodeRef,
  selectedCheckBoxes,
  handleCheckboxChange,
}: VolunteerContextSectionsProps) {
  return (
    <>
    <VolunteerLocationFields
      values={values}
      setFieldValue={setFieldValue}
      setFieldTouched={setFieldTouched}
      selectedLanguage={selectedLanguage}
      showMapPicker={showMapPicker}
      onUseMapPicker={onUseMapPicker}
      onUseLocationLink={onUseLocationLink}
      skipNextGeocodeRef={skipNextGeocodeRef}
    />

    <VolunteerHoursFields
      selectedCheckBoxes={selectedCheckBoxes}
      handleCheckboxChange={handleCheckboxChange}
    />
    </>
  );
}
