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

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

export default function PricingLayout({
  children,
}: {
  children: React.ReactNode
}) {
  const webPageSchema = generateWebPageSchema({
    title: SEO_CONFIG.pricing.title,
    description: SEO_CONFIG.pricing.description,
    url: `${SITE_URL}/pricing`,
  })
  
  const breadcrumbSchema = generateBreadcrumbSchema([
    { name: 'Home', url: SITE_URL },
    { name: 'Pricing', url: `${SITE_URL}/pricing` },
  ])
  
  const softwareSchema = generateSoftwareApplicationSchema()
  
  const faqSchema = generateFAQSchema([
    {
      question: 'Is there a free plan?',
      answer: 'Yes! Scout is completely free forever. You get access to the raw market feed, 5 watchlist domains, and basic TLD intelligence.',
    },
    {
      question: 'What payment methods do you accept?',
      answer: 'We accept all major credit cards (Visa, Mastercard, Amex) through Stripe. Payments are processed securely.',
    },
    {
      question: 'Can I cancel anytime?',
      answer: 'Absolutely. No contracts, no hidden fees. Cancel your subscription anytime from your account settings.',
    },
    {
      question: 'What is the Pounce Score?',
      answer: 'The Pounce Score is our proprietary domain valuation metric that considers length, TLD, keywords, brandability, and market comparables.',
    },
    {
      question: 'Do you charge commission on sales?',
      answer: 'No! Unlike other platforms that charge 10-20% commission, Pounce Direct marketplace has 0% commission. You keep 100% of your sale price.',
    },
  ])

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

