import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import { getSiteSettings } from "@/lib/content";

const inter = localFont({
  src: "./fonts/inter-latin.woff2",
  display: "swap",
  variable: "--font-inter"
});

export async function generateMetadata(): Promise<Metadata> {
  const settings = await getSiteSettings();

  return {
    metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL ?? "https://www.akarya.id"),
    title: {
      default: settings.defaultSeoTitle.en,
      template: "%s"
    },
    description: settings.defaultSeoDescription.en,
    icons: {
      icon: "/logos/akarya/akarya-logo-simple-blue.png",
      apple: "/logos/akarya/akarya-logo-simple-blue.png"
    }
  };
}

export default function RootLayout({ children }: Readonly<{ children: React.ReactNode }>) {
  return (
    <html lang="en">
      <body className={inter.variable}>{children}</body>
    </html>
  );
}
