import type { Metadata } from "next";
import "./globals.css";
import "./marketing.css";
import "./loans.css";
import "./contact.css";
import "./motion.css";
import { SiteHeader } from "@/components/site-header";
import { SiteFooter } from "@/components/site-footer";
import { MobileActions } from "@/components/mobile-actions";
import { StructuredData } from "@/components/structured-data";
import { ConnectionStatus } from "@/components/connection-status";
import { businessSchema, websiteSchema } from "@/lib/structured-data";

export const metadata: Metadata = {
  metadataBase: new URL("https://maxcredit.sg"),
  icons: {
    icon: [
      { url: "/favicon.ico", sizes: "16x16 32x32" },
      { url: "/images/favicon.png", type: "image/png", sizes: "32x32" },
      { url: "/images/icon-192.png", type: "image/png", sizes: "192x192" },
      { url: "/images/icon-512.png", type: "image/png", sizes: "512x512" },
    ],
    apple: "/images/apple-touch-icon.png",
  },
  title: {
    default: "Max Credit – Singapore Licensed Money Lender",
    template: "%s – Max Credit",
  },
  description:
    "MaxCredit is a Singapore licensed money lender. Explore our loan services and contact our Clementi office.",
};

export default function RootLayout({
  children,
}: Readonly<{ children: React.ReactNode }>) {
  return (
    <html lang="en-SG">
      <head>
        <link
          rel="preload"
          href="/fonts/713ca32c3c8b-rP2Yp2ywxg089UriI5-g4vlH9VoD8Cmcqbu0-K4.woff2"
          as="font"
          type="font/woff2"
          crossOrigin="anonymous"
        />
        <link
          rel="preload"
          href="/fonts/d8c30647abfe-LDIoaomQNQcsA88c7O9yZ4KMCoOg4Ko20yw.woff2"
          as="font"
          type="font/woff2"
          crossOrigin="anonymous"
        />
      </head>
      <body>
        <a className="skip-link" href="#main-content">
          Skip to content
        </a>
        <SiteHeader />
        <ConnectionStatus />
        {children}
        <SiteFooter />
        <MobileActions />
        <StructuredData value={businessSchema} />
        <StructuredData value={websiteSchema} />
      </body>
    </html>
  );
}
