import "./globals.css";
import type { Metadata } from "next";
import { LayoutShell } from "@/components/layout/layout-shell";
import { JsonLd } from "@/components/seo/json-ld";
import { Toaster } from "@/components/ui/sonner";
import { STORE_NAME, STORE_URL } from "@/lib/store-info";
import { businessJsonLd, SITE_DESCRIPTION, SOCIAL_IMAGE, websiteJsonLd } from "@/lib/seo";

export const metadata: Metadata = {
  metadataBase: new URL(STORE_URL),
  title: {
    default: `Opticienne à Antibes | ${STORE_NAME}`,
    template: `%s | ${STORE_NAME}`,
  },
  description: SITE_DESCRIPTION,
  applicationName: STORE_NAME,
  keywords: [
    "opticien Antibes",
    "lunettes Antibes",
    "lunettes de vue",
    "lunettes de soleil",
    "lentilles de contact",
    "opticienne diplômée",
  ],
  authors: [{ name: "Jessica DEVOUCOUX" }],
  creator: STORE_NAME,
  publisher: STORE_NAME,
  alternates: { canonical: "/" },
  icons: {
    icon: "/logojessica.png",
    apple: "/logojessica.png",
  },
  openGraph: {
    title: `Opticienne à Antibes | ${STORE_NAME}`,
    description: SITE_DESCRIPTION,
    url: "/",
    siteName: STORE_NAME,
    locale: "fr_FR",
    type: "website",
    images: [SOCIAL_IMAGE],
  },
  twitter: {
    card: "summary_large_image",
    title: `Opticienne à Antibes | ${STORE_NAME}`,
    description: SITE_DESCRIPTION,
    images: [SOCIAL_IMAGE],
  },
  robots: { index: true, follow: true },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="fr">
      <body>
        <JsonLd data={[websiteJsonLd, businessJsonLd]} />
        <LayoutShell>{children}</LayoutShell>
        <Toaster />
      </body>
    </html>
  );
}
