import type { Metadata } from 'next';
import Header from '@/components/layout/Header';
import Footer from '@/components/layout/Footer';

const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://spanglish.com.py';

export const metadata: Metadata = {
  openGraph: {
    siteName: 'Spanglish',
    type: 'website',
    locale: 'en_US',
    alternateLocale: 'es_PY',
  },
  twitter: {
    card: 'summary_large_image',
  },
};

// JSON-LD Organization schema for all public pages
const organizationSchema = {
  '@context': 'https://schema.org',
  '@type': 'Organization',
  name: 'Spanglish Community',
  url: siteUrl,
  logo: `${siteUrl}/images/logo.png`,
  description: 'Language exchange community organizing English and Spanish meetups in Asunción, Paraguay.',
  address: {
    '@type': 'PostalAddress',
    addressLocality: 'Asunción',
    addressCountry: 'PY',
  },
  sameAs: [
    'https://instagram.com/spanglishsocialpy',
    process.env.NEXT_PUBLIC_WHATSAPP_URL,
    process.env.NEXT_PUBLIC_TELEGRAM_URL,
  ].filter(Boolean),
};

export default function PublicLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <div className="min-h-screen flex flex-col">
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(organizationSchema) }}
      />
      <Header />
      <main className="flex-1">{children}</main>
      <Footer />
    </div>
  );
}
