/**
 * The props every section of the organization account form receives.
 *
 * All four sections take the same bag — the form spreads one object into each,
 * which is deliberate, so the four call sites cannot drift apart. They used to
 * declare it as `Record<string, any>`, which meant every destructured name was
 * `any` and a misspelled one was silently `undefined` rather than a type error.
 *
 * Each field is derived from `useOrganizerAccountForm`'s own return type rather
 * than restated, so this interface cannot fall out of step with the hook that
 * fills it; only the Formik-supplied fields are spelled out, because those come
 * from the render prop rather than the hook.
 */
import type { FormikErrors, FormikProps, FormikTouched } from "formik";

import type { CombinedOrganizerFormValues } from "./organizerAccountTypes";
import type { useOrganizerAccountForm } from "./useOrganizerAccountForm";

type Screen = ReturnType<typeof useOrganizerAccountForm>;

export interface OrganizerSectionProps {
  /* From the `<Formik>` render prop. */
  values: CombinedOrganizerFormValues;
  errors: FormikErrors<CombinedOrganizerFormValues>;
  touched: FormikTouched<CombinedOrganizerFormValues>;
  setFieldValue: FormikProps<CombinedOrganizerFormValues>["setFieldValue"];
  setFieldTouched: FormikProps<CombinedOrganizerFormValues>["setFieldTouched"];

  /* From the hook. */
  profilePic: Screen["profilePic"];
  isProfilePicUpdating: Screen["isProfilePicUpdating"];
  uploadError: Screen["uploadError"];
  handleFileSelection: Screen["handleFileSelection"];
  fileInputRef: Screen["fileInputRef"];
  nicknameAvailability: Screen["nicknameAvailability"];
  checkNicknameAvailability: Screen["checkNicknameAvailability"];
  accountData: Screen["accountData"];
  organizerProfile: Screen["organizerProfile"];
  orgTypeOptions: Screen["orgTypeOptions"];
  orgTypeLoading: Screen["orgTypeLoading"];
  tagOptions: Screen["tagOptions"];
  tagsLoading: Screen["tagsLoading"];
  keptDocIds: Screen["keptDocIds"];
  setKeptDocIds: Screen["setKeptDocIds"];

  /* Computed by the form itself. */
  /** The saved nickname, so re-typing it is not treated as a conflict. */
  initialNickname: string;
  /** How many documents were stored before this edit. */
  originalDocCount: number;
  /** Whether any social row has been edited, for the validation message. */
  isSocialMediaTouched: boolean;
}
