import React from 'react'; interface HowToStep { name: string; text: string; image?: string; url?: string; } interface HowToSchemaProps { title: string; description: string; totalTime?: string; estimatedCost?: { value: string; currency: string; }; supply?: string[]; tool?: string[]; steps: HowToStep[]; image?: string; video?: { name: string; description: string; thumbnailUrl: string; uploadDate: string; duration: string; embedUrl: string; }; } export function HowToSchema({ title, description, totalTime, estimatedCost, supply, tool, steps, image, video }: HowToSchemaProps) { const schema = { "@context": "https://schema.org", "@type": "HowTo", "name": title, "description": description, "image": image, ...(totalTime && { "totalTime": totalTime }), ...(estimatedCost && { "estimatedCost": { "@type": "MonetaryAmount", "currency": estimatedCost.currency, "value": estimatedCost.value } }), ...(supply && supply.length > 0 && { "supply": supply.map(item => ({ "@type": "HowToSupply", "name": item })) }), ...(tool && tool.length > 0 && { "tool": tool.map(item => ({ "@type": "HowToTool", "name": item })) }), "step": steps.map((step, index) => ({ "@type": "HowToStep", "name": step.name, "text": step.text, "position": index + 1, ...(step.image && { "image": step.image }), ...(step.url && { "url": step.url }) })), ...(video && { "video": { "@type": "VideoObject", "name": video.name, "description": video.description, "thumbnailUrl": video.thumbnailUrl, "uploadDate": video.uploadDate, "duration": video.duration, "embedUrl": video.embedUrl } }) }; return (