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

import Nav from "@/components/Navbar/Nav";
import Footer from "@/components/Footer/Footer";
import {ThemeProvider} from "@/components/provider/ThemeProvider";
import React from "react";
import {cookies} from "next/headers";
import {themeColors} from "@/components/Helper/ThemeColors";

export const metadata: Metadata = {
    title: "Leistungen | Rhein Software",
    description: "Rhein Software Development",
};

export default async function RootLayout({
                                             children,
                                         }: Readonly<{
    children: React.ReactNode;
}>) {
    const cookieStore = await cookies();
    const theme = cookieStore.get("theme")?.value === "dark" ? "dark" : "light";
    const bgColor = themeColors[theme].primaryBg;

    return (
        <html lang="de" data-theme={theme}>
        <head/>
        <body className="antialiased" style={{backgroundColor: bgColor}}>
        <ThemeProvider>
            <Nav/>
            {children}
            <Footer/>
        </ThemeProvider>
        </body>
        </html>
    );
}
