import type { Metadata } from "next";
import { headers } from "next/headers";
import "./globals.css";
import Navbar from "@/components/Navbar";
import Footer from "@/components/Footer";

export const metadata: Metadata = {
  title: {
    default: "Angolo di Pace",
    template: "%s | Angolo di Pace",
  },
  description: "Vaš odmor uz more — informacije o kući, okolini i savjeti za boravak.",
};

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  const pathname = (await headers()).get("x-pathname") ?? "";
  const isLoginPage = pathname === "/login";

  return (
    <html lang="sr">
      <body>
        {!isLoginPage && <Navbar />}
        <main className="min-h-screen">{children}</main>
        {!isLoginPage && <Footer />}
      </body>
    </html>
  );
}
