import type { CreateRecipeInput } from '../types/recipe.js';
// ...other necessary imports...
// Dummy extract/logic: Map string[] to normalized CreateRecipeInput.ingredients
export function parseSchemaOrgRecipe(jsonLd: any): CreateRecipeInput {
  return {
    title: jsonLd.name,
    description: jsonLd.description,
    ingredients: (jsonLd.recipeIngredient??[]).map((item: string) => ({ item })),
    steps: (jsonLd.recipeInstructions??[]).map((txt: any) => ({ instruction: typeof txt === 'string' ? txt : txt.text })),
    source_url: jsonLd.url,
    image_url: Array.isArray(jsonLd.image) ? jsonLd.image[0] : (typeof jsonLd.image === 'string' ? jsonLd.image : (jsonLd.image?.url ?? undefined)),
  };
}
