import type { Metadata, Viewport } from "next";
import "./globals.css";
import { getSettings } from "@/lib/settings";

export async function generateMetadata(): Promise<Metadata> {
  const s = await getSettings();
  const base = process.env.APP_URL || "http://localhost:3000";
  return {
    metadataBase: new URL(base),
    title: { default: `${s.brandName} | Bags, accessories and dresses`, template: `%s | ${s.brandName}` },
    description: "Bags, accessories and dresses made in small pre-order batches. Delivery across Bangladesh.",
    openGraph: { siteName: s.brandName, type: "website", images: [{ url: "/brand/logo-paper.png", width: 1254, height: 1254 }] },
    icons: { icon: s.faviconUrl },
  };
}

export const viewport: Viewport = { width: "device-width", initialScale: 1, themeColor: "#FFFFFF" };

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