/**
 * The shapes the development-opportunity form works in.
 *
 * `LearnServeFormValues` is Formik's value object — it is also what the
 * validation schema and the payload builder are written against, so it is the
 * form's real contract and belongs somewhere all three can import it from
 * rather than inside the component.
 */
export interface LearnServeFormNavState {
  id?: string;
  isRepublish?: boolean;
}

export interface LearnServeFormValues {
  license_image_removed: boolean;
  title_ar: string;
  title_en: string;
  description_ar: string;
  description_en: string;
  paymentTermsLocked: boolean;
  dueDate: string;
  registrationDeadlineHours: string;
  registrationDeadlineEnabled?: boolean;
  startDate: string;
  endDate: string;
  participantsNeeded: string;
  age: [number | null, number | null];
  startTime: string;
  endTime: string;
  learningType: string;
  learnServeFormat: string;
  certificateType: string;
  location: string;
  location_url: string;
  latitude: string;
  longitude: string;
  meetingLink: string;
  whatsappLink: string;
  opportunity_images: File[];
  _interests: string[];
  sponsors: { sponsorId: string; position: number }[];
  primary_language: string;
  license_image?: File | string;
  gender: string;
  /*
   * Both are `"true"` / `"false"` strings rather than booleans: they are
   * rendered as `SelectInput`, which binds through Formik by name and matches
   * the field value against its option values. Converted back at submit.
   */
  opportunity_nationality: string;
  is_paid: string;
  /** Kept as a string: it is a text input, and "" is how "not answered" reads. */
  price: string;
  /**
   * The publisher's payout account (`PayoutBankFields`). Not part of the
   * opportunity payload: saved to the organization profile before submit.
   */
  payout_bank_id?: number | "";
  payout_bank_name: string;
  payout_bank_holder: string;
  payout_iban: string;
  /** The organizer chose "change" on an account already on file. */
  payout_bank_edit: boolean;
  /** The fields are on screen, so they are validated and saved. */
  payout_bank_needed: boolean;
}

export interface LearnServeFormProps {
  autoSetTimeOnClick?: boolean; // Auto-set time fields to 12:00 on first click
  /**
   * Set by the `/learn-and-share-form/edit/{id}` route. Takes precedence over
   * the sessionStorage payload, so the edit screen survives a reload — the
   * stashed nav state only ever survived one navigation. Repost still arrives
   * through nav state (`isRepublish`), since it creates a new opportunity.
   */
  opportunityId?: string;
}

// Leaflet touches `window` at import time, so it can't be part of the SSR pass.

export interface OpportunityDetails {
  startDate: string;
  endDate: string;
  startTime: string;
  endTime: string;
}
