export interface SEOData {
  title: string
  description: string
  url: string
  image?: string
  type?: 'website' | 'article'
  author?: string
  publishedTime?: string
}

export function generateStructuredData(data: SEOData) {
  const structuredData: any = {
    '@context': 'https://schema.org',
    '@type': data.type === 'article' ? 'BlogPosting' : 'WebSite',
    headline: data.title,
    description: data.description,
    url: data.url,
  }

  if (data.image) {
    structuredData.image = data.image
  }

  if (data.type === 'article') {
    structuredData.author = {
      '@type': 'Person',
      name: data.author || 'Unknown',
    }
    structuredData.datePublished = data.publishedTime
  }

  return JSON.stringify(structuredData)
}
