export const HOME_SECTION_KEYS = ["hero", "statistics", "volunteer", "development", "community", "events", "sponsors", "why_fursa", "share_idea"] as const;
export type HomeSectionKey = typeof HOME_SECTION_KEYS[number];

/** Keep the main discovery sections in product order, preserving the remaining CMS order. */
export function resolveHomeSectionOrder(order?: readonly string[] | null): HomeSectionKey[] {
  const valid = (order ?? []).filter((key): key is HomeSectionKey => HOME_SECTION_KEYS.some(value => value === key));
  const leading: readonly HomeSectionKey[] = ["hero", "statistics", "volunteer", "development", "community", "events"];
  return [...leading, ...new Set([...valid, ...HOME_SECTION_KEYS].filter(key => !leading.includes(key)))];
}
