import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";

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

const siteUrl = "https://chatnest.io";

export const metadata: Metadata = {
  metadataBase: new URL(siteUrl),
  title: {
    default: "ChatNest — Official WhatsApp Business API Platform",
    template: "%s | ChatNest",
  },
  description:
    "Scale customer conversations with the official WhatsApp Business API. Shared team inbox, bulk broadcast, chatbot builder, AI assistant, and campaign automation in one platform.",
  keywords: [
    "WhatsApp Business API",
    "WhatsApp API platform",
    "WhatsApp broadcast tool",
    "WhatsApp chatbot builder",
    "WhatsApp CRM integration",
    "official WhatsApp API provider",
  ],
  authors: [{ name: "ChatNest, Inc." }],
  creator: "ChatNest, Inc.",
  openGraph: {
    type: "website",
    locale: "en_US",
    url: siteUrl,
    siteName: "ChatNest",
    title: "ChatNest — Official WhatsApp Business API Platform",
    description:
      "Scale customer conversations with the official WhatsApp Business API. Shared inbox, automation, and analytics in one platform.",
  },
  twitter: {
    card: "summary_large_image",
    title: "ChatNest — Official WhatsApp Business API Platform",
    description:
      "Scale customer conversations with the official WhatsApp Business API. Shared inbox, automation, and analytics in one platform.",
    creator: "@chatnest",
  },
  robots: {
    index: true,
    follow: true,
    googleBot: {
      index: true,
      follow: true,
      "max-image-preview": "large",
      "max-snippet": -1,
    },
  },
  icons: {
    icon: "/favicon.svg",
  },
};

const jsonLd = {
  "@context": "https://schema.org",
  "@type": "SoftwareApplication",
  name: "ChatNest",
  applicationCategory: "BusinessApplication",
  operatingSystem: "Web",
  description:
    "Official WhatsApp Business API platform with shared inbox, bulk broadcast, chatbot builder, AI assistant, and campaign automation.",
  offers: {
    "@type": "Offer",
    price: "19",
    priceCurrency: "USD",
  },
  aggregateRating: {
    "@type": "AggregateRating",
    ratingValue: "4.9",
    ratingCount: "1280",
  },
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en" className={inter.variable}>
      <head>
        <script
          type="application/ld+json"
          dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
        />
      </head>
      <body className="font-sans">{children}</body>
    </html>
  );
}
