import { Metadata } from 'next'
import Script from 'next/script'
import { SEO_CONFIG, SITE_URL, generateWebPageSchema, generateBreadcrumbSchema, generateFAQSchema } from '@/lib/seo'

export const metadata: Metadata = {
  title: SEO_CONFIG.yield.title,
  description: SEO_CONFIG.yield.description,
  keywords: SEO_CONFIG.yield.keywords,
  alternates: {
    canonical: `${SITE_URL}/yield`,
  },
  openGraph: {
    title: SEO_CONFIG.yield.title,
    description: SEO_CONFIG.yield.description,
    url: `${SITE_URL}/yield`,
    siteName: 'Pounce',
    images: [
      {
        url: `${SITE_URL}/og-yield.png`,
        width: 1200,
        height: 630,
        alt: 'Domain Monetization - Pounce Yield',
      },
    ],
    locale: 'en_US',
    type: 'website',
  },
  twitter: {
    card: 'summary_large_image',
    title: SEO_CONFIG.yield.title,
    description: SEO_CONFIG.yield.description,
    images: [`${SITE_URL}/og-yield.png`],
  },
}

export default function YieldLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const webPageSchema = generateWebPageSchema({
    title: SEO_CONFIG.yield.title,
    description: SEO_CONFIG.yield.description,
    url: `${SITE_URL}/yield`,
  })
  
  const breadcrumbSchema = generateBreadcrumbSchema([
    { name: 'Home', url: SITE_URL },
    { name: 'Domain Yield', url: `${SITE_URL}/yield` },
  ])
  
  const faqSchema = generateFAQSchema([
    {
      question: 'What is Pounce Yield?',
      answer: 'Pounce Yield is an AI-powered domain monetization system that turns parked domains into revenue-generating assets through intent routing, not traditional parking ads.',
    },
    {
      question: 'How much can I earn with Pounce Yield?',
      answer: 'Earnings depend on your domain\'s traffic and intent. High-intent domains in verticals like finance or software can earn $10-50+ per conversion, compared to pennies from traditional parking.',
    },
    {
      question: 'What is intent routing?',
      answer: 'Intent routing analyzes what visitors to your domain are looking for and routes them to relevant affiliate offers or services, maximizing conversion value.',
    },
    {
      question: 'What is the revenue share?',
      answer: 'Trader members receive 70% of all affiliate revenue generated. Tycoon members get priority routing to highest-paying partners.',
    },
  ])

  return (
    <>
      <Script
        id="yield-webpage-schema"
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(webPageSchema) }}
      />
      <Script
        id="yield-breadcrumb-schema"
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbSchema) }}
      />
      <Script
        id="yield-faq-schema"
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(faqSchema) }}
      />
      {children}
    </>
  )
}

