import type { Metadata } from "next";
import { Oranienbaum, Inter } from "next/font/google";
import "../globals.css";
import Navbar from "@/components/Navbar";
import { getDictionary } from "@/dictionaries/get-dictionary";
import Footer from "@/components/Footer";

const oranienbaum = Oranienbaum({
  subsets: ["latin", "latin-ext"],
  weight: ["400"],
  variable: "--font-oranienbaum",
  display: "swap",
});

const inter = Inter({
  subsets: ["latin", "latin-ext"],
  variable: "--font-inter",
  display: "swap",
});

export const metadata: Metadata = {
  title: "Ayris - Luxury Accommodation",
  description: "Experience the ultimate comfort and luxury at Ayris.",
};

export async function generateStaticParams() {
  return [{ lang: 'en' }, { lang: 'tr' }]
}

export default async function RootLayout({
  children,
  params,
}: {
  children: React.ReactNode;
  params: Promise<{ lang: string }>;
}) {
  const { lang } = await params;
  const dict = await getDictionary(lang as 'en' | 'tr');

  const jsonLd = {
    "@context": "https://schema.org",
    "@type": "Hotel",
    "name": "Ayris Apart",
    "description": dict.hero.desc,
    "address": {
      "@type": "PostalAddress",
      "streetAddress": "Orta İskele Caddesi No:71",
      "addressLocality": "Milas",
      "addressRegion": "Muğla",
      "postalCode": "48220",
      "addressCountry": "TR"
    },
    "geo": {
      "@type": "GeoCoordinates",
      "latitude": 37.037,
      "longitude": 27.962
    },
    "url": "https://ayrisapart.com",
    "telephone": "+90",
    "image": "https://ayrisapart.com/logo.png",
    "amenityFeature": [
      { "@type": "LocationFeatureSpecification", "name": "Free Wi-Fi", "value": true },
      { "@type": "LocationFeatureSpecification", "name": "Kitchen", "value": true },
      { "@type": "LocationFeatureSpecification", "name": "Air Conditioning", "value": true },
      { "@type": "LocationFeatureSpecification", "name": "Free Parking", "value": true }
    ],
    "checkinTime": "14:00",
    "checkoutTime": "11:00"
  };

  return (
    <html lang={lang} className={`${oranienbaum.variable} ${inter.variable} h-full antialiased`}>
      <head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
        />
      </head>
      <body className="font-sans min-h-full flex flex-col bg-[#FAF7F0] text-[#1A1A1A]" suppressHydrationWarning>
        <Navbar lang={lang} dict={dict} />
        {children}
        <Footer lang={lang} dict={dict} />
      </body>
    </html>
  );
}
